• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • kdelibs
  • KDE Home
  • Contact Us
 

KDEUI

kcombobox.h

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002 
00003    Copyright (c) 2000,2001 Dawit Alemayehu <adawit@kde.org>
00004    Copyright (c) 2000,2001 Carsten Pfeiffer <pfeiffer@kde.org>
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Lesser General Public
00008    License (LGPL) as published by the Free Software Foundation; either
00009    version 2 of the License, or (at your option) any later version.
00010 
00011    This library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Lesser General Public License for more details.
00015 
00016    You should have received a copy of the GNU Lesser General Public License
00017    along with this library; see the file COPYING.LIB.  If not, write to
00018    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019    Boston, MA 02110-1301, USA.
00020 */
00021 
00022 #ifndef KCOMBOBOX_H
00023 #define KCOMBOBOX_H
00024 
00025 #include <QtGui/QComboBox>
00026 
00027 #include <kcompletion.h>
00028 
00029 class QLineEdit;
00030 class QMenu;
00031 
00032 class KCompletionBox;
00033 class KUrl;
00034 
00035 /*
00036  * ### KDE 5: On all methods that it is said that a prettyUrl will be used, it
00037  *            would be nice to add a flag to the method for forcing the pretty
00038  *            url or not. (ereslibre)
00039  */
00040 
00148 class KDEUI_EXPORT KComboBox : public QComboBox, public KCompletionBase //krazy:exclude=qclasses
00149 {
00150   Q_OBJECT
00151   Q_PROPERTY( bool autoCompletion READ autoCompletion WRITE setAutoCompletion )
00152   Q_PROPERTY( bool urlDropsEnabled READ urlDropsEnabled WRITE setUrlDropsEnabled )
00153   Q_PROPERTY( bool trapReturnKey READ trapReturnKey WRITE setTrapReturnKey )
00154 
00155 public:
00156 
00163     explicit KComboBox( QWidget *parent=0 );
00164 
00173     explicit KComboBox( bool rw, QWidget *parent=0 );
00174 
00178     virtual ~KComboBox();
00179 
00184 #ifndef KDE_NO_DEPRECATED
00185     KDE_DEPRECATED void insertURL( const KUrl& url, int index = -1 )
00186     { insertUrl( index < 0 ? count() : index, url ); }
00187     KDE_DEPRECATED void insertURL( const QPixmap& pixmap, const KUrl& url, int index = -1 )
00188     { insertUrl( index < 0 ? count() : index, QIcon(pixmap), url ); }
00189     KDE_DEPRECATED void changeURL( const KUrl& url, int index )
00190     { changeUrl( index, url ); }
00191     KDE_DEPRECATED void changeURL( const QPixmap& pixmap, const KUrl& url, int index )
00192     { changeUrl( index, QIcon(pixmap), url ); }
00193 #endif
00194 
00200     void setEditUrl( const KUrl& url );
00201 
00207     void addUrl( const KUrl& url );
00208 
00214     void addUrl( const QIcon& icon,  const KUrl& url );
00215 
00221     void insertUrl( int index, const KUrl& url );
00222 
00228     void insertUrl( int index, const QIcon& icon, const KUrl& url );
00229 
00235     void changeUrl( int index, const KUrl& url );
00236 
00242     void changeUrl( int index , const QIcon& icon, const KUrl& url);
00243 
00252     int cursorPosition() const;
00253 
00264     virtual void setAutoCompletion( bool autocomplete );
00265 
00275     bool autoCompletion() const;
00276 
00293 #ifndef KDE_NO_DEPRECATED
00294     virtual KDE_DEPRECATED void setContextMenuEnabled( bool showMenu );
00295 #endif
00296 
00304     void setUrlDropsEnabled( bool enable );
00305 
00309     bool urlDropsEnabled() const;
00310 
00320     bool contains( const QString& text ) const;
00321 
00335     void setTrapReturnKey( bool trap );
00336 
00343     bool trapReturnKey() const;
00344 
00348     virtual bool eventFilter( QObject *, QEvent * );
00349 
00359     KCompletionBox * completionBox( bool create = true );
00360 
00370     virtual void setLineEdit( QLineEdit * );
00371 
00379     void setEditable(bool editable);
00380 
00381 Q_SIGNALS:
00387     void returnPressed();
00388 
00398     void returnPressed( const QString& );
00399 
00408     void completion( const QString& );
00409 
00413     void substringCompletion( const QString& );
00414 
00426     void textRotation( KCompletionBase::KeyBindingType );
00427 
00432     void completionModeChanged( KGlobalSettings::Completion );
00433 
00443     void aboutToShowContextMenu( QMenu * p );
00444 
00445 public Q_SLOTS:
00446 
00464     void rotateText( KCompletionBase::KeyBindingType type );
00465 
00472     virtual void setCompletedText( const QString& );
00473 
00478     void setCompletedItems( const QStringList& items, bool autosubject = true );
00479 
00485     void setCurrentItem( const QString& item, bool insert = false, int index = -1 );
00486 
00487 protected Q_SLOTS:
00488 
00500     virtual void makeCompletion( const QString& );
00501 
00502 protected:
00503     /*
00504     * This function simply sets the lineedit text and
00505     * highlights the text appropriately if the boolean
00506     * value is set to true.
00507     *
00508     * @param
00509     * @param
00510     */
00511     virtual void setCompletedText( const QString& /* */, bool /*marked*/ );
00512 
00516     virtual void create( WId = 0, bool initializeWindow = true,
00517                          bool destroyOldWindow = true );
00518 
00519     virtual void wheelEvent( QWheelEvent *ev );
00520 
00521     virtual QSize minimumSizeHint() const;
00522 
00523 private Q_SLOTS:
00524     void lineEditDeleted();
00525 
00526 private:
00530     void init();
00531 
00532 private:
00533     class KComboBoxPrivate;
00534     KComboBoxPrivate* const d;
00535 };
00536 
00537 
00538 
00539 #endif
00540 

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal