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

List:       kde-devel
Subject:    Re: KActions in context menus
From:       Kurt Granroth <granroth () suse ! com>
Date:       2001-11-06 23:09:50
[Download RAW message or body]

On Tuesday 06 November 2001 03:08 pm, Alexander Brand wrote:
> >     QWidget *widget( factory()->container( "popupmenu", this ) );
>
> I try to implement this in a KPart. But I didn't get any 'factory()'. The
> only factory (Type: KXMLGUIClient) I found was in KPart::MainWindow.
> But how can I implement it? Please, can somebody help?

Most parts are used while embedded into a KPart::MainWindow so that's where
you *usually* get the factory() from.

However, that's not always the case.  What you do, then, is just create your
own.  Code like this might work for you:

if ( !factory() )
{
  setFactory( new KXMLGUIFactory( new KXMLGUIBuilder(0), this ) );
  factory()->addClient( this );
}

Offhand, I don't know if the factory and builder will be deleted automatically
or not.  To be on the safe side, you might want to keep a pointer to them and
deleted 'em in your destructor.

-- 
Kurt Granroth            | http://www.granroth.org
KDE Developer/Evangelist | SuSE Labs Open Source Developer
granroth@kde.org         | granroth@suse.com
            KDE -- Conquer Your Desktop
 
>> 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