• Skip to content
  • Skip to link menu
KDE 4.3 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KDEUI

kselectaction.h

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002     Copyright (C) 1999 Reginald Stadlbauer <reggie@kde.org>
00003               (C) 1999 Simon Hausmann <hausmann@kde.org>
00004               (C) 2000 Nicolas Hadacek <haadcek@kde.org>
00005               (C) 2000 Kurt Granroth <granroth@kde.org>
00006               (C) 2000 Michael Koch <koch@kde.org>
00007               (C) 2001 Holger Freyther <freyther@kde.org>
00008               (C) 2002 Ellis Whitehead <ellis@kde.org>
00009               (C) 2003 Andras Mantia <amantia@kde.org>
00010               (C) 2005-2006 Hamish Rodda <rodda@kde.org>
00011               (C) 2006 Albert Astals Cid <aacid@kde.org>
00012               (C) 2006 Clarence Dang <dang@kde.org>
00013               (C) 2006 Michel Hermier <michel.hermier@gmail.com>
00014               (C) 2007 Nick Shaforostoff <shafff@ukr.net>
00015 
00016     This library is free software; you can redistribute it and/or
00017     modify it under the terms of the GNU Library General Public
00018     License version 2 as published by the Free Software Foundation.
00019 
00020     This library is distributed in the hope that it will be useful,
00021     but WITHOUT ANY WARRANTY; without even the implied warranty of
00022     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00023     Library General Public License for more details.
00024 
00025     You should have received a copy of the GNU Library General Public License
00026     along with this library; see the file COPYING.LIB.  If not, write to
00027     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00028     Boston, MA 02110-1301, USA.
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

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
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
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