KDEUI
kcombobox.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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
00037
00038
00039
00040
00146 class KDEUI_EXPORT KComboBox : public QComboBox, public KCompletionBase
00147 {
00148 Q_OBJECT
00149 Q_PROPERTY( bool autoCompletion READ autoCompletion WRITE setAutoCompletion )
00150 Q_PROPERTY( bool urlDropsEnabled READ urlDropsEnabled WRITE setUrlDropsEnabled )
00151 Q_PROPERTY( bool trapReturnKey READ trapReturnKey WRITE setTrapReturnKey )
00152
00153 public:
00154
00161 explicit KComboBox( QWidget *parent=0 );
00162
00171 explicit KComboBox( bool rw, QWidget *parent=0 );
00172
00176 virtual ~KComboBox();
00177
00182 KDE_DEPRECATED void insertURL( const KUrl& url, int index = -1 )
00183 { insertUrl( index < 0 ? count() : index, url ); }
00184 KDE_DEPRECATED void insertURL( const QPixmap& pixmap, const KUrl& url, int index = -1 )
00185 { insertUrl( index < 0 ? count() : index, QIcon(pixmap), url ); }
00186 KDE_DEPRECATED void changeURL( const KUrl& url, int index )
00187 { changeUrl( index, url ); }
00188 KDE_DEPRECATED void changeURL( const QPixmap& pixmap, const KUrl& url, int index )
00189 { changeUrl( index, QIcon(pixmap), url ); }
00190
00196 void setEditUrl( const KUrl& url );
00197
00203 void addUrl( const KUrl& url );
00204
00210 void addUrl( const QIcon& icon, const KUrl& url );
00211
00217 void insertUrl( int index, const KUrl& url );
00218
00224 void insertUrl( int index, const QIcon& icon, const KUrl& url );
00225
00231 void changeUrl( int index, const KUrl& url );
00232
00238 void changeUrl( int index , const QIcon& icon, const KUrl& url);
00239
00248 int cursorPosition() const;
00249
00260 virtual void setAutoCompletion( bool autocomplete );
00261
00271 bool autoCompletion() const;
00272
00289 virtual KDE_DEPRECATED void setContextMenuEnabled( bool showMenu );
00290
00298 void setUrlDropsEnabled( bool enable );
00299
00303 bool urlDropsEnabled() const;
00304
00314 bool contains( const QString& text ) const;
00315
00329 void setTrapReturnKey( bool trap );
00330
00337 bool trapReturnKey() const;
00338
00342 virtual bool eventFilter( QObject *, QEvent * );
00343
00353 KCompletionBox * completionBox( bool create = true );
00354
00364 virtual void setLineEdit( QLineEdit * );
00365
00373 void setEditable(bool editable);
00374
00375 Q_SIGNALS:
00381 void returnPressed();
00382
00392 void returnPressed( const QString& );
00393
00402 void completion( const QString& );
00403
00407 void substringCompletion( const QString& );
00408
00420 void textRotation( KCompletionBase::KeyBindingType );
00421
00426 void completionModeChanged( KGlobalSettings::Completion );
00427
00437 void aboutToShowContextMenu( QMenu * p );
00438
00439 public Q_SLOTS:
00440
00458 void rotateText( KCompletionBase::KeyBindingType type );
00459
00466 virtual void setCompletedText( const QString& );
00467
00472 void setCompletedItems( const QStringList& items, bool autosubject = true );
00473
00479 void setCurrentItem( const QString& item, bool insert = false, int index = -1 );
00480
00481 protected Q_SLOTS:
00482
00494 virtual void makeCompletion( const QString& );
00495
00496 protected:
00497
00498
00499
00500
00501
00502
00503
00504
00505 virtual void setCompletedText( const QString& , bool );
00506
00510 virtual void create( WId = 0, bool initializeWindow = true,
00511 bool destroyOldWindow = true );
00512
00513 virtual void wheelEvent( QWheelEvent *ev );
00514
00515 virtual QSize minimumSizeHint() const;
00516
00517 private Q_SLOTS:
00518 void lineEditDeleted();
00519
00520 private:
00524 void init();
00525
00526 private:
00527 class KComboBoxPrivate;
00528 KComboBoxPrivate* const d;
00529 };
00530
00531
00532
00533 #endif
00534