[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Integrating the UI of a KPart
From:       Jason Keirstead <jason () keirstead ! org>
Date:       2003-04-01 6:48:44
[Download RAW message or body]

On March 29, 2003 08:05 pm, Andras Mantia wrote:
> So how can I ignore some items from the KPart XML GUI? I've tried to play
> with the noMerge="1" for the <Menu> and <MenuBar>, but without any luck.
> :-(
>
> Andras

After a ton of hunting on this same problem, I discovered this:

	QDomDocument KXMLGUIClient::domDocument()
	
 	Returns: 
		The parsed XML in a QDomDocument, set by setXMLFile() or setXML(). This document describes the layout of the GUI. 

What you do is call QDomDocument doc = part->domDocument(), then use the QDom to
remove the unwanted XMLGUI entries (do this before you merge the GUI). It is pretty easy
to figure out what nodes to remove by looking at the parts ui.rc file.
  
Example:	
	QDomDocument doc = editpart->domDocument();
	QDomNode menu = doc.documentElement().firstChild();
	menu.removeChild( menu.firstChild() ); // Remove File Menu Entries
	menu.removeChild( menu.firstChild() ); // Remove Edit Menu Entries
	menu.removeChild( menu.firstChild() ); // Remove View Menu Entries
	menu.removeChild( menu.lastChild() ); //Remove Help Menu Entries

	... or go into more detail to remove single nodes. I did not want these menus at all.

Simple as pie :)

-- 
Jason Keirstead, BCS
http://www.keirstead.org
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic