• Skip to content
  • Skip to link menu
KDE 4.2 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 
00223   QList<QAction*> actions() const;
00224 
00228   const QList<QAction*> actionsWithoutGroup() const;
00229 
00233   const QList<QActionGroup*> actionGroups() const;
00234 
00244   void setComponentData(const KComponentData &componentData);
00245 
00247   KComponentData componentData() const;
00248 
00252   const KXMLGUIClient *parentGUIClient() const;
00253 
00254 Q_SIGNALS:
00258   void inserted( QAction* action );
00259 
00264   QT_MOC_COMPAT void removed( QAction* action );
00265 
00270   QT_MOC_COMPAT void actionHighlighted(QAction* action);
00271   
00275   void actionHovered(QAction* action);
00276 
00280   void actionTriggered(QAction* action);
00281 
00282 protected Q_SLOTS:
00284   virtual void connectNotify ( const char * signal );
00285 
00286   virtual void slotActionTriggered();
00287   
00292   QT_MOC_COMPAT virtual void slotActionHighlighted();
00293 
00294 private Q_SLOTS:
00295   void slotActionHovered();
00296   
00297 
00298 public:
00312   QAction *addAction(const QString &name, QAction *action);
00313   KAction *addAction(const QString &name, KAction *action);
00314 
00319   void removeAction(QAction *action);
00320 
00325   QAction* takeAction(QAction *action);
00326 
00334   KAction *addAction(KStandardAction::StandardAction actionType, const QObject *receiver = 0, const char *member = 0);
00341   KAction *addAction(KStandardAction::StandardAction actionType, const QString &name,
00342                      const QObject *receiver = 0, const char *member = 0);
00343 
00358   KAction *addAction(const QString &name, const QObject *receiver = 0, const char *member = 0);
00359 
00376   template<class ActionType>
00377   ActionType *add(const QString &name, const QObject *receiver = 0, const char *member = 0)
00378   {
00379       ActionType *a = new ActionType(this);
00380       if (receiver && member)
00381           connect(a, SIGNAL(triggered(bool)), receiver, member);
00382       addAction(name, a);
00383       return a;
00384   }
00385 
00386 private:
00387   Q_PRIVATE_SLOT(d, void _k_actionDestroyed(QObject *))
00388   Q_PRIVATE_SLOT(d, void _k_associatedWidgetDestroyed(QObject*))
00389 
00390   KActionCollection( const KXMLGUIClient* parent ); // used by KXMLGUIClient
00391 
00392   friend class KActionCollectionPrivate;
00393   class KActionCollectionPrivate* const d;
00394 };
00395 
00396 #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
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
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