KXmlGui
kxmlguifactory.cpp
71 void applyActionProperties(const QDomElement &element, ShortcutOption shortcutOption = KXMLGUIFactoryPrivate::SetActiveShortcut);
72 void configureAction(QAction *action, const QDomNamedNodeMap &attributes, ShortcutOption shortcutOption = KXMLGUIFactoryPrivate::SetActiveShortcut);
73 void configureAction(QAction *action, const QDomAttr &attribute, ShortcutOption shortcutOption = KXMLGUIFactoryPrivate::SetActiveShortcut);
75 void applyShortcutScheme(const QString &schemeName, KXMLGUIClient *client, const QList<QAction *> &actions);
76 void refreshActionProperties(KXMLGUIClient *client, const QList<QAction *> &actions, const QDomDocument &doc);
98 QString componentName = _componentName.isEmpty() ? QCoreApplication::applicationName() : _componentName;
105 xml_file = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String("kxmlgui5/") + componentName + QLatin1Char('/') + filename);
122bool KXMLGUIFactory::saveConfigFile(const QDomDocument &doc, const QString &filename, const QString &_componentName)
124 QString componentName = _componentName.isEmpty() ? QCoreApplication::applicationName() : _componentName;
128 xml_file = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/kxmlgui5/%1/%2").arg(componentName, filename);
307void KXMLGUIFactoryPrivate::refreshActionProperties(KXMLGUIClient *client, const QList<QAction *> &actions, const QDomDocument &doc)
311 // qCDebug(DEBUG_KXMLGUI) << client->componentName() << ": applying shortcut scheme" << schemeName;
323 // qCDebug(DEBUG_KXMLGUI) << "scheme said" << action->shortcut().toString() << "for action" << action->objectName();
349 QList<QKeySequence> defaultShortcut = action->property("defaultShortcuts").value<QList<QKeySequence>>();
351 // qCDebug(DEBUG_KXMLGUI) << action->objectName() << "default=" << defaultShortcut.toString() << "active=" << activeShortcut.toString();
376 d->m_clients.erase(std::remove(d->m_clients.begin(), d->m_clients.end(), client), d->m_clients.end());
445QWidget *KXMLGUIFactory::container(const QString &containerName, KXMLGUIClient *client, bool useTagName)
512QList<QWidget *> KXMLGUIFactoryPrivate::findRecursive(KXMLGUI::ContainerNode *node, const QString &tagName)
527void KXMLGUIFactory::plugActionList(KXMLGUIClient *client, const QString &name, const QList<QAction *> &actionList)
558void KXMLGUIFactoryPrivate::applyActionProperties(const QDomElement &actionPropElement, ShortcutOption shortcutOption)
560 for (QDomElement e = actionPropElement.firstChildElement(); !e.isNull(); e = e.nextSiblingElement()) {
574void KXMLGUIFactoryPrivate::configureAction(QAction *action, const QDomNamedNodeMap &attributes, ShortcutOption shortcutOption)
586void KXMLGUIFactoryPrivate::configureAction(QAction *action, const QDomAttr &attribute, ShortcutOption shortcutOption)
614 // Setting the shortcut by property also sets the default shortcut (which is incorrect), so we have to do it directly
623 action->setProperty("defaultShortcuts", QVariant::fromValue(QKeySequence::listFromString(attribute.value())));
629 qCWarning(DEBUG_KXMLGUI) << "Error: Unknown action property " << attrName << " will be ignored!";
633void KXMLGUIFactoryPrivate::applyShortcutScheme(const QString &schemeName, KXMLGUIClient *client, const QList<QAction *> &actions)
647 QString schemeFileName = KShortcutSchemesHelper::shortcutSchemeFileName(client->componentName(), schemeName);
652 qCWarning(DEBUG_KXMLGUI) << client->componentName() << ": shortcut scheme file not found:" << schemeName << "after trying"
660 qCDebug(DEBUG_KXMLGUI) << client->componentName() << ": found shortcut scheme XML" << schemeFileName;
669 QDomElement actionPropElement = docElement.namedItem(QStringLiteral("ActionProperties")).toElement();
673 // qCDebug(DEBUG_KXMLGUI) << "Applying shortcut scheme for XMLGUI client" << client->componentName();
689 qCDebug(DEBUG_KXMLGUI) << "Adding collection from client" << client->componentName() << "with" << client->actionCollection()->count() << "actions";
714QDomElement KXMLGUIFactory::findActionByName(QDomElement &elem, const QString &sName, bool create)
int count() const
Returns the number of actions in the collection.
Definition kactioncollection.cpp:209
QList< QAction * > actions() const
Returns the list of QActions which belong to this action collection.
Definition kactioncollection.cpp:265
KConfigGroup group(const QString &group)
void writeEntry(const char *key, const char *value, WriteConfigFlags pFlags=Normal)
QString readEntry(const char *key, const char *aDefault=nullptr) const
static KGlobalAccel * self()
bool setShortcut(QAction *action, const QList< QKeySequence > &shortcut, GlobalShortcutLoading loadFlag=Autoloading)
Dialog for configuration of KActionCollection and KGlobalAccel.
Definition kshortcutsdialog.h:85
void saved()
Emitted after the dialog is accepted (by clicking the OK button) and settings are saved.
Implements the creation of the GUI (menubar, menus and toolbars) as requested by the GUI factory.
Definition kxmlguibuilder.h:34
A KXMLGUIClient can be used with KXMLGUIFactory to create a GUI from actions and an XML document,...
Definition kxmlguiclient.h:40
virtual KActionCollection * actionCollection() const
Retrieves the entire action collection for the GUI client.
Definition kxmlguiclient.cpp:115
QList< KXMLGUIClient * > childClients()
Retrieves a list of all child clients.
Definition kxmlguiclient.cpp:665
KXMLGUIFactory * factory() const
Retrieves a pointer to the KXMLGUIFactory this client is associated with (will return nullptr if the ...
Definition kxmlguiclient.cpp:631
void setXMLGUIBuildDocument(const QDomDocument &doc)
Definition kxmlguiclient.cpp:616
void setFactory(KXMLGUIFactory *factory)
This method is called by the KXMLGUIFactory as soon as the client is added to the KXMLGUIFactory's GU...
Definition kxmlguiclient.cpp:626
KXMLGUIBuilder * clientBuilder() const
Retrieves the client's GUI builder or nullptr if no client specific builder has been assigned via set...
Definition kxmlguiclient.cpp:675
QDomDocument xmlguiBuildDocument() const
Definition kxmlguiclient.cpp:621
static QString readConfigFile(const QString &filename, const QString &componentName=QString())
Definition kxmlguifactory.cpp:96
QList< KXMLGUIClient * > clients() const
Returns a list of all clients currently added to this factory.
Definition kxmlguifactory.cpp:440
void removeClient(KXMLGUIClient *client)
Removes the GUI described by the client, by unplugging all provided actions and removing all owned co...
Definition kxmlguifactory.cpp:379
static bool saveConfigFile(const QDomDocument &doc, const QString &filename, const QString &componentName=QString())
Definition kxmlguifactory.cpp:122
void addClient(KXMLGUIClient *client)
Creates the GUI described by the QDomDocument of the client, using the client's actions,...
Definition kxmlguifactory.cpp:168
KXMLGUIFactory(KXMLGUIBuilder *builder, QObject *parent=nullptr)
Constructs a KXMLGUIFactory.
Definition kxmlguifactory.cpp:147
static QDomElement actionPropertiesElement(QDomDocument &doc)
Definition kxmlguifactory.cpp:700
void reset()
Use this method to free all memory allocated by the KXMLGUIFactory.
Definition kxmlguifactory.cpp:466
void showConfigureShortcutsDialog()
Shows a dialog (KShortcutsDialog) that lists every action in this factory, and which can be used to c...
Definition kxmlguifactory.cpp:682
static QDomElement findActionByName(QDomElement &elem, const QString &sName, bool create)
Definition kxmlguifactory.cpp:714
void makingChanges(bool)
Emitted when the factory is currently making changes to the GUI, i.e.
void refreshActionProperties()
Use this method to reset and reread action properties (shortcuts, etc.) for all actions.
Definition kxmlguifactory.cpp:272
QWidget * container(const QString &containerName, KXMLGUIClient *client, bool useTagName=false)
Use this method to get access to a container widget with the name specified with containerName and wh...
Definition kxmlguifactory.cpp:445
void resetContainer(const QString &containerName, bool useTagName=false)
Use this method to free all memory allocated by the KXMLGUIFactory for a specific container,...
Definition kxmlguifactory.cpp:473
QString name(StandardAction id)
KGuiItem cont()
const QList< QKeySequence > & shortcut(StandardShortcut id)
bool equals(const QVariant &lhs, const QVariant &rhs)
void setIcon(const QIcon &icon)
void setShortcuts(QKeySequence::StandardKey key)
const char * constData() const const
qsizetype size() const const
applicationName
bool isRelativePath(const QString &path)
bool mkpath(const QString &dirPath) const const
QString name() const const
QString value() const const
QDomElement createElement(const QString &tagName)
QDomElement documentElement() const const
ParseResult setContent(QAnyStringView text, ParseOptions options)
QString attribute(const QString &name, const QString &defValue) const const
QDomNamedNodeMap attributes() const const
void setAttribute(const QString &name, const QString &value)
QString tagName() const const
QDomNode item(int index) const const
int length() const const
QDomNode appendChild(const QDomNode &newChild)
QDomNode cloneNode(bool deep) const const
QDomNode firstChild() const const
QDomElement firstChildElement(const QString &tagName, const QString &namespaceURI) const const
bool isNull() const const
QDomNode namedItem(const QString &name) const const
QDomElement nextSiblingElement(const QString &tagName, const QString &namespaceURI) const const
QDomDocument ownerDocument() const const
QDomAttr toAttr() const const
QDomDocument toDocument() const const
QDomElement toElement() const const
bool exists() const const
bool open(FILE *fh, OpenMode mode, FileHandleFlags handleFlags)
virtual void close() override
QString absolutePath() const const
QIcon fromTheme(const QString &name)
QByteArray readAll()
ReadOnly
QList< QKeySequence > listFromString(const QString &str, SequenceFormat format)
void append(QList< T > &&value)
bool isEmpty() const const
T value(qsizetype i) const const
QKeySequence
Q_EMITQ_EMIT
const QObjectList & children() const const
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QObject * parent() const const
QVariant property(const char *name) const const
T qobject_cast(QObject *object)
bool setProperty(const char *name, QVariant &&value)
GenericDataLocation
QString locate(StandardLocation type, const QString &fileName, LocateOptions options)
QString writableLocation(StandardLocation type)
int compare(QLatin1StringView s1, const QString &s2, Qt::CaseSensitivity cs)
QString fromUtf8(QByteArrayView str)
bool isEmpty() const const
int toInt(bool *ok, int base) const const
QByteArray toLatin1() const const
uint toUInt(bool *ok, int base) const const
CaseInsensitive
WA_DeleteOnClose
QVariant fromValue(T &&value)
bool isValid() const const
int typeId() const const
T value() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 27 2024 11:52:41 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 27 2024 11:52:41 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.