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

KDEUI

  • sources
  • kde-4.14
  • kdelibs
  • kdeui
  • actions
kactioncollection.h
Go to the documentation of this file.
1 /* This file is part of the KDE libraries
2  Copyright (C) 1999 Reginald Stadlbauer <reggie@kde.org>
3  (C) 1999 Simon Hausmann <hausmann@kde.org>
4  (C) 2000 Nicolas Hadacek <haadcek@kde.org>
5  (C) 2000 Kurt Granroth <granroth@kde.org>
6  (C) 2000 Michael Koch <koch@kde.org>
7  (C) 2001 Holger Freyther <freyther@kde.org>
8  (C) 2002 Ellis Whitehead <ellis@kde.org>
9  (C) 2005-2006 Hamish Rodda <rodda@kde.org>
10 
11  This library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU Library General Public
13  License version 2 as published by the Free Software Foundation.
14 
15  This library is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Library General Public License for more details.
19 
20  You should have received a copy of the GNU Library General Public License
21  along with this library; see the file COPYING.LIB. If not, write to
22  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23  Boston, MA 02110-1301, USA.
24 */
25 
26 #ifndef KACTIONCOLLECTION_H
27 #define KACTIONCOLLECTION_H
28 
29 #include <kdeui_export.h>
30 #include <kstandardaction.h>
31 #include <kcomponentdata.h>
32 
33 #include <QtCore/QObject>
34 
35 class QAction;
36 class KXMLGUIClient;
37 
38 class QActionGroup;
39 class QString;
40 
56 class KDEUI_EXPORT KActionCollection : public QObject
57 {
58  friend class KXMLGUIClient;
59 
60  Q_OBJECT
61 
62  Q_PROPERTY( QString configGroup READ configGroup WRITE setConfigGroup )
63  Q_PROPERTY( bool configIsGlobal READ configIsGlobal WRITE setConfigGlobal )
64 
65 public:
70  explicit KActionCollection(QObject *parent, const KComponentData &cData = KComponentData());
71 
75  virtual ~KActionCollection();
76 
80  static const QList<KActionCollection*>& allCollections();
81 
85  void clear();
86 
94  void associateWidget(QWidget* widget) const;
95 
104  void addAssociatedWidget(QWidget* widget);
105 
110  void removeAssociatedWidget(QWidget* widget);
111 
115  QList<QWidget*> associatedWidgets() const;
116 
120  void clearAssociatedWidgets();
121 
125  QString configGroup() const;
126 
131  bool configIsGlobal() const;
132 
136  void setConfigGroup( const QString& group );
137 
142  void setConfigGlobal( bool global );
143 
151  void readSettings( KConfigGroup* config = 0 );
152 
160  void importGlobalShortcuts( KConfigGroup* config );
161 
170  void exportGlobalShortcuts( KConfigGroup* config, bool writeDefaults = false ) const;
171 
187  void writeSettings( KConfigGroup* config = 0, bool writeDefaults = false, QAction* oneAction = 0 ) const;
188 
194  int count() const;
195 
199  bool isEmpty() const;
200 
206  QAction *action(int index) const;
207 
215  QAction* action( const QString& name ) const;
216 
223  QList<QAction*> actions() const;
224 
228  const QList<QAction*> actionsWithoutGroup() const;
229 
233  const QList<QActionGroup*> actionGroups() const;
234 
244  void setComponentData(const KComponentData &componentData);
245 
247  KComponentData componentData() const;
248 
252  const KXMLGUIClient *parentGUIClient() const;
253 
254 Q_SIGNALS:
258  void inserted( QAction* action );
259 
264  QT_MOC_COMPAT void removed( QAction* action );
265 
270  QT_MOC_COMPAT void actionHighlighted(QAction* action);
271 
275  void actionHovered(QAction* action);
276 
280  void actionTriggered(QAction* action);
281 
282 protected Q_SLOTS:
284  virtual void connectNotify ( const char * signal );
285 
286  virtual void slotActionTriggered();
287 
292  QT_MOC_COMPAT virtual void slotActionHighlighted();
293 
294 private Q_SLOTS:
295  void slotActionHovered();
296 
297 
298 public:
315  QAction *addAction(const QString &name, QAction *action);
316  KAction *addAction(const QString &name, KAction *action);
317 
322  void removeAction(QAction *action);
323 
328  QAction* takeAction(QAction *action);
329 
348  KAction *addAction(KStandardAction::StandardAction actionType, const QObject *receiver = 0, const char *member = 0);
349 
368  KAction *addAction(KStandardAction::StandardAction actionType, const QString &name,
369  const QObject *receiver = 0, const char *member = 0);
370 
393  KAction *addAction(const QString &name, const QObject *receiver = 0, const char *member = 0);
394 
411  template<class ActionType>
412  ActionType *add(const QString &name, const QObject *receiver = 0, const char *member = 0)
413  {
414  ActionType *a = new ActionType(this);
415  if (receiver && member)
416  connect(a, SIGNAL(triggered(bool)), receiver, member);
417  addAction(name, a);
418  return a;
419  }
420 
421 private:
422  Q_PRIVATE_SLOT(d, void _k_actionDestroyed(QObject *))
423  Q_PRIVATE_SLOT(d, void _k_associatedWidgetDestroyed(QObject*))
424 
425  KActionCollection( const KXMLGUIClient* parent ); // used by KXMLGUIClient
426 
427  friend class KActionCollectionPrivate;
428  class KActionCollectionPrivate* const d;
429 };
430 
431 #endif
KStandardGuiItem::add
KGuiItem add()
Returns the 'Add' gui item.
Definition: kstandardguiitem.cpp:284
QWidget
KActionCollection
A container for a set of QAction objects.
Definition: kactioncollection.h:56
QActionGroup
KXMLGUIClient
A KXMLGUIClient can be used with KXMLGUIFactory to create a GUI from actions and an XML document...
Definition: kxmlguiclient.h:46
KStandardAction::StandardAction
StandardAction
The standard menubar and toolbar actions.
Definition: kstandardaction.h:125
KStandardAction::name
const char * name(StandardAction id)
This will return the internal name of a given standard action.
Definition: kstandardaction.cpp:223
KXMLGUIClient::componentData
virtual KComponentData componentData() const
Definition: kxmlguiclient.cpp:144
QObject
KStandardAction::clear
KAction * clear(const QObject *recvr, const char *slot, QObject *parent)
Clear the content of the focus widget.
Definition: kstandardaction.cpp:314
QString
kstandardaction.h
QList
KXMLGUIClient::setComponentData
virtual void setComponentData(const KComponentData &componentData)
Returns true if client was added to super client list.
Definition: kxmlguiclient.cpp:184
KConfigGroup
KXMLGUIClient::action
QAction * action(const char *name) const
Retrieves an action of the client by name.
Definition: kxmlguiclient.cpp:115
QAction
KAction
Class to encapsulate user-driven action or event.
Definition: kaction.h:216
kdeui_export.h
kcomponentdata.h
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
KComponentData
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:23:58 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal