KActionCollection
#include <KActionCollection>
Properties | |
QString | configGroup |
bool | configIsGlobal |
Properties inherited from QObject | |
objectName | |
Signals | |
void | actionHovered (QAction *action) |
void | actionTriggered (QAction *action) |
void | changed () |
void | inserted (QAction *action) |
Public Member Functions | |
KActionCollection (QObject *parent, const QString &cName=QString()) | |
~KActionCollection () override | |
Q_INVOKABLE QAction * | action (const QString &name) const |
QAction * | action (int index) const |
const QList< QActionGroup * > | actionGroups () const |
QList< QAction * > | actions () const |
const QList< QAction * > | actionsWithoutGroup () const |
template<class ActionType > | |
ActionType * | add (const QString &name, const QObject *receiver=nullptr, const char *member=nullptr) |
template<class ActionType > | |
ActionType * | add (const QString &name, const Receiver *receiver, Func slot) |
QAction * | addAction (const QString &name, const QObject *receiver=nullptr, const char *member=nullptr) |
QAction * | addAction (const QString &name, const Receiver *receiver, Func slot) |
Q_INVOKABLE QAction * | addAction (const QString &name, QAction *action) |
QAction * | addAction (KStandardAction::StandardAction actionType, const QObject *receiver=nullptr, const char *member=nullptr) |
QAction * | addAction (KStandardAction::StandardAction actionType, const QString &name, const QObject *receiver=nullptr, const char *member=nullptr) |
QAction * | addAction (KStandardAction::StandardAction actionType, const QString &name, const Receiver *receiver, Func slot) |
QAction * | addAction (KStandardActions::StandardAction actionType) |
QAction * | addAction (KStandardActions::StandardAction actionType, const QString &name, const Receiver *receiver, Func slot) |
QAction * | addAction (KStandardActions::StandardAction actionType, const Receiver *receiver, Func slot) |
void | addActions (const QList< QAction * > &actions) |
void | addAssociatedWidget (QWidget *widget) |
QList< QWidget * > | associatedWidgets () const |
void | associateWidget (QWidget *widget) const |
void | clear () |
void | clearAssociatedWidgets () |
QString | componentDisplayName () const |
QString | componentName () const |
QString | configGroup () const |
bool | configIsGlobal () const |
int | count () const |
void | exportGlobalShortcuts (KConfigGroup *config, bool writeDefaults=false) const |
void | importGlobalShortcuts (KConfigGroup *config) |
bool | isEmpty () const |
const KXMLGUIClient * | parentGUIClient () const |
void | readSettings (KConfigGroup *config=nullptr) |
void | removeAction (QAction *action) |
void | removeAssociatedWidget (QWidget *widget) |
void | setComponentDisplayName (const QString &displayName) |
void | setComponentName (const QString &componentName) |
void | setConfigGlobal (bool global) |
void | setConfigGroup (const QString &group) |
QAction * | takeAction (QAction *action) |
void | writeSettings (KConfigGroup *config=nullptr, bool writeDefaults=false, QAction *oneAction=nullptr) const |
Public Member Functions inherited from QObject | |
QObject (QObject *parent) | |
QBindable< QString > | bindableObjectName () |
bool | blockSignals (bool block) |
const QObjectList & | children () const const |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) const const |
bool | disconnect (const QObject *receiver, const char *method) const const |
void | dumpObjectInfo () const const |
void | dumpObjectTree () const const |
QList< QByteArray > | dynamicPropertyNames () const const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (Qt::FindChildOptions options) const const |
bool | inherits (const char *className) const const |
void | installEventFilter (QObject *filterObj) |
bool | isQuickItemType () const const |
bool | isWidgetType () const const |
bool | isWindowType () const const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const const |
void | moveToThread (QThread *targetThread) |
QString | objectName () const const |
void | objectNameChanged (const QString &objectName) |
QObject * | parent () const const |
QVariant | property (const char *name) const const |
Q_CLASSINFO (Name, Value) | |
Q_EMIT Q_EMIT | |
Q_ENUM (...) | |
Q_ENUM_NS (...) | |
Q_ENUMS (...) | |
Q_FLAG (...) | |
Q_FLAG_NS (...) | |
Q_FLAGS (...) | |
Q_GADGET Q_GADGET | |
Q_GADGET_EXPORT (EXPORT_MACRO) | |
Q_INTERFACES (...) | |
Q_INVOKABLE Q_INVOKABLE | |
Q_MOC_INCLUDE Q_MOC_INCLUDE | |
Q_NAMESPACE Q_NAMESPACE | |
Q_NAMESPACE_EXPORT (EXPORT_MACRO) | |
Q_OBJECT Q_OBJECT | |
Q_PROPERTY (...) | |
Q_REVISION Q_REVISION | |
Q_SET_OBJECT_NAME (Object) | |
Q_SIGNAL Q_SIGNAL | |
Q_SIGNALS Q_SIGNALS | |
Q_SLOT Q_SLOT | |
Q_SLOTS Q_SLOTS | |
T | qobject_cast (const QObject *object) |
T | qobject_cast (QObject *object) |
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT | |
void | removeEventFilter (QObject *obj) |
void | setObjectName (const QString &name) |
void | setObjectName (QAnyStringView name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | setProperty (const char *name, QVariant &&value) |
bool | signalsBlocked () const const |
int | startTimer (int interval, Qt::TimerType timerType) |
int | startTimer (std::chrono::milliseconds interval, Qt::TimerType timerType) |
QThread * | thread () const const |
Static Public Member Functions | |
static const QList< KActionCollection * > & | allCollections () |
static QKeySequence | defaultShortcut (QAction *action) |
static QList< QKeySequence > | defaultShortcuts (QAction *action) |
static bool | isShortcutsConfigurable (QAction *action) |
static void | setDefaultShortcut (QAction *action, const QKeySequence &shortcut) |
static Q_INVOKABLE void | setDefaultShortcuts (QAction *action, const QList< QKeySequence > &shortcuts) |
static void | setShortcutsConfigurable (QAction *action, bool configurable) |
Static Public Member Functions inherited from QObject | |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor) |
bool | disconnect (const QMetaObject::Connection &connection) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
Protected Slots | |
virtual void | slotActionTriggered () |
Protected Member Functions | |
void | connectNotify (const QMetaMethod &signal) override |
Protected Member Functions inherited from QObject | |
virtual void | childEvent (QChildEvent *event) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
bool | isSignalConnected (const QMetaMethod &signal) const const |
int | receivers (const char *signal) const const |
QObject * | sender () const const |
int | senderSignalIndex () const const |
virtual void | timerEvent (QTimerEvent *event) |
Additional Inherited Members | |
Public Types inherited from QObject | |
typedef | QObjectList |
Detailed Description
A container for a set of QAction objects.
KActionCollection manages a set of QAction objects. It allows them to be grouped for organized presentation of configuration to the user, saving + loading of configuration, and optionally for automatic plugging into specified widget(s).
Additionally, KActionCollection provides several convenience functions for locating named actions, and actions grouped by QActionGroup.
- Note
- If you create your own action collection and need to assign shortcuts to the actions within, you have to call associateWidget() or addAssociatedWidget() to have them working.
Definition at line 48 of file kactioncollection.h.
Property Documentation
◆ configGroup
|
readwrite |
Definition at line 54 of file kactioncollection.h.
◆ configIsGlobal
|
readwrite |
Definition at line 55 of file kactioncollection.h.
Constructor & Destructor Documentation
◆ KActionCollection()
|
explicit |
Constructor.
Allows specification of a component name other than the default application name, where needed (remember to call setComponentDisplayName() too).
Definition at line 164 of file kactioncollection.cpp.
◆ ~KActionCollection()
|
override |
Destructor.
Definition at line 183 of file kactioncollection.cpp.
Member Function Documentation
◆ action() [1/2]
Get the action with the given name
from the action collection.
This won't return the action for the menus defined using a "<Menu>" tag in XMLGUI files (e.g. "<Menu name="menuId">" in "applicationNameui.rc"). To access menu actions defined like this, use e.g.
after having called setupGUI() or createGUI().
- Parameters
-
name Name of the QAction
- Returns
- A pointer to the QAction in the collection which matches the parameters or null if nothing matches.
Definition at line 195 of file kactioncollection.cpp.
◆ action() [2/2]
QAction * KActionCollection::action | ( | int | index | ) | const |
Return the QAction* at position index
in the action collection.
This is equivalent to actions().value(index);
Definition at line 203 of file kactioncollection.cpp.
◆ actionGroups()
const QList< QActionGroup * > KActionCollection::actionGroups | ( | ) | const |
Returns the list of all QActionGroups associated with actions in this action collection.
Definition at line 281 of file kactioncollection.cpp.
◆ actionHovered
|
signal |
Indicates that action
was hovered.
◆ actions()
Returns the list of QActions which belong to this action collection.
The list is guaranteed to be in the same order the action were put into the collection.
Definition at line 265 of file kactioncollection.cpp.
◆ actionsWithoutGroup()
Returns the list of QActions without an QAction::actionGroup() which belong to this action collection.
Definition at line 270 of file kactioncollection.cpp.
◆ actionTriggered
|
signal |
Indicates that action
was triggered.
◆ add() [1/2]
|
inline |
Creates a new action under the given name, adds it to the collection and connects the action's triggered(bool) signal to the specified receiver/member.
The receiver slot may accept either a bool or no parameters at all (i.e. slotTriggered(bool) or slotTriggered() ). The type of the action is specified by the template parameter ActionType.
NOTE: KDE prior to 4.2 connected the triggered() signal instead of the triggered(bool) signal.
The KActionCollection takes ownership of the action object.
- Parameters
-
name The internal name of the action (e.g. "file-open"). receiver The QObject to connect the triggered(bool) signal to. Leave nullptr if no connection is desired. member The SLOT to connect the triggered(bool) signal to. Leave nullptr if no connection is desired.
- Returns
- new action of the given type ActionType.
- See also
- addAction()
Definition at line 551 of file kactioncollection.h.
◆ add() [2/2]
|
inline |
This is the same as add(const QString &name, const QObject *receiver, const char *member) using new style connect syntax.
- Parameters
-
name The internal name of the action (e.g. "file-open"). receiver The QObject to connect the triggered(bool) signal to. slot The slot or lambda to connect the triggered(bool) signal to.
- Returns
- new action of the given type ActionType.
- Since
- 5.28
Definition at line 575 of file kactioncollection.h.
◆ addAction() [1/9]
QAction * KActionCollection::addAction | ( | const QString & | name, |
const QObject * | receiver = nullptr, | ||
const char * | member = nullptr ) |
Creates a new action under the given name to the collection and connects the action's triggered(bool) signal to the specified receiver/member.
The newly created action is returned.
NOTE: KDE prior to 4.2 used the triggered() signal instead of the triggered(bool) signal.
Inserting an action that was previously inserted under a different name will replace the old entry, i.e. the action will not be available under the old name anymore but only under the new one.
Inserting an action under a name that is already used for another action will replace the other action in the collection.
The KActionCollection takes ownership of the action object.
- Parameters
-
name The name by which the action be retrieved again from the collection. receiver The QObject to connect the triggered(bool) signal to. Leave nullptr if no connection is desired. member The SLOT to connect the triggered(bool) signal to. Leave nullptr if no connection is desired.
- Returns
- new action of the given type ActionType.
Definition at line 447 of file kactioncollection.cpp.
◆ addAction() [2/9]
|
inline |
This is the same as addAction(const QString &name, const QObject *receiver, const char *member) using new style connect syntax.
- Parameters
-
name The internal name of the action (e.g. "file-open"). receiver The QObject to connect the triggered(bool) signal to. slot The slot or lambda to connect the triggered(bool) signal to.
- Returns
- new action of the given type ActionType.
- Since
- 5.28
Definition at line 601 of file kactioncollection.h.
◆ addAction() [3/9]
Add an action under the given name to the collection.
Inserting an action that was previously inserted under a different name will replace the old entry, i.e. the action will not be available under the old name anymore but only under the new one.
Inserting an action under a name that is already used for another action will replace the other action in the collection (but will not delete it).
If KAuthorized::authorizeAction() reports that the action is not authorized, it will be disabled and hidden.
The ownership of the action object is not transferred. If the action is destroyed it will be removed automatically from the KActionCollection.
- Parameters
-
name The name by which the action be retrieved again from the collection. action The action to add.
- Returns
- the same as the action given as parameter. This is just for convenience (chaining calls) and consistency with the other addAction methods, you can also simply ignore the return value.
Definition at line 292 of file kactioncollection.cpp.
◆ addAction() [4/9]
QAction * KActionCollection::addAction | ( | KStandardAction::StandardAction | actionType, |
const QObject * | receiver = nullptr, | ||
const char * | member = nullptr ) |
Creates a new standard action, adds it to the collection and connects the action's triggered(bool) signal to the specified receiver/member.
The newly created action is also returned.
- Note
- Using KStandardAction::OpenRecent will cause a different signal than triggered(bool) to be used, see KStandardAction for more information.
The action can be retrieved later from the collection by its standard name as per KStandardAction::stdName.
The KActionCollection takes ownership of the action object.
- Parameters
-
actionType The standard action type of the action to create. receiver The QObject to connect the triggered(bool) signal to. Leave nullptr if no connection is desired. member The SLOT to connect the triggered(bool) signal to. Leave nullptr if no connection is desired.
- Returns
- new action of the given type ActionType.
Definition at line 418 of file kactioncollection.cpp.
◆ addAction() [5/9]
QAction * KActionCollection::addAction | ( | KStandardAction::StandardAction | actionType, |
const QString & | name, | ||
const QObject * | receiver = nullptr, | ||
const char * | member = nullptr ) |
Creates a new standard action, adds to the collection under the given name and connects the action's triggered(bool) signal to the specified receiver/member.
The newly created action is also returned.
- Note
- Using KStandardAction::OpenRecent will cause a different signal than triggered(bool) to be used, see KStandardAction for more information.
The action can be retrieved later from the collection by the specified name.
The KActionCollection takes ownership of the action object.
- Parameters
-
actionType The standard action type of the action to create. name The name by which the action be retrieved again from the collection. receiver The QObject to connect the triggered(bool) signal to. Leave nullptr if no connection is desired. member The SLOT to connect the triggered(bool) signal to. Leave nullptr if no connection is desired.
- Returns
- new action of the given type ActionType.
Definition at line 424 of file kactioncollection.cpp.
◆ addAction() [6/9]
|
inline |
This is the same as addAction(KStandardAction::StandardAction actionType, const QString &name, const QObject *receiver, const char *member) using new style connect syntax.
- Parameters
-
actionType The standard action type of the action to create. name The name by which the action be retrieved again from the collection. receiver The QObject to connect the triggered(bool) signal to. slot The slot or lambda to connect the triggered(bool) signal to.
- Returns
- new action of the given type ActionType.
- Since
- 5.80
Definition at line 412 of file kactioncollection.h.
◆ addAction() [7/9]
QAction * KActionCollection::addAction | ( | KStandardActions::StandardAction | actionType | ) |
Creates a new standard action and adds it to the collection.
The newly created action is also returned.
The action can be retrieved later from the collection by its standard name as per KStandardAction::stdName.
The KActionCollection takes ownership of the action object.
- Parameters
-
actionType The standard action type of the action to create.
- Returns
- new action of the given type ActionType.
- Since
- 6.9
Definition at line 438 of file kactioncollection.cpp.
◆ addAction() [8/9]
|
inline |
This is the same as addAction(KStandardAction::StandardAction actionType, const QString &name, const Receiver *receiver, Func slot) but using KStandardActions from KConfigGui.
- Parameters
-
actionType The standard action type of the action to create. name The name by which the action be retrieved again from the collection. receiver The QObject to connect the triggered(bool) signal to. slot The slot or lambda to connect the triggered(bool) signal to.
- Returns
- new action of the given type ActionType.
- Since
- 6.3
Definition at line 437 of file kactioncollection.h.
◆ addAction() [9/9]
|
inline |
Creates a new standard action, adds it to the collection and connects the action's triggered(bool) signal to the specified receiver/member.
The newly created action is also returned.
- Note
- Using KStandardAction::OpenRecent will cause a different signal than triggered(bool) to be used, see KStandardAction for more information.
The action can be retrieved later from the collection by its standard name as per KStandardAction::stdName.
The KActionCollection takes ownership of the action object.
- Parameters
-
actionType The standard action type of the action to create. receiver The QObject to connect the triggered(bool) signal to. Leave nullptr if no connection is desired. slot The slot or lambda to connect the triggered(bool) signal to.
- Returns
- new action of the given type ActionType.
- Since
- 6.3
Definition at line 474 of file kactioncollection.h.
◆ addActions()
Adds a list of actions to the collection.
The objectName of the actions is used as their internal name in the collection.
The ownership of the action objects is not transferred. If the action is destroyed it will be removed automatically from the KActionCollection.
Uses addAction(const QString&, QAction*).
- Parameters
-
actions the list of the actions to add.
- See also
- addAction()
- Since
- 5.0
Definition at line 389 of file kactioncollection.cpp.
◆ addAssociatedWidget()
void KActionCollection::addAssociatedWidget | ( | QWidget * | widget | ) |
Associate all actions in this collection to the given widget
, including any actions added after this association is made.
This does not change the action's shortcut context, so if you need to have the actions only trigger when the widget has focus, you'll need to set the shortcut context on each action to Qt::WidgetShortcut (or better still, Qt::WidgetWithChildrenShortcut with Qt 4.4+)
Definition at line 830 of file kactioncollection.cpp.
◆ allCollections()
|
static |
Access the list of all action collections in existence for this app.
Definition at line 816 of file kactioncollection.cpp.
◆ associatedWidgets()
Return a list of all associated widgets.
Definition at line 873 of file kactioncollection.cpp.
◆ associateWidget()
void KActionCollection::associateWidget | ( | QWidget * | widget | ) | const |
Associate all actions in this collection to the given widget
.
Unlike addAssociatedWidget(), this method only adds all current actions in the collection to the given widget. Any action added after this call will not be added to the given widget automatically. So this is just a shortcut for a foreach loop and a widget->addAction call.
Definition at line 821 of file kactioncollection.cpp.
◆ changed
|
signal |
Emitted when an action has been inserted into, or removed from, this action collection.
- Since
- 5.66
◆ clear()
void KActionCollection::clear | ( | ) |
Clears the entire action collection, deleting all actions.
Definition at line 188 of file kactioncollection.cpp.
◆ clearAssociatedWidgets()
void KActionCollection::clearAssociatedWidgets | ( | ) |
Clear all associated widgets and remove the actions from those widgets.
Definition at line 878 of file kactioncollection.cpp.
◆ componentDisplayName()
QString KActionCollection::componentDisplayName | ( | ) | const |
The display name for the associated component.
Definition at line 249 of file kactioncollection.cpp.
◆ componentName()
QString KActionCollection::componentName | ( | ) | const |
The component name with which this class is associated.
Definition at line 239 of file kactioncollection.cpp.
◆ configGroup()
QString KActionCollection::configGroup | ( | ) | const |
Returns the KConfig group with which settings will be loaded and saved.
Definition at line 490 of file kactioncollection.cpp.
◆ configIsGlobal()
bool KActionCollection::configIsGlobal | ( | ) | const |
Returns whether this action collection's configuration should be global to KDE ( true
), or specific to the application ( false
).
Definition at line 500 of file kactioncollection.cpp.
◆ connectNotify()
|
overrideprotectedvirtual |
Overridden to perform connections when someone wants to know whether an action was highlighted or triggered.
Reimplemented from QObject.
Definition at line 789 of file kactioncollection.cpp.
◆ count()
int KActionCollection::count | ( | ) | const |
Returns the number of actions in the collection.
This is equivalent to actions().count().
Definition at line 209 of file kactioncollection.cpp.
◆ defaultShortcut()
|
static |
Get the default primary shortcut for the given action.
- Parameters
-
action the action for which the default primary shortcut should be returned.
- Returns
- the default primary shortcut of the given action
- Since
- 5.0
Definition at line 456 of file kactioncollection.cpp.
◆ defaultShortcuts()
|
static |
Get the default shortcuts for the given action.
- Parameters
-
action the action for which the default shortcuts should be returned.
- Returns
- the default shortcuts of the given action
- Since
- 5.0
Definition at line 462 of file kactioncollection.cpp.
◆ exportGlobalShortcuts()
void KActionCollection::exportGlobalShortcuts | ( | KConfigGroup * | config, |
bool | writeDefaults = false ) const |
Export the current configurable global key associations to config
.
- Since
- 4.1
- Parameters
-
config Config object to save to writeDefaults set to true to write settings which are already at defaults.
Definition at line 567 of file kactioncollection.cpp.
◆ importGlobalShortcuts()
void KActionCollection::importGlobalShortcuts | ( | KConfigGroup * | config | ) |
Import from config
all configurable global key associations.
- Since
- 4.1
- Parameters
-
config Config object to read from
Definition at line 510 of file kactioncollection.cpp.
◆ inserted
|
signal |
Indicates that action
was inserted into this action collection.
◆ isEmpty()
bool KActionCollection::isEmpty | ( | ) | const |
Returns whether the action collection is empty or not.
Definition at line 214 of file kactioncollection.cpp.
◆ isShortcutsConfigurable()
|
static |
Returns true if the given action's shortcuts may be configured by the user.
- Parameters
-
action the action for the hint should be verified.
- Since
- 5.0
Definition at line 478 of file kactioncollection.cpp.
◆ parentGUIClient()
const KXMLGUIClient * KActionCollection::parentGUIClient | ( | ) | const |
The parent KXMLGUIClient, or null if not available.
Definition at line 260 of file kactioncollection.cpp.
◆ readSettings()
void KActionCollection::readSettings | ( | KConfigGroup * | config = nullptr | ) |
Read all key associations from config
.
If config
is zero, read all key associations from the application's configuration file KSharedConfig::openConfig(), in the group set by setConfigGroup().
Definition at line 538 of file kactioncollection.cpp.
◆ removeAction()
void KActionCollection::removeAction | ( | QAction * | action | ) |
Removes an action from the collection and deletes it.
- Parameters
-
action The action to remove.
Definition at line 396 of file kactioncollection.cpp.
◆ removeAssociatedWidget()
void KActionCollection::removeAssociatedWidget | ( | QWidget * | widget | ) |
Remove an association between all actions in this collection and the given widget
, i.e.
remove those actions from the widget, and stop associating newly added actions as well.
Definition at line 842 of file kactioncollection.cpp.
◆ setComponentDisplayName()
void KActionCollection::setComponentDisplayName | ( | const QString & | displayName | ) |
Set the component display name associated with this action collection.
(e.g. for the toolbar editor) KXMLGUIClient::setComponentName takes care of calling this.
Definition at line 244 of file kactioncollection.cpp.
◆ setComponentName()
void KActionCollection::setComponentName | ( | const QString & | componentName | ) |
Set the componentName
associated with this action collection.
- Warning
- Don't call this method on a KActionCollection that contains actions. This is not supported.
- Parameters
-
componentData the name which is to be associated with this action collection, or QString() to indicate the app name. This is used to load/save settings into XML files. KXMLGUIClient::setComponentName takes care of calling this.
Definition at line 219 of file kactioncollection.cpp.
◆ setConfigGlobal()
void KActionCollection::setConfigGlobal | ( | bool | global | ) |
Set whether this action collection's configuration should be global to KDE ( true
), or specific to the application ( false
).
Definition at line 505 of file kactioncollection.cpp.
◆ setConfigGroup()
void KActionCollection::setConfigGroup | ( | const QString & | group | ) |
Sets group
as the KConfig group with which settings will be loaded and saved.
Definition at line 495 of file kactioncollection.cpp.
◆ setDefaultShortcut()
|
static |
Set the default shortcut for the given action.
Since 5.2, this also calls action->setShortcut(shortcut), i.e. the default shortcut is made active initially.
- Parameters
-
action the action for which the default shortcut should be set. shortcut the shortcut to use for the given action in its specified shortcutContext()
- Since
- 5.0
Definition at line 467 of file kactioncollection.cpp.
◆ setDefaultShortcuts()
|
static |
Set the default shortcuts for the given action.
Since 5.2, this also calls action->setShortcuts(shortcuts), i.e. the default shortcut is made active initially.
- Parameters
-
action the action for which the default shortcut should be set. shortcuts the shortcuts to use for the given action in its specified shortcutContext()
- Since
- 5.0
Definition at line 472 of file kactioncollection.cpp.
◆ setShortcutsConfigurable()
|
static |
Indicate whether the user may configure the action's shortcuts.
- Parameters
-
action the action for the hint should be verified. configurable set to true if the shortcuts of the given action may be configured by the user, otherwise false.
- Since
- 5.0
Definition at line 485 of file kactioncollection.cpp.
◆ slotActionTriggered
|
protectedvirtualslot |
Definition at line 754 of file kactioncollection.cpp.
◆ takeAction()
Removes an action from the collection.
The ownership of the action object is not changed.
- Parameters
-
action the action to remove.
Definition at line 401 of file kactioncollection.cpp.
◆ writeSettings()
void KActionCollection::writeSettings | ( | KConfigGroup * | config = nullptr, |
bool | writeDefaults = false, | ||
QAction * | oneAction = nullptr ) const |
Write the current configurable key associations to config
.
What the function does if config
is zero depends. If this action collection belongs to a KXMLGUIClient the setting are saved to the kxmlgui definition file. If not the settings are written to the applications config file.
- Note
oneAction
andwriteDefaults
have no meaning for the kxmlgui configuration file.
- Parameters
-
config Config object to save to, or null (see above) writeDefaults set to true to write settings which are already at defaults. oneAction pass an action here if you just want to save the values for one action, eg. if you know that action is the only one which has changed.
Definition at line 687 of file kactioncollection.cpp.
The documentation for this class was generated from the following files:
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.