XML GUI question

Simon Hausmann hausmann at kde.org
Mon Oct 28 16:15:45 GMT 2002


On Mon, Oct 28, 2002 at 03:45:17PM +0100, Michael Goffioul wrote:
> Hi,
> 
> I have a kghostview part embedded into a kdialogbase (the print preview
> window actually). The dialog also has a toolbar which I want to populate
> with the actions from the kghostview part. Is there a way to do this
> automatically using the XML-GUI framework: getting the toolbar description
> from the XML kgv_part.rc and building the KToolBar object from it?
> 
> I looked at the code, and apparently KToolBar object is actually
> populated if its parent inherits KMainWindow, which is not the case
> here. But I'm not a XML-GUI expert.

I'm not exactly sure I understand the problem, but if you want to
make kghostview's GUI visibile in your dialog then the following
code snipped should probably work:

KXMLGUIBuilder *builder = new KXMLGUIBuilder( dialog );
KXMLGUIFactory *guiFactory = new KXMLGUIFactory( builder );
guiFactory->addClient( ghostviewPart );

...

(and possibly later in your destructor)
guiFactory->removeClient( ghostviewPart );
delete guiFactory;
delete builder;

Is that what you mean?

Simon




More information about the kde-core-devel mailing list