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

KDEUI

kactioncollection.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) 2005-2006 Hamish Rodda <rodda@kde.org>
00010 
00011     This library is free software; you can redistribute it and/or
00012     modify it under the terms of the GNU Library General Public
00013     License version 2 as published by the Free Software Foundation.
00014 
00015     This library is distributed in the hope that it will be useful,
00016     but WITHOUT ANY WARRANTY; without even the implied warranty of
00017     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018     Library General Public License for more details.
00019 
00020     You should have received a copy of the GNU Library General Public License
00021     along with this library; see the file COPYING.LIB.  If not, write to
00022     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00023     Boston, MA 02110-1301, USA.
00024 */
00025 
00026 #ifndef KACTIONCOLLECTION_H
00027 #define KACTIONCOLLECTION_H
00028 
00029 #include <kdeui_export.h>
00030 #include <kstandardaction.h>
00031 #include <kcomponentdata.h>
00032 
00033 #include <QtCore/QObject>
00034 
00035 class QAction;
00036 class KXMLGUIClient;
00037 
00038 class QActionGroup;
00039 class QString;
00040 
00056 class KDEUI_EXPORT KActionCollection : public QObject
00057 {
00058   friend class KXMLGUIClient;
00059 
00060   Q_OBJECT
00061 
00062   Q_PROPERTY( QString configGroup READ configGroup WRITE setConfigGroup )
00063   Q_PROPERTY( bool configIsGlobal READ configIsGlobal WRITE setConfigGlobal )
00064 
00065 public:
00070   explicit KActionCollection(QObject *parent, const KComponentData &cData = KComponentData());
00071 
00075   virtual ~KActionCollection();
00076 
00080   static const QList<KActionCollection*>& allCollections();
00081 
00085   void clear();
00086 
00094   void associateWidget(QWidget* widget) const;
00095 
00104   void addAssociatedWidget(QWidget* widget);
00105 
00110   void removeAssociatedWidget(QWidget* widget);
00111 
00115   QList<QWidget*> associatedWidgets() const;
00116 
00120   void clearAssociatedWidgets();
00121 
00125   QString configGroup() const;
00126 
00131   bool configIsGlobal() const;
00132 
00136   void setConfigGroup( const QString& group );
00137 
00142   void setConfigGlobal( bool global );
00143 
00151   void readSettings( KConfigGroup* config = 0 );
00152 
00160   void importGlobalShortcuts( KConfigGroup* config );
00161 
00170   void exportGlobalShortcuts( KConfigGroup* config, bool writeDefaults = false ) const;
00171 
00187   void writeSettings( KConfigGroup* config = 0, bool writeDefaults = false, QAction* oneAction = 0 ) const;
00188 
00194   int count() const;
00195 
00199   bool isEmpty() const;
00200 
00206   QAction *action(int index) const;
00207 
00215   QAction* action( const QString& name ) const;
00216 
00220   QList<QAction*> actions() const;
00221 
00225   const QList<QAction*> actionsWithoutGroup() const;
00226 
00230   const QList<QActionGroup*> actionGroups() const;
00231 
00241   void setComponentData(const KComponentData &componentData);
00242 
00244   KComponentData componentData() const;
00245 
00249   const KXMLGUIClient *parentGUIClient() const;
00250 
00251 Q_SIGNALS:
00255   void inserted( QAction* action );
00256 
00261   QT_MOC_COMPAT void removed( QAction* action );
00262 
00267   QT_MOC_COMPAT void actionHighlighted(QAction* action);
00268   
00272   void actionHovered(QAction* action);
00273 
00277   void actionTriggered(QAction* action);
00278 
00279 protected Q_SLOTS:
00281   virtual void connectNotify ( const char * signal );
00282 
00283   virtual void slotActionTriggered();
00284   
00289   QT_MOC_COMPAT virtual void slotActionHighlighted();
00290 
00291 private Q_SLOTS:
00292   void slotActionHovered();
00293   
00294 
00295 public:
00309   QAction *addAction(const QString &name, QAction *action);
00310   KAction *addAction(const QString &name, KAction *action);
00311 
00316   void removeAction(QAction *action);
00317 
00322   QAction* takeAction(QAction *action);
00323 
00331   KAction *addAction(KStandardAction::StandardAction actionType, const QObject *receiver = 0, const char *member = 0);
00338   KAction *addAction(KStandardAction::StandardAction actionType, const QString &name,
00339                      const QObject *receiver = 0, const char *member = 0);
00340 
00355   KAction *addAction(const QString &name, const QObject *receiver = 0, const char *member = 0);
00356 
00362   template<class ActionType>
00363   ActionType *add(const QString &name, const QObject *receiver = 0, const char *member = 0)
00364   {
00365       ActionType *a = new ActionType(this);
00366       if (receiver && member)
00367           connect(a, SIGNAL(triggered()), receiver, member);
00368       addAction(name, a);
00369       return a;
00370   }
00371 
00372 private:
00373   Q_PRIVATE_SLOT(d, void _k_actionDestroyed(QObject *))
00374   Q_PRIVATE_SLOT(d, void _k_associatedWidgetDestroyed(QObject*))
00375 
00376   KActionCollection( const KXMLGUIClient* parent ); // used by KXMLGUIClient
00377 
00378   friend class KActionCollectionPrivate;
00379   class KActionCollectionPrivate* const d;
00380 };
00381 
00382 #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
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
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