KActionCollection

Search for usage in LXR

#include <KActionCollection>

Inheritance diagram for 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 QActionaction (const QString &name) const
 
QActionaction (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)
 
QActionaddAction (const QString &name, const QObject *receiver=nullptr, const char *member=nullptr)
 
QActionaddAction (const QString &name, const Receiver *receiver, Func slot)
 
Q_INVOKABLE QActionaddAction (const QString &name, QAction *action)
 
QActionaddAction (KStandardAction::StandardAction actionType, const QObject *receiver=nullptr, const char *member=nullptr)
 
QActionaddAction (KStandardAction::StandardAction actionType, const QString &name, const QObject *receiver=nullptr, const char *member=nullptr)
 
QActionaddAction (KStandardAction::StandardAction actionType, const QString &name, const Receiver *receiver, Func slot)
 
QActionaddAction (KStandardActions::StandardAction actionType)
 
QActionaddAction (KStandardActions::StandardAction actionType, const QString &name, const Receiver *receiver, Func slot)
 
QActionaddAction (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 KXMLGUIClientparentGUIClient () 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)
 
QActiontakeAction (QAction *action)
 
void writeSettings (KConfigGroup *config=nullptr, bool writeDefaults=false, QAction *oneAction=nullptr) const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
QBindable< QStringbindableObjectName ()
 
bool blockSignals (bool block)
 
const QObjectListchildren () 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< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
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 QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () 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
 
qobject_cast (const QObject *object)
 
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)
 
QThreadthread () const const
 

Static Public Member Functions

static const QList< KActionCollection * > & allCollections ()
 
static QKeySequence defaultShortcut (QAction *action)
 
static QList< QKeySequencedefaultShortcuts (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
 
QObjectsender () 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

QString KActionCollection::configGroup
readwrite

Definition at line 54 of file kactioncollection.h.

◆ configIsGlobal

bool KActionCollection::configIsGlobal
readwrite

Definition at line 55 of file kactioncollection.h.

Constructor & Destructor Documentation

◆ KActionCollection()

KActionCollection::KActionCollection ( QObject * parent,
const QString & cName = QString() )
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()

KActionCollection::~KActionCollection ( )
override

Destructor.

Definition at line 183 of file kactioncollection.cpp.

Member Function Documentation

◆ action() [1/2]

QAction * KActionCollection::action ( const QString & name) const

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.

qobject_cast<QMenu *>(guiFactory()->container("menuId", this));
T qobject_cast(QObject *object)

after having called setupGUI() or createGUI().

Parameters
nameName 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

void KActionCollection::actionHovered ( QAction * action)
signal

Indicates that action was hovered.

◆ actions()

QList< QAction * > KActionCollection::actions ( ) const

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()

const QList< QAction * > KActionCollection::actionsWithoutGroup ( ) const

Returns the list of QActions without an QAction::actionGroup() which belong to this action collection.

Definition at line 270 of file kactioncollection.cpp.

◆ actionTriggered

void KActionCollection::actionTriggered ( QAction * action)
signal

Indicates that action was triggered.

◆ add() [1/2]

template<class ActionType >
ActionType * KActionCollection::add ( const QString & name,
const QObject * receiver = nullptr,
const char * member = nullptr )
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
nameThe internal name of the action (e.g. "file-open").
receiverThe QObject to connect the triggered(bool) signal to. Leave nullptr if no connection is desired.
memberThe 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]

template<class ActionType >
ActionType * KActionCollection::add ( const QString & name,
const Receiver * receiver,
Func slot )
inline

This is the same as add(const QString &name, const QObject *receiver, const char *member) using new style connect syntax.

Parameters
nameThe internal name of the action (e.g. "file-open").
receiverThe QObject to connect the triggered(bool) signal to.
slotThe slot or lambda to connect the triggered(bool) signal to.
Returns
new action of the given type ActionType.
See also
add(const QString &, const QObject *, const char *)
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
nameThe name by which the action be retrieved again from the collection.
receiverThe QObject to connect the triggered(bool) signal to. Leave nullptr if no connection is desired.
memberThe 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]

QAction * KActionCollection::addAction ( const QString & name,
const Receiver * receiver,
Func slot )
inline

This is the same as addAction(const QString &name, const QObject *receiver, const char *member) using new style connect syntax.

Parameters
nameThe internal name of the action (e.g. "file-open").
receiverThe QObject to connect the triggered(bool) signal to.
slotThe slot or lambda to connect the triggered(bool) signal to.
Returns
new action of the given type ActionType.
See also
addAction(const QString &, const QObject *, const char *)
Since
5.28

