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

List:       kwrite-devel
Subject:    Re: How to get KMenuBar instance?
From:       "Christopher J. Bottaro" <cjbottaro () alumni ! cs ! utexas ! edu>
Date:       2007-11-18 19:18:47
Message-ID: c19e6adb0711181118g5f6c221by94261430459bea17 () mail ! gmail ! com
[Download RAW message or body]

On Nov 18, 2007 7:37 AM, Paul Giannaros <paul@giannaros.org> wrote:
> On 18/11/2007, Anders Lund <anders@alweb.dk> wrote:
> > On Sunday 18 November 2007, Christopher J. Bottaro wrote:
> > > I can't find anything about how to get an app's KMenuBar instance.
> >
> > You shouldn't use the menubar object. Instead, add your menu using the XMLGui
> > framework, like other plugins does it.
> >
> > You should read the documentation for KXMLGUIClient, inherited by Kate::Plugin
> > inherits.
> >
> > There are three steps:
> >
> > 1) write an XML file using the kpartgui.dtd, placing your actions in the
> > menubar.
> > 2) create the actions.
> > 3) set the xml file using setXMLFile().
> >
> > If you want to manipulate your menu often, you can keep a pointer to it in
> > your plugin view, or you can get one using KXMLGUIClient::action().
> >
> > For examples, look at the existing plugins. Hint about the XML file: If you
> > want an own menu, simply put it there. The XML plugin does that for example.
>
> Anders, I think the main issue for Christopher is that he is using
> Pate, but as Pate gives full access to KDE and Qt, what you suggested
> should work just fine.
> As I said to Christopher off the list, it should be possible to get a
> reference to the menu bar using topLevelWidget on Kate::MainWindow's
> centralWidget and casting to a KMainWindow or whatever accordingly, if
> that's what he wants to use.

Ahh, I was barking up the wrong tree this whole time.  I looked at
kate.application.mainWindow()
kate.mainWidget()
qt.qApp.mainWidget()

I never thought to use topLevelWidget() to get the QMainWindow().

Btw, kate.mainWidget().topLevelWidget().menuBar() returns a KMenuBar,
no need to use sip.cast().

> You should read the documentation for KXMLGUIClient, inherited by Kate::Plugin inherits.
Anders, thanks for the pointer.

Paul, could you explain to me how KXMLGUIClient works in Pate?

Thanks everyone.
_______________________________________________
KWrite-Devel mailing list
KWrite-Devel@kde.org
https://mail.kde.org/mailman/listinfo/kwrite-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

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