# class KXMLGUIFactory | KXMLGUIFactory, together with KXMLGUIClient objects, can be used to create a GUI of container widgets (like menus, toolbars, etc. More...
Definition | `#include <kxmlgui.h>`
Inherits | QObject (qt) [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- KXMLGUIFactory ( KXMLGUIBuilder *builder, QObject *parent = 0, const char *name = 0 )
- ~KXMLGUIFactory ()
- void addClient ( KXMLGUIClient *client )
- void removeClient ( KXMLGUIClient *client )
- void plugActionList ( KXMLGUIClient *client, const QString &name, const QList<KAction> &actionList )
- void unplugActionList ( KXMLGUIClient *client, const QString &name )
- QList<KXMLGUIClient> clients () const
- QWidget * container ( const QString &containerName, KXMLGUIClient *client, bool useTagName = false )
- QList<QWidget> containers ( const QString &tagName )
- void reset ()
- void resetContainer ( const QString &containerName, bool useTagName = false )

#### Signals

- void clientAdded ( KXMLGUIClient *client )
- void clientRemoved ( KXMLGUIClient *client )

#### Public Static Methods

- static QString readConfigFile ( const QString &filename, bool never_null, KInstance *instance = 0 )
- static QString readConfigFile ( const QString &filename, KInstance *instance = 0 )
- static bool saveConfigFile ( const QDomDocument& doc, const QString& filename, KInstance *instance = 0 )
- static QString documentToXML ( const QDomDocument& doc )
- static QString elementToXML ( const QDomElement& elem )
- static void removeDOMComments ( QDomNode &node )

## 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.

KXMLGUIFactory ( KXMLGUIBuilder *builder, QObject *parent = 0, const char *name = 0 ) | ### KXMLGUIFactory

Constructs a KXMLGUIFactory. The provided `builder` KXMLGUIBuilder will be called for creating and removing container widgets, when clients are added/removed from the GUI.

~KXMLGUIFactory () | ### ~KXMLGUIFactory

Destructor

QString readConfigFile ( const QString &filename, bool never_null, KInstance *instance = 0 ) | ### readConfigFile

[static]

QString readConfigFile ( const QString &filename, KInstance *instance = 0 ) | ### readConfigFile

[static]

bool saveConfigFile ( const QDomDocument& doc, const QString& filename, KInstance *instance = 0 ) | ### saveConfigFile

[static]

QString documentToXML ( const QDomDocument& doc ) | ### documentToXML

[static]

QString elementToXML ( const QDomElement& elem ) | ### elementToXML

[static]

void removeDOMComments ( QDomNode &node ) | ### removeDOMComments

[static]

Removes all QDomComment objects from the specified node and all its children.

void addClient ( KXMLGUIClient *client ) | ### addClient

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 ) | ### removeClient

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 QList<KAction> &actionList ) | ### plugActionList

void unplugActionList ( KXMLGUIClient *client, const QString &name ) | ### unplugActionList

QList<KXMLGUIClient> clients () | ### clients

[const]

Returns a list of all clients currently added to this factory

QWidget * container ( const QString &containerName, KXMLGUIClient *client, bool useTagName = false ) | ### container

Use this method to get access to a container widget with the name specified with `containerName` and which is owned by the `client`. The container name is specified with a "name" attribute in the XML document.

This method may return 0L if no container with the given name exists or is not owned by the client.

Parameters:

useTagName | Specify whether the compare the specified name with the name attribute or the tag name.

QList<QWidget> containers ( const QString &tagName ) | ### containers

void reset () | ### reset

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)

void resetContainer ( const QString &containerName, bool useTagName = false ) | ### resetContainer

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)

void clientAdded ( KXMLGUIClient *client ) | ### clientAdded

[signal]

void clientRemoved ( KXMLGUIClient *client ) | ### clientRemoved

[signal]

Generated by: root@sparc.ports.openbsd.org on Wed May 2 09:37:45 2001, using kdoc 2.0a53.