KXmlGui
kactioncollection.cpp
311 qCDebug(DEBUG_KXMLGUI) << "Registering action " << objectName << " under new name " << indexName;
418QAction *KActionCollection::addAction(KStandardAction::StandardAction actionType, const QObject *receiver, const char *member)
424QAction *KActionCollection::addAction(KStandardAction::StandardAction actionType, const QString &name, const QObject *receiver, const char *member)
443 QAction *action = KStandardAction::create(static_cast<KStandardAction::StandardAction>(actionType), nullptr, {}, this);
447QAction *KActionCollection::addAction(const QString &name, const QObject *receiver, const char *member)
472void KActionCollection::setDefaultShortcuts(QAction *action, const QList<QKeySequence> &shortcuts)
575 d->actionStore.foreachAction([config, this, writeAll](const QString &actionName, QAction *action) {
582 qCCritical(DEBUG_KXMLGUI) << "Skipped exporting Shortcut for action without name " << action->text() << "!";
588 bool bSameAsDefault = (KGlobalAccel::self()->shortcut(action) == KGlobalAccel::self()->defaultShortcut(action));
642 actionStore.foreachAction([&elem, &attrShortcut, this](const QString &actionName, QAction *action) {
650 qCCritical(DEBUG_KXMLGUI) << "Skipped writing shortcut for action " << actionName << "(" << action->text() << ")!";
655 qCDebug(DEBUG_KXMLGUI) << "name = " << actionName << " shortcut = " << QKeySequence::listToString(action->shortcuts())
670 // qCDebug(DEBUG_KXMLGUI) << "act_elem.attributes().count() = " << act_elem.attributes().count();
687void KActionCollection::writeSettings(KConfigGroup *config, bool writeAll, QAction *oneAction) const
707 d->actionStore.foreachAction([config, this, writeAll](const QString &actionName, QAction *action) {
Q_INVOKABLE QAction * addAction(const QString &name, QAction *action)
Add an action under the given name to the collection.
Definition kactioncollection.cpp:292
static QKeySequence defaultShortcut(QAction *action)
Get the default primary shortcut for the given action.
Definition kactioncollection.cpp:456
static bool isShortcutsConfigurable(QAction *action)
Returns true if the given action's shortcuts may be configured by the user.
Definition kactioncollection.cpp:478
void addActions(const QList< QAction * > &actions)
Adds a list of actions to the collection.
Definition kactioncollection.cpp:389
void addAssociatedWidget(QWidget *widget)
Associate all actions in this collection to the given widget, including any actions added after this ...
Definition kactioncollection.cpp:830
int count() const
Returns the number of actions in the collection.
Definition kactioncollection.cpp:209
QList< QWidget * > associatedWidgets() const
Return a list of all associated widgets.
Definition kactioncollection.cpp:873
void actionHovered(QAction *action)
Indicates that action was hovered.
QString componentDisplayName() const
The display name for the associated component.
Definition kactioncollection.cpp:249
void connectNotify(const QMetaMethod &signal) override
Overridden to perform connections when someone wants to know whether an action was highlighted or tri...
Definition kactioncollection.cpp:789
void clear()
Clears the entire action collection, deleting all actions.
Definition kactioncollection.cpp:188
void importGlobalShortcuts(KConfigGroup *config)
Import from config all configurable global key associations.
Definition kactioncollection.cpp:510
void exportGlobalShortcuts(KConfigGroup *config, bool writeDefaults=false) const
Export the current configurable global key associations to config.
Definition kactioncollection.cpp:567
void setConfigGroup(const QString &group)
Sets group as the KConfig group with which settings will be loaded and saved.
Definition kactioncollection.cpp:495
void setComponentName(const QString &componentName)
Set the componentName associated with this action collection.
Definition kactioncollection.cpp:219
void clearAssociatedWidgets()
Clear all associated widgets and remove the actions from those widgets.
Definition kactioncollection.cpp:878
static void setShortcutsConfigurable(QAction *action, bool configurable)
Indicate whether the user may configure the action's shortcuts.
Definition kactioncollection.cpp:485
void associateWidget(QWidget *widget) const
Associate all actions in this collection to the given widget.
Definition kactioncollection.cpp:821
const KXMLGUIClient * parentGUIClient() const
The parent KXMLGUIClient, or null if not available.
Definition kactioncollection.cpp:260
const QList< QAction * > actionsWithoutGroup() const
Returns the list of QActions without an QAction::actionGroup() which belong to this action collection...
Definition kactioncollection.cpp:270
QAction * takeAction(QAction *action)
Removes an action from the collection.
Definition kactioncollection.cpp:401
bool isEmpty() const
Returns whether the action collection is empty or not.
Definition kactioncollection.cpp:214
KActionCollection(QObject *parent, const QString &cName=QString())
Constructor.
Definition kactioncollection.cpp:164
static void setDefaultShortcut(QAction *action, const QKeySequence &shortcut)
Set the default shortcut for the given action.
Definition kactioncollection.cpp:467
const QList< QActionGroup * > actionGroups() const
Returns the list of all QActionGroups associated with actions in this action collection.
Definition kactioncollection.cpp:281
static Q_INVOKABLE void setDefaultShortcuts(QAction *action, const QList< QKeySequence > &shortcuts)
Set the default shortcuts for the given action.
Definition kactioncollection.cpp:472
void changed()
Emitted when an action has been inserted into, or removed from, this action collection.
void writeSettings(KConfigGroup *config=nullptr, bool writeDefaults=false, QAction *oneAction=nullptr) const
Write the current configurable key associations to config.
Definition kactioncollection.cpp:687
void removeAction(QAction *action)
Removes an action from the collection and deletes it.
Definition kactioncollection.cpp:396
void inserted(QAction *action)
Indicates that action was inserted into this action collection.
QString componentName() const
The component name with which this class is associated.
Definition kactioncollection.cpp:239
static const QList< KActionCollection * > & allCollections()
Access the list of all action collections in existence for this app.
Definition kactioncollection.cpp:816
void setComponentDisplayName(const QString &displayName)
Set the component display name associated with this action collection.
Definition kactioncollection.cpp:244
static QList< QKeySequence > defaultShortcuts(QAction *action)
Get the default shortcuts for the given action.
Definition kactioncollection.cpp:462
void removeAssociatedWidget(QWidget *widget)
Remove an association between all actions in this collection and the given widget,...
Definition kactioncollection.cpp:842
void readSettings(KConfigGroup *config=nullptr)
Read all key associations from config.
Definition kactioncollection.cpp:538
QList< QAction * > actions() const
Returns the list of QActions which belong to this action collection.
Definition kactioncollection.cpp:265
void setConfigGlobal(bool global)
Set whether this action collection's configuration should be global to KDE ( true ),...
Definition kactioncollection.cpp:505
QAction * action(int index) const
Return the QAction* at position index in the action collection.
Definition kactioncollection.cpp:203
void actionTriggered(QAction *action)
Indicates that action was triggered.
static Q_INVOKABLE bool authorizeAction(const QString &action)
Persistent
Global
void deleteEntry(const char *key, WriteConfigFlags pFlags=Normal)
void writeEntry(const char *key, const char *value, WriteConfigFlags pFlags=Normal)
QString readEntry(const char *key, const char *aDefault=nullptr) const
bool exists() const
bool sync() override
bool hasShortcut(const QAction *action) const
static KGlobalAccel * self()
bool setShortcut(QAction *action, const QList< QKeySequence > &shortcut, GlobalShortcutLoading loadFlag=Autoloading)
NoAutoloading
QList< QKeySequence > shortcut(const QAction *action) const
QList< QKeySequence > defaultShortcut(const QAction *action) const
A KXMLGUIClient can be used with KXMLGUIFactory to create a GUI from actions and an XML document,...
Definition kxmlguiclient.h:40
virtual QString xmlFile() const
This will return the name of the XML file as set by setXMLFile().
Definition kxmlguiclient.cpp:139
static QString readConfigFile(const QString &filename, const QString &componentName=QString())
Definition kxmlguifactory.cpp:96
static bool saveConfigFile(const QDomDocument &doc, const QString &filename, const QString &componentName=QString())
Definition kxmlguifactory.cpp:122
static QDomElement actionPropertiesElement(QDomDocument &doc)
Definition kxmlguifactory.cpp:700
static QDomElement findActionByName(QDomElement &elem, const QString &sName, bool create)
Definition kxmlguifactory.cpp:714
QAction * create(StandardAction id, const QObject *recvr, const char *slot, QObject *parent)
StandardAction
StandardAction
Category category(StandardShortcut id)
const QList< QKeySequence > & shortcut(StandardShortcut id)
QActionGroup * actionGroup() const const
void setEnabled(bool)
void hovered()
void setShortcuts(QKeySequence::StandardKey key)
QList< QKeySequence > shortcuts() const const
text
void triggered(bool checked)
void setVisible(bool)
applicationName
ParseResult setContent(QAnyStringView text, ParseOptions options)
QDomNamedNodeMap attributes() const const
void removeAttribute(const QString &name)
void setAttribute(const QString &name, const QString &value)
int count() const const
bool isNull() const const
QDomNode removeChild(const QDomNode &oldChild)
applicationDisplayName
QList< QKeySequence > listFromString(const QString &str, SequenceFormat format)
QString listToString(const QList< QKeySequence > &list, SequenceFormat format)
void append(QList< T > &&value)
const_reference at(qsizetype i) const const
iterator begin()
bool contains(const AT &value) const const
iterator end()
iterator erase(const_iterator begin, const_iterator end)
T & first()
bool isEmpty() const const
void push_back(parameter_type value)
qsizetype removeAll(const AT &t)
qsizetype size() const const
T value(qsizetype i) const const
QByteArray methodSignature() const const
Q_EMITQ_EMIT
bool blockSignals(bool block)
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
virtual void connectNotify(const QMetaMethod &signal)
void destroyed(QObject *obj)
bool disconnect(const QMetaObject::Connection &connection)
QList< T > findChildren(Qt::FindChildOptions options) const const
objectName
QObject * parent() const const
QVariant property(const char *name) const const
T qobject_cast(QObject *object)
QObject * sender() const const
void setObjectName(QAnyStringView name)
void setParent(QObject *parent)
bool setProperty(const char *name, QVariant &&value)
iterator insert(const T &value)
QList< T > values() const const
QString asprintf(const char *cformat,...)
bool isEmpty() const const
bool startsWith(QChar c, Qt::CaseSensitivity cs) const const
QVariant fromValue(T &&value)
bool isValid() const const
bool toBool() const const
T value() const const
QList< QAction * > actions() const const
QAction * addAction(const QIcon &icon, const QString &text)
void addActions(const QList< QAction * > &actions)
void removeAction(QAction *action)
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
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.