KXmlGui

kactioncollection.h
1/*
2 This file is part of the KDE libraries
3 SPDX-FileCopyrightText: 1999 Reginald Stadlbauer <reggie@kde.org>
4 SPDX-FileCopyrightText: 1999 Simon Hausmann <hausmann@kde.org>
5 SPDX-FileCopyrightText: 2000 Nicolas Hadacek <haadcek@kde.org>
6 SPDX-FileCopyrightText: 2000 Kurt Granroth <granroth@kde.org>
7 SPDX-FileCopyrightText: 2000 Michael Koch <koch@kde.org>
8 SPDX-FileCopyrightText: 2001 Holger Freyther <freyther@kde.org>
9 SPDX-FileCopyrightText: 2002 Ellis Whitehead <ellis@kde.org>
10 SPDX-FileCopyrightText: 2005-2006 Hamish Rodda <rodda@kde.org>
11
12 SPDX-License-Identifier: LGPL-2.0-only
13*/
14
15#ifndef KACTIONCOLLECTION_H
16#define KACTIONCOLLECTION_H
17
18#include <KStandardAction>
19#include <KStandardActions>
20#include <kxmlgui_export.h>
21
22#include <QAction>
23#include <QObject>
24#include <memory>
25
26class KXMLGUIClient;
27class KConfigGroup;
28class QActionGroup;
29class QString;
30
31/**
32 * @class KActionCollection kactioncollection.h KActionCollection
33 *
34 * \short A container for a set of QAction objects.
35 *
36 * KActionCollection manages a set of QAction objects. It
37 * allows them to be grouped for organized presentation of configuration to the user,
38 * saving + loading of configuration, and optionally for automatic plugging into
39 * specified widget(s).
40 *
41 * Additionally, KActionCollection provides several convenience functions for locating
42 * named actions, and actions grouped by QActionGroup.
43 *
44 * \note If you create your own action collection and need to assign shortcuts
45 * to the actions within, you have to call associateWidget() or
46 * addAssociatedWidget() to have them working.
47 */
48class KXMLGUI_EXPORT KActionCollection : public QObject
49{
50 friend class KXMLGUIClient;
51
52 Q_OBJECT
53
54 Q_PROPERTY(QString configGroup READ configGroup WRITE setConfigGroup)
55 Q_PROPERTY(bool configIsGlobal READ configIsGlobal WRITE setConfigGlobal)
56
57public:
58 /**
59 * Constructor. Allows specification of a component name other than the default
60 * application name, where needed (remember to call setComponentDisplayName() too).
61 */
62 explicit KActionCollection(QObject *parent, const QString &cName = QString());
63
64 /**
65 * Destructor.
66 */
67 ~KActionCollection() override;
68
69 /**
70 * Access the list of all action collections in existence for this app
71 */
72 static const QList<KActionCollection *> &allCollections();
73
74 /**
75 * Clears the entire action collection, deleting all actions.
76 */
77 void clear();
78
79 /**
80 * Associate all actions in this collection to the given @p widget.
81 * Unlike addAssociatedWidget(), this method only adds all current actions
82 * in the collection to the given widget. Any action added after this call
83 * will not be added to the given widget automatically.
84 * So this is just a shortcut for a foreach loop and a widget->addAction call.
85 */
86 void associateWidget(QWidget *widget) const;
87
88 /**
89 * Associate all actions in this collection to the given @p widget, including any actions
90 * added after this association is made.
91 *
92 * This does not change the action's shortcut context, so if you need to have the actions only
93 * trigger when the widget has focus, you'll need to set the shortcut context on each action
94 * to Qt::WidgetShortcut (or better still, Qt::WidgetWithChildrenShortcut with Qt 4.4+)
95 */
96 void addAssociatedWidget(QWidget *widget);
97
98 /**
99 * Remove an association between all actions in this collection and the given @p widget, i.e.
100 * remove those actions from the widget, and stop associating newly added actions as well.
101 */
102 void removeAssociatedWidget(QWidget *widget);
103
104 /**
105 * Return a list of all associated widgets.
106 */
107 QList<QWidget *> associatedWidgets() const;
108
109 /**
110 * Clear all associated widgets and remove the actions from those widgets.
111 */
112 void clearAssociatedWidgets();
113
114 /**
115 * Returns the KConfig group with which settings will be loaded and saved.
116 */
117 QString configGroup() const;
118
119 /**
120 * Returns whether this action collection's configuration should be global to KDE ( @c true ),
121 * or specific to the application ( @c false ).
122 */
123 bool configIsGlobal() const;
124
125 /**
126 * Sets @p group as the KConfig group with which settings will be loaded and saved.
127 */
128 void setConfigGroup(const QString &group);
129
130 /**
131 * Set whether this action collection's configuration should be global to KDE ( @c true ),
132 * or specific to the application ( @c false ).
133 */
134 void setConfigGlobal(bool global);
135
136 /**
137 * Read all key associations from @p config.
138 *
139 * If @p config is zero, read all key associations from the
140 * application's configuration file KSharedConfig::openConfig(),
141 * in the group set by setConfigGroup().
142 */
143 void readSettings(KConfigGroup *config = nullptr);
144
145 /**
146 * Import from @p config all configurable global key associations.
147 *
148 * \since 4.1
149 *
150 * \param config Config object to read from
151 */
152 void importGlobalShortcuts(KConfigGroup *config);
153
154 /**
155 * Export the current configurable global key associations to @p config.
156 *
157 * \since 4.1
158 *
159 * \param config Config object to save to
160 * \param writeDefaults set to true to write settings which are already at defaults.
161 */
162 void exportGlobalShortcuts(KConfigGroup *config, bool writeDefaults = false) const;
163
164 /**
165 * Write the current configurable key associations to @p config. What the
166 * function does if @p config is zero depends. If this action collection
167 * belongs to a KXMLGUIClient the setting are saved to the kxmlgui
168 * definition file. If not the settings are written to the applications
169 * config file.
170 *
171 * \note @p oneAction and @p writeDefaults have no meaning for the kxmlgui
172 * configuration file.
173 *
174 * \param config Config object to save to, or null (see above)
175 * \param writeDefaults set to true to write settings which are already at defaults.
176 * \param oneAction pass an action here if you just want to save the values for one action, eg.
177 * if you know that action is the only one which has changed.
178 */
179 void writeSettings(KConfigGroup *config = nullptr, bool writeDefaults = false, QAction *oneAction = nullptr) const;
180
181 /**
182 * Returns the number of actions in the collection.
183 *
184 * This is equivalent to actions().count().
185 */
186 int count() const;
187
188 /**
189 * Returns whether the action collection is empty or not.
190 */
191 bool isEmpty() const;
192
193 /**
194 * Return the QAction* at position @p index in the action collection.
195 *
196 * This is equivalent to actions().value(index);
197 */
198 QAction *action(int index) const;
199
200 /**
201 * Get the action with the given \p name from the action collection.
202 *
203 * This won't return the action for the menus defined using a "<Menu>" tag
204 * in XMLGUI files (e.g. "<Menu name="menuId">" in "applicationNameui.rc").
205 * To access menu actions defined like this, use e.g.
206 * \code
207 * qobject_cast<QMenu *>(guiFactory()->container("menuId", this));
208 * \endcode
209 * after having called setupGUI() or createGUI().
210 *
211 * @param name Name of the QAction
212 * @return A pointer to the QAction in the collection which matches the parameters or
213 * null if nothing matches.
214 */
215 Q_INVOKABLE QAction *action(const QString &name) const;
216
217 /**
218 * Returns the list of QActions which belong to this action collection.
219 *
220 * The list is guaranteed to be in the same order the action were put into
221 * the collection.
222 */
223 QList<QAction *> actions() const;
224
225 /**
226 * Returns the list of QActions without an QAction::actionGroup() which belong to this action collection.
227 */
228 const QList<QAction *> actionsWithoutGroup() const;
229
230 /**
231 * Returns the list of all QActionGroups associated with actions in this action collection.
232 */
233 const QList<QActionGroup *> actionGroups() const;
234
235 /**
236 * Set the @p componentName associated with this action collection.
237 *
238 * \warning Don't call this method on a KActionCollection that contains
239 * actions. This is not supported.
240 *
241 * \param componentData the name which is to be associated with this action collection,
242 * or QString() to indicate the app name. This is used to load/save settings into XML files.
243 * KXMLGUIClient::setComponentName takes care of calling this.
244 */
245 void setComponentName(const QString &componentName);
246
247 /** The component name with which this class is associated. */
248 QString componentName() const;
249
250 /**
251 * Set the component display name associated with this action collection.
252 * (e.g. for the toolbar editor)
253 * KXMLGUIClient::setComponentName takes care of calling this.
254 */
255 void setComponentDisplayName(const QString &displayName);
256
257 /** The display name for the associated component. */
258 QString componentDisplayName() const;
259
260 /**
261 * The parent KXMLGUIClient, or null if not available.
262 */
263 const KXMLGUIClient *parentGUIClient() const;
264
266 /**
267 * Indicates that @p action was inserted into this action collection.
268 */
269 void inserted(QAction *action);
270
271 /**
272 * Emitted when an action has been inserted into, or removed from, this action collection.
273 * @since 5.66
274 */
275 void changed();
276
277 /**
278 * Indicates that @p action was hovered.
279 */
280 void actionHovered(QAction *action);
281
282 /**
283 * Indicates that @p action was triggered
284 */
286
287protected:
288 /// Overridden to perform connections when someone wants to know whether an action was highlighted or triggered
289 void connectNotify(const QMetaMethod &signal) override;
290
291protected Q_SLOTS:
292 virtual void slotActionTriggered();
293
294private Q_SLOTS:
295 KXMLGUI_NO_EXPORT void slotActionHovered();
296
297public:
298 /**
299 * Add an action under the given name to the collection.
300 *
301 * Inserting an action that was previously inserted under a different name will replace the
302 * old entry, i.e. the action will not be available under the old name anymore but only under
303 * the new one.
304 *
305 * Inserting an action under a name that is already used for another action will replace
306 * the other action in the collection (but will not delete it).
307 *
308 * If KAuthorized::authorizeAction() reports that the action is not
309 * authorized, it will be disabled and hidden.
310 *
311 * The ownership of the action object is not transferred.
312 * If the action is destroyed it will be removed automatically from the KActionCollection.
313 *
314 * @param name The name by which the action be retrieved again from the collection.
315 * @param action The action to add.
316 * @return the same as the action given as parameter. This is just for convenience
317 * (chaining calls) and consistency with the other addAction methods, you can also
318 * simply ignore the return value.
319 */
320 Q_INVOKABLE QAction *addAction(const QString &name, QAction *action);
321
322 /**
323 * Adds a list of actions to the collection.
324 *
325 * The objectName of the actions is used as their internal name in the collection.
326 *
327 * The ownership of the action objects is not transferred.
328 * If the action is destroyed it will be removed automatically from the KActionCollection.
329 *
330 * Uses addAction(const QString&, QAction*).
331 *
332 * @param actions the list of the actions to add.
333 *
334 * @see addAction()
335 * @since 5.0
336 */
337 void addActions(const QList<QAction *> &actions);
338
339 /**
340 * Removes an action from the collection and deletes it.
341 * @param action The action to remove.
342 */
343 void removeAction(QAction *action);
344
345 /**
346 * Removes an action from the collection.
347 *
348 * The ownership of the action object is not changed.
349 *
350 * @param action the action to remove.
351 */
352 QAction *takeAction(QAction *action);
353
354 /**
355 * Creates a new standard action, adds it to the collection and connects the
356 * action's triggered(bool) signal to the specified receiver/member. The
357 * newly created action is also returned.
358 *
359 * @note Using KStandardAction::OpenRecent will cause a different signal than
360 * triggered(bool) to be used, see KStandardAction for more information.
361 *
362 * The action can be retrieved later from the collection by its standard name as per
363 * KStandardAction::stdName.
364 *
365 * The KActionCollection takes ownership of the action object.
366 *
367 * @param actionType The standard action type of the action to create.
368 * @param receiver The QObject to connect the triggered(bool) signal to. Leave nullptr if no
369 * connection is desired.
370 * @param member The SLOT to connect the triggered(bool) signal to. Leave nullptr if no
371 * connection is desired.
372 * @return new action of the given type ActionType.
373 */
374 QAction *addAction(KStandardAction::StandardAction actionType, const QObject *receiver = nullptr, const char *member = nullptr);
375
376 /**
377 * Creates a new standard action, adds to the collection under the given name
378 * and connects the action's triggered(bool) signal to the specified
379 * receiver/member. The newly created action is also returned.
380 *
381 * @note Using KStandardAction::OpenRecent will cause a different signal than
382 * triggered(bool) to be used, see KStandardAction for more information.
383 *
384 * The action can be retrieved later from the collection by the specified name.
385 *
386 * The KActionCollection takes ownership of the action object.
387 *
388 * @param actionType The standard action type of the action to create.
389 * @param name The name by which the action be retrieved again from the collection.
390 * @param receiver The QObject to connect the triggered(bool) signal to. Leave nullptr if no
391 * connection is desired.
392 * @param member The SLOT to connect the triggered(bool) signal to. Leave nullptr if no
393 * connection is desired.
394 * @return new action of the given type ActionType.
395 */
396 QAction *addAction(KStandardAction::StandardAction actionType, const QString &name, const QObject *receiver = nullptr, const char *member = nullptr);
397
398/**
399 * This is the same as addAction(KStandardAction::StandardAction actionType, const QString &name, const QObject *receiver, const char *member) using
400 * new style connect syntax.
401 *
402 * @param actionType The standard action type of the action to create.
403 * @param name The name by which the action be retrieved again from the collection.
404 * @param receiver The QObject to connect the triggered(bool) signal to.
405 * @param slot The slot or lambda to connect the triggered(bool) signal to.
406 * @return new action of the given type ActionType.
407 *
408 * @see addAction(KStandardAction::StandardAction, const QString &, const QObject *, const char *)
409 * @since 5.80
410 */
411#ifdef K_DOXYGEN
412 inline QAction *addAction(KStandardAction::StandardAction actionType, const QString &name, const Receiver *receiver, Func slot)
413#else
414 template<class Receiver, class Func>
415 inline typename std::enable_if<!std::is_convertible<Func, const char *>::value, QAction>::type *
416 addAction(KStandardAction::StandardAction actionType, const QString &name, const Receiver *receiver, Func slot)
417#endif
418 {
419 QAction *action = KStandardAction::create(actionType, receiver, slot, nullptr);
420 action->setParent(this);
421 action->setObjectName(name);
422 return addAction(name, action);
423 }
424
425 /**
426 * This is the same as addAction(KStandardAction::StandardAction actionType, const QString &name, const Receiver *receiver, Func slot)
427 * but using KStandardActions from KConfigGui.
428 *
429 * @param actionType The standard action type of the action to create.
430 * @param name The name by which the action be retrieved again from the collection.
431 * @param receiver The QObject to connect the triggered(bool) signal to.
432 * @param slot The slot or lambda to connect the triggered(bool) signal to.
433 * @return new action of the given type ActionType.
434 * @since 6.3
435 */
436#ifdef K_DOXYGEN
437 inline QAction *addAction(KStandardActions::StandardAction actionType, const QString &name, const Receiver *receiver, Func slot)
438#else
439 template<class Receiver, class Func>
440 inline typename std::enable_if<!std::is_convertible<Func, const char *>::value, QAction>::type *
441 addAction(KStandardActions::StandardAction actionType, const QString &name, const Receiver *receiver, Func slot)
442#endif
443 {
444 // Use implementation from KConfigWidgets instead of KConfigGui
445 // as it provides tighter integration with QtWidgets applications.
446 QAction *action = KStandardAction::create(static_cast<KStandardAction::StandardAction>(actionType), receiver, slot, nullptr);
447 action->setParent(this);
448 action->setObjectName(name);
449 return addAction(name, action);
450 }
451
452 /**
453 * Creates a new standard action, adds it to the collection and connects the
454 * action's triggered(bool) signal to the specified receiver/member. The
455 * newly created action is also returned.
456 *
457 * @note Using KStandardAction::OpenRecent will cause a different signal than
458 * triggered(bool) to be used, see KStandardAction for more information.
459 *
460 * The action can be retrieved later from the collection by its standard name as per
461 * KStandardAction::stdName.
462 *
463 * The KActionCollection takes ownership of the action object.
464 *
465 * @param actionType The standard action type of the action to create.
466 * @param receiver The QObject to connect the triggered(bool) signal to. Leave nullptr if no
467 * connection is desired.
468 * @param slot The slot or lambda to connect the triggered(bool) signal to.
469 * @return new action of the given type ActionType.
470 *
471 * @since 6.3
472 */
473#ifdef K_DOXYGEN
474 inline QAction *addAction(KStandardActions::StandardAction actionType, const Receiver *receiver, Func slot)
475#else
476 template<class Receiver, class Func>
477 inline typename std::enable_if<!std::is_convertible<Func, const char *>::value, QAction>::type *
478 addAction(KStandardActions::StandardAction actionType, const Receiver *receiver, Func slot)
479#endif
480 {
481 // Use implementation from KConfigWidgets instead of KConfigGui
482 // as it provides tighter integration with QtWidgets applications.
483 // KStandardAction automatically adds it to the collection.
484 QAction *action = KStandardAction::create(static_cast<KStandardAction::StandardAction>(actionType), receiver, slot, this);
485 return action;
486 }
487
488 /**
489 * Creates a new standard action and adds it to the collection.
490 * The newly created action is also returned.
491 *
492 * The action can be retrieved later from the collection by its standard name as per
493 * KStandardAction::stdName.
494 *
495 * The KActionCollection takes ownership of the action object.
496 *
497 * @param actionType The standard action type of the action to create.
498 * @return new action of the given type ActionType.
499 *
500 * @since 6.9
501 */
502 QAction *addAction(KStandardActions::StandardAction actionType);
503
504 /**
505 * Creates a new action under the given name to the collection and connects
506 * the action's triggered(bool) signal to the specified receiver/member. The
507 * newly created action is returned.
508 *
509 * NOTE: KDE prior to 4.2 used the triggered() signal instead of the triggered(bool)
510 * signal.
511 *
512 * Inserting an action that was previously inserted under a different name will replace the
513 * old entry, i.e. the action will not be available under the old name anymore but only under
514 * the new one.
515 *
516 * Inserting an action under a name that is already used for another action will replace
517 * the other action in the collection.
518 *
519 * The KActionCollection takes ownership of the action object.
520 *
521 * @param name The name by which the action be retrieved again from the collection.
522 * @param receiver The QObject to connect the triggered(bool) signal to. Leave nullptr if no
523 * connection is desired.
524 * @param member The SLOT to connect the triggered(bool) signal to. Leave nullptr if no
525 * connection is desired.
526 * @return new action of the given type ActionType.
527 */
528 QAction *addAction(const QString &name, const QObject *receiver = nullptr, const char *member = nullptr);
529
530 /**
531 * Creates a new action under the given name, adds it to the collection and connects the action's triggered(bool)
532 * signal to the specified receiver/member. The receiver slot may accept either a bool or no
533 * parameters at all (i.e. slotTriggered(bool) or slotTriggered() ).
534 * The type of the action is specified by the template parameter ActionType.
535 *
536 * NOTE: KDE prior to 4.2 connected the triggered() signal instead of the triggered(bool)
537 * signal.
538 *
539 * The KActionCollection takes ownership of the action object.
540 *
541 * @param name The internal name of the action (e.g. "file-open").
542 * @param receiver The QObject to connect the triggered(bool) signal to. Leave nullptr if no
543 * connection is desired.
544 * @param member The SLOT to connect the triggered(bool) signal to. Leave nullptr if no
545 * connection is desired.
546 * @return new action of the given type ActionType.
547 *
548 * @see addAction()
549 */
550 template<class ActionType>
551 ActionType *add(const QString &name, const QObject *receiver = nullptr, const char *member = nullptr)
552 {
553 ActionType *a = new ActionType(this);
554 if (receiver && member) {
555 connect(a, SIGNAL(triggered(bool)), receiver, member);
556 }
557 addAction(name, a);
558 return a;
559 }
560
561/**
562 * This is the same as add(const QString &name, const QObject *receiver, const char *member) using
563 * new style connect syntax.
564 *
565 * @param name The internal name of the action (e.g. "file-open").
566 * @param receiver The QObject to connect the triggered(bool) signal to.
567 * @param slot The slot or lambda to connect the triggered(bool) signal to.
568 * @return new action of the given type ActionType.
569 *
570 * @see add(const QString &, const QObject *, const char *)
571 * @since 5.28
572 */
573#ifdef K_DOXYGEN
574 template<class ActionType>
575 inline ActionType *add(const QString &name, const Receiver *receiver, Func slot)
576#else
577 template<class ActionType, class Receiver, class Func>
578 inline typename std::enable_if<!std::is_convertible<Func, const char *>::value, ActionType>::type *
579 add(const QString &name, const Receiver *receiver, Func slot)
580#endif
581 {
582 ActionType *a = new ActionType(this);
583 connect(a, &QAction::triggered, receiver, slot);
584 addAction(name, a);
585 return a;
586 }
587
588/**
589 * This is the same as addAction(const QString &name, const QObject *receiver, const char *member) using
590 * new style connect syntax.
591 *
592 * @param name The internal name of the action (e.g. "file-open").
593 * @param receiver The QObject to connect the triggered(bool) signal to.
594 * @param slot The slot or lambda to connect the triggered(bool) signal to.
595 * @return new action of the given type ActionType.
596 *
597 * @see addAction(const QString &, const QObject *, const char *)
598 * @since 5.28
599 */
600#ifdef K_DOXYGEN
601 inline QAction *addAction(const QString &name, const Receiver *receiver, Func slot)
602#else
603 template<class Receiver, class Func>
604 inline typename std::enable_if<!std::is_convertible<Func, const char *>::value, QAction>::type *
605 addAction(const QString &name, const Receiver *receiver, Func slot)
606#endif
607 {
608 return add<QAction>(name, receiver, slot);
609 }
610
611 /**
612 * Get the default primary shortcut for the given action.
613 *
614 * @param action the action for which the default primary shortcut should be returned.
615 * @return the default primary shortcut of the given action
616 * @since 5.0
617 */
618 static QKeySequence defaultShortcut(QAction *action);
619
620 /**
621 * Get the default shortcuts for the given action.
622 *
623 * @param action the action for which the default shortcuts should be returned.
624 * @return the default shortcuts of the given action
625 * @since 5.0
626 */
627 static QList<QKeySequence> defaultShortcuts(QAction *action);
628
629 /**
630 * Set the default shortcut for the given action.
631 * Since 5.2, this also calls action->setShortcut(shortcut), i.e. the default shortcut is
632 * made active initially.
633 *
634 * @param action the action for which the default shortcut should be set.
635 * @param shortcut the shortcut to use for the given action in its specified shortcutContext()
636 * @since 5.0
637 */
638 static void setDefaultShortcut(QAction *action, const QKeySequence &shortcut);
639
640 /**
641 * Set the default shortcuts for the given action.
642 * Since 5.2, this also calls action->setShortcuts(shortcuts), i.e. the default shortcut is
643 * made active initially.
644 *
645 * @param action the action for which the default shortcut should be set.
646 * @param shortcuts the shortcuts to use for the given action in its specified shortcutContext()
647 * @since 5.0
648 */
649 Q_INVOKABLE static void setDefaultShortcuts(QAction *action, const QList<QKeySequence> &shortcuts);
650
651 /**
652 * Returns true if the given action's shortcuts may be configured by the user.
653 *
654 * @param action the action for the hint should be verified.
655 * @since 5.0
656 */
657 static bool isShortcutsConfigurable(QAction *action);
658
659 /**
660 * Indicate whether the user may configure the action's shortcuts.
661 *
662 * @param action the action for the hint should be verified.
663 * @param configurable set to true if the shortcuts of the given action may be configured by the user, otherwise false.
664 * @since 5.0
665 */
666 static void setShortcutsConfigurable(QAction *action, bool configurable);
667
668private:
669 KXMLGUI_NO_EXPORT explicit KActionCollection(const KXMLGUIClient *parent); // used by KXMLGUIClient
670
671 friend class KActionCollectionPrivate;
672 std::unique_ptr<class KActionCollectionPrivate> const d;
673};
674
675#endif
A container for a set of QAction objects.
QAction * addAction(KStandardAction::StandardAction actionType, const QString &name, const Receiver *receiver, Func slot)
This is the same as addAction(KStandardAction::StandardAction actionType, const QString &name,...
QAction * addAction(const QString &name, const Receiver *receiver, Func slot)
This is the same as addAction(const QString &name, const QObject *receiver, const char *member) using...
QAction * addAction(KStandardActions::StandardAction actionType, const Receiver *receiver, Func slot)
Creates a new standard action, adds it to the collection and connects the action's triggered(bool) si...
void actionHovered(QAction *action)
Indicates that action was hovered.
ActionType * add(const QString &name, const QObject *receiver=nullptr, const char *member=nullptr)
Creates a new action under the given name, adds it to the collection and connects the action's trigge...
ActionType * add(const QString &name, const Receiver *receiver, Func slot)
This is the same as add(const QString &name, const QObject *receiver, const char *member) using new s...
void changed()
Emitted when an action has been inserted into, or removed from, this action collection.
void inserted(QAction *action)
Indicates that action was inserted into this action collection.
QAction * addAction(KStandardActions::StandardAction actionType, const QString &name, const Receiver *receiver, Func slot)
This is the same as addAction(KStandardAction::StandardAction actionType, const QString &name,...
void actionTriggered(QAction *action)
Indicates that action was triggered.
A KXMLGUIClient can be used with KXMLGUIFactory to create a GUI from actions and an XML document,...
QAction * create(StandardAction id, const QObject *recvr, const char *slot, QObject *parent)
void triggered(bool checked)
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
virtual void connectNotify(const QMetaMethod &signal)
void setObjectName(QAnyStringView name)
void setParent(QObject *parent)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:19:32 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.