KXMLGUIFactory Class Reference
KXMLGUIFactory, together with KXMLGUIClient objects, can be used to create a GUI of container widgets (like menus, toolbars, etc.) and container items (menu items, toolbar buttons, etc.) from an XML document and action objects. More...
#include <kxmlguifactory.h>
Inheritance diagram for KXMLGUIFactory:


Signals | |
void | clientAdded (KXMLGUIClient *client) |
void | clientRemoved (KXMLGUIClient *client) |
Public Member Functions | |
KXMLGUIFactory (KXMLGUIBuilder *builder, QObject *parent=0, const char *name=0) | |
Constructs a KXMLGUIFactory. | |
~KXMLGUIFactory () | |
Destructor. | |
void | addClient (KXMLGUIClient *client) |
Creates the GUI described by the QDomDocument of the client, using the client's actions, and merges it with the previously created GUI. | |
void | removeClient (KXMLGUIClient *client) |
Removes the GUI described by the client, by unplugging all provided actions and removing all owned containers (and storing container state information in the given client). | |
void | plugActionList (KXMLGUIClient *client, const QString &name, const QPtrList< KAction > &actionList) |
void | unplugActionList (KXMLGUIClient *client, const QString &name) |
QPtrList< KXMLGUIClient > | clients () const |
Returns a list of all clients currently added to this factory. | |
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 which is owned by the client . | |
QPtrList< QWidget > | containers (const QString &tagName) |
void | reset () |
Use this method to free all memory allocated by the KXMLGUIFactory. | |
void | resetContainer (const QString &containerName, bool useTagName=false) |
Use this method to free all memory allocated by the KXMLGUIFactory for a specific container, including all child containers and actions. | |
Static Public Member Functions | |
QString | readConfigFile (const QString &filename, bool never_null, const KInstance *instance=0) |
QString | readConfigFile (const QString &filename, const KInstance *instance=0) |
bool | saveConfigFile (const QDomDocument &doc, const QString &filename, const KInstance *instance=0) |
QString | documentToXML (const QDomDocument &doc) |
QString | elementToXML (const QDomElement &elem) |
void | removeDOMComments (QDomNode &node) |
Removes all QDomComment objects from the specified node and all its children. | |
Protected Member Functions | |
virtual void | virtual_hook (int id, void *data) |
Friends | |
class | KXMLGUI::BuildHelper |
Detailed Description
KXMLGUIFactory, together with KXMLGUIClient objects, can be used to create a GUI of container widgets (like menus, toolbars, etc.) and container items (menu items, toolbar buttons, etc.) from an XML document and action objects.Each KXMLGUIClient represents a part of the GUI, composed from containers and actions. KXMLGUIFactory takes care of building (with the help of a KXMLGUIBuilder) and merging the GUI from an unlimited number of clients.
Each client provides XML through a QDomDocument and actions through a KActionCollection . The XML document contains the rules for how to merge the GUI.
KXMLGUIFactory processes the DOM tree provided by a client and plugs in the client's actions, according to the XML and the merging rules of previously inserted clients. Container widgets are built via a KXMLGUIBuilder , which has to be provided with the KXMLGUIFactory constructor.
Definition at line 59 of file kxmlguifactory.h.
Constructor & Destructor Documentation
|
Constructs a KXMLGUIFactory.
The provided Note that the ownership of the given KXMLGUIBuilder object won't be transferred to this KXMLGUIFactory, so you have to take care of deleting it properly. Definition at line 194 of file kxmlguifactory.cpp. References KStdAccel::name(). |
|
Destructor.
Definition at line 207 of file kxmlguifactory.cpp. |
Member Function Documentation
|
Removes all QDomComment objects from the specified node and all its children.
Definition at line 174 of file kxmlguifactory.cpp. References QDomNode::firstChild(), QDomNode::isNull(), QDomNode::nextSibling(), QDomNode::nodeType(), and QDomNode::removeChild(). Referenced by KEditToolbarWidget::KEditToolbarWidget(), KToolBar::saveState(), and KXMLGUIClient::setDOMDocument(). |
|
|
Removes the GUI described by the client, by unplugging all provided actions and removing all owned containers (and storing container state information in the given client).
Definition at line 305 of file kxmlguifactory.cpp. References KXMLGUIClient::childClients(), QObject::children(), KXMLGUIClient::clientBuilder(), QPtrList< KXMLGUIClient >::count(), QPtrListIterator::current(), QDomDocument::documentElement(), KXMLGUIClient::domDocument(), KXMLGUIClient::factory(), KXMLGUIClient::prepareXMLUnplug(), KXMLGUIClient::setFactory(), KXMLGUIClient::setXMLGUIBuildDocument(), and KXMLGUIClient::xmlguiBuildDocument(). Referenced by addClient(), KMainWindow::createGUI(), KEditToolbarWidget::save(), and KMainWindow::setStandardToolBarMenuEnabled(). |
|
Returns a list of all clients currently added to this factory.
Definition at line 362 of file kxmlguifactory.cpp. Referenced by KEditToolbarWidget::KEditToolbarWidget(). |
|
Use this method to get access to a container widget with the name specified with The container name is specified with a "name" attribute in the XML document. This function is particularly useful for getting hold of a popupmenu defined in an XMLUI file. For instance: QPopupMenu *popup = static_cast<QPopupMenu*>(factory()->container("my_popup",this)) where "my_popup" is the name of the menu in the XMLUI file, and "this" is XMLGUIClient which owns the popupmenu (e.g. the mainwindow, or the part, or the plugin...)
Definition at line 367 of file kxmlguifactory.cpp. Referenced by resetContainer(). |
|
Use this method to free all memory allocated by the KXMLGUIFactory. This deletes the internal node tree and therefore resets the internal state of the class. Please note that the actual GUI is NOT touched at all, meaning no containers are deleted nor any actions unplugged. That is something you have to do on your own. So use this method only if you know what you are doing :-) (also note that this will call KXMLGUIClient::setFactory( 0L ) for all inserted clients) Definition at line 389 of file kxmlguifactory.cpp. |
|
Use this method to free all memory allocated by the KXMLGUIFactory for a specific container, including all child containers and actions. This deletes the internal node subtree for the specified container. The actual GUI is not touched, no containers are deleted or any actions unplugged. Use this method only if you know what you are doing :-) (also note that this will call KXMLGUIClient::setFactory( 0L ) for all clients of the container) Definition at line 396 of file kxmlguifactory.cpp. References container(), QString::isEmpty(), and QObject::parent(). Referenced by KMainWindow::createGUI(). |
The documentation for this class was generated from the following files: