Hi again, > Probably an easy question, but I just couldn't figure it out, yet: How can > you remove some portions of a KPart GUI? > For instance, I'm using a khtmlpart (among others), but in the context of > my application, the entire Tools-Menu, and a number of other menus/toolbar > items are entirely meaningless, and just constitute GUI bloat. > Could somebody point me to the relevant documentation, please? since nobody answered this question, I concluded, there is no easy way to do so, currently. After hours of experimentation with various approaches, I came up with the two helper functions listed below. Call these before the GUI is created, with a list of names of actions/menus/toolbars you want discarded. E.g.: removeContainers (khtmlpart, QStringList::split (',', "tools,security,extraToolBar,saveBackground,saveDocument,saveFrame,kget_menu"), true); Maybe a more efficient analogon to this could/should be added to the KXMLGUIClient? /** A helper function to removeContainers: remove QDomElements with attribute 'name="..."' from QDomNode parent, where "..." is any of the strings in names. */ void removeNamedElementsRecursive (const QStringList &names, QDomNode &parent) { QDomNode nchild; for (QDomNode child = parent.firstChild (); !child.isNull (); child = nchild) { removeNamedElementsRecursive (names, child); nchild = child.nextSibling (); // need to fetch next sibling here, as we might remove the child below if (child.isElement ()) { QDomElement e = child.toElement (); if (names.contains (e.attribute ("name"))) { parent.removeChild (child); } } } } /** remove containers (actions, menus, etc.) with attribute 'name="..."' from KXMLGUIClient from s XML gui, where "..." is any of the strings in names. If recursive, also removes those containers from child clients. */ void removeContainers (KXMLGUIClient *from, const QStringList &names, bool recursive) { QDomDocument doc = from->xmlguiBuildDocument (); if (doc.documentElement ().isNull ()) doc = from->domDocument (); QDomElement e = doc.documentElement (); removeNamedElementsRecursive (names, e); from->setXMLGUIBuildDocument (doc); if (recursive) { QPtrList *children = const_cast *> (from->childClients ()); if (children) { for (KXMLGUIClient *child = children->first (); child; child = children->next ()) { removeContainers (child, names, true); } } } } >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<