Definition at line 601 of file kactioncollection.h.

◆ addAction() [3/9]

QAction * KActionCollection::addAction ( const QString & name,
QAction * action )

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
nameThe name by which the action be retrieved again from the collection.
actionThe 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
actionTypeThe standard action type of the action to create.
receiverThe QObject to connect the triggered(bool) signal to. Leave nullptr if no connection is desired.
memberThe 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
actionTypeThe standard action type of the action to create.
nameThe name by which the action be retrieved again from the collection.
receiverThe QObject to connect the triggered(bool) signal to. Leave nullptr if no connection is desired.
memberThe 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]

QAction * KActionCollection::addAction ( KStandardAction::StandardAction actionType,
const QString & name,
const Receiver * receiver,
Func slot )
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
actionTypeThe standard action type of the action to create.
nameThe name by which the action be retrieved again from the collection.
receiverThe QObject to connect the triggered(bool) signal to.
slotThe slot or lambda to connect the triggered(bool) signal to.
Returns
new action of the given type ActionType.
See also
addAction(KStandardAction::StandardAction, const QString &, const QObject *, const char *)
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
actionTypeThe 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]

QAction * KActionCollection::addAction ( KStandardActions::StandardAction actionType,
const QString & name,
const Receiver * receiver,
Func slot )
inline

This is the same as addAction(KStandardAction::StandardAction actionType, const QString &name, const Receiver *receiver, Func slot) but using KStandardActions from KConfigGui.

Parameters
actionTypeThe standard action type of the action to create.
nameThe name by which the action be retrieved again from the collection.
receiverThe QObject to connect the triggered(bool) signal to.
slotThe 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]

QAction * KActionCollection::addAction ( KStandardActions::StandardAction actionType,
const Receiver * receiver,
Func slot )
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
actionTypeThe standard action type of the action to create.
receiverThe QObject to connect the triggered(bool) signal to. Leave nullptr if no connection is desired.
slotThe 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()

void KActionCollection::addActions ( const QList< QAction * > & actions)

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
actionsthe 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()

const QList< KActionCollection * > & KActionCollection::allCollections ( )
static

Access the list of all action collections in existence for this app.

Definition at line 816 of file kactioncollection.cpp.

◆ associatedWidgets()

QList< QWidget * > KActionCollection::associatedWidgets ( ) const

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

void KActionCollection::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()

void KActionCollection::connectNotify ( const QMetaMethod & signal)
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()

QKeySequence KActionCollection::defaultShortcut ( QAction * action)
static

Get the default primary shortcut for the given action.

Parameters
actionthe 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()

QList< QKeySequence > KActionCollection::defaultShortcuts ( QAction * action)
static

Get the default shortcuts for the given action.

Parameters
actionthe 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
configConfig object to save to
writeDefaultsset 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
configConfig object to read from

Definition at line 510 of file kactioncollection.cpp.

◆ inserted

void KActionCollection::inserted ( QAction * action)
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()

bool KActionCollection::isShortcutsConfigurable ( QAction * action)
static

Returns true if the given action's shortcuts may be configured by the user.

Parameters
actionthe 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
actionThe 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
componentDatathe 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()

void KActionCollection::setDefaultShortcut ( QAction * action,
const QKeySequence & shortcut )
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
actionthe action for which the default shortcut should be set.
shortcutthe shortcut to use for the given action in its specified shortcutContext()
Since
5.0

Definition at line 467 of file kactioncollection.cpp.

◆ setDefaultShortcuts()

void KActionCollection::setDefaultShortcuts ( QAction * action,
const QList< QKeySequence > & shortcuts )
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
actionthe action for which the default shortcut should be set.
shortcutsthe shortcuts to use for the given action in its specified shortcutContext()
Since
5.0

Definition at line 472 of file kactioncollection.cpp.

◆ setShortcutsConfigurable()

void KActionCollection::setShortcutsConfigurable ( QAction * action,
bool configurable )
static

Indicate whether the user may configure the action's shortcuts.

Parameters
actionthe action for the hint should be verified.
configurableset 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

void KActionCollection::slotActionTriggered ( )
protectedvirtualslot

Definition at line 754 of file kactioncollection.cpp.

◆ takeAction()

QAction * KActionCollection::takeAction ( QAction * action)

Removes an action from the collection.

The ownership of the action object is not changed.

Parameters
actionthe 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 and writeDefaults have no meaning for the kxmlgui configuration file.
Parameters
configConfig object to save to, or null (see above)
writeDefaultsset to true to write settings which are already at defaults.
oneActionpass 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:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:56:26 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.