KDEUI
kselectaction.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
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef KSELECTACTION_H
00032 #define KSELECTACTION_H
00033
00034 #include <QtGui/QToolButton>
00035
00036 #include <kaction.h>
00037
00038 class KSelectActionPrivate;
00039
00051 class KDEUI_EXPORT KSelectAction : public KAction
00052 {
00053 Q_OBJECT
00054 Q_PROPERTY( QAction* currentAction READ currentAction WRITE setCurrentAction )
00055 Q_PROPERTY( bool editable READ isEditable WRITE setEditable )
00056 Q_PROPERTY( int comboWidth READ comboWidth WRITE setComboWidth )
00057 Q_PROPERTY( QString currentText READ currentText )
00058 Q_ENUMS( ToolbarMode )
00059 Q_PROPERTY( ToolBarMode toolBarMode READ toolBarMode WRITE setToolBarMode )
00060 Q_PROPERTY( QToolButton::ToolButtonPopupMode toolButtonPopupMode READ toolButtonPopupMode WRITE setToolButtonPopupMode )
00061 Q_PROPERTY( int currentItem READ currentItem WRITE setCurrentItem )
00062 Q_PROPERTY( QStringList items READ items WRITE setItems )
00063 Q_DECLARE_PRIVATE(KSelectAction)
00064
00065
00066 public:
00072 explicit KSelectAction(QObject *parent);
00073
00086 KSelectAction(const QString& text, QObject *parent);
00087
00099 KSelectAction(const KIcon& icon, const QString& text, QObject *parent);
00100
00104 virtual ~KSelectAction();
00105
00106 enum ToolBarMode {
00108 MenuMode,
00111 ComboBoxMode
00112 };
00113
00118 ToolBarMode toolBarMode() const;
00119
00123 void setToolBarMode(ToolBarMode mode);
00124
00131 QToolButton::ToolButtonPopupMode toolButtonPopupMode() const;
00132
00136 void setToolButtonPopupMode(QToolButton::ToolButtonPopupMode mode);
00137
00141 QActionGroup* selectableActionGroup() const;
00142
00147 QAction* currentAction() const;
00148
00154 int currentItem() const;
00155
00161 QString currentText() const;
00162
00166 QList<QAction*> actions() const;
00167
00171 QAction* action(int index) const;
00172
00177 QAction* action(const QString& text, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
00178
00186 bool setCurrentAction(QAction* action);
00187
00199 bool setCurrentItem(int index);
00200
00212 bool setCurrentAction(const QString& text, Qt::CaseSensitivity cs = Qt::CaseSensitive);
00213
00217 virtual void addAction(QAction* action);
00218
00227 KAction* addAction(const QString& text);
00228
00237 KAction* addAction(const KIcon& icon, const QString& text);
00238
00244 virtual QAction* removeAction(QAction* action);
00245
00250 void setItems( const QStringList &lst );
00251
00257 QStringList items() const;
00258
00263 bool isEditable() const;
00264
00269 void setEditable( bool );
00270
00275 int comboWidth() const;
00276
00282 void setComboWidth( int width );
00283
00288 void setMaxComboViewCount( int n );
00289
00295 void clear();
00296
00297 void removeAllActions();
00298
00309 void setMenuAccelsEnabled( bool b );
00310
00315 bool menuAccelsEnabled() const;
00316
00320 void changeItem( int index, const QString& text );
00321
00322 Q_SIGNALS:
00327 void triggered( QAction* action );
00328
00333 void triggered( int index );
00334
00339 void triggered( const QString& text );
00340
00341 protected Q_SLOTS:
00345 virtual void actionTriggered(QAction* action);
00346
00350 void slotToggled(bool);
00351
00352 protected:
00356 virtual QWidget *createWidget(QWidget *parent);
00357
00361 virtual void deleteWidget(QWidget *widget);
00362
00363 virtual bool eventFilter (QObject *watched, QEvent *event);
00364
00372 KSelectAction(KSelectActionPrivate &dd, QObject *parent);
00373
00374 KSelectActionPrivate *d_ptr;
00375
00376 private:
00377 Q_PRIVATE_SLOT( d_func(), void _k_comboBoxDeleted(QObject*) )
00378 Q_PRIVATE_SLOT( d_func(), void _k_comboBoxCurrentIndexChanged(int) )
00379 };
00380
00381 #endif