KToggleToolBarAction?
David Faure
david at mandrakesoft.com
Thu Apr 4 16:52:40 BST 2002
On Thursday 04 April 2002 03:21, John Firebaugh wrote:
> On Wednesday 03 April 2002 11:33, Ellis Whitehead wrote:
> > On Wednesday 03 April 2002 09:05, Guillaume Laurent wrote:
> > > On Wednesday 03 April 2002 16:10, Ellis Whitehead wrote:
> > > > On Wednesday 03 April 2002 01:05, John Firebaugh wrote:
> > > > > How do I get a pointer to the main window from plug()? Follow parents
> > > > > until I find one that inherits("KMainWindow")?
> > > >
> > > > Exactly.
> > >
> > > Can't you use QWidget::topLevelWidget() ?
> >
> > I don't know if this has changed for Qt 3.x, but in 2.x topLevelWidget()
> > didn't always go back far enough. I'm not basing this on personal
> > experience, though, and I don't know where it would get stuck. KDialog?
> > Anyhow, there's a note about it in kaction.cpp, and the KAction API used to
> > have a findMainWindow() method to deal with the problem.
Yes, in case of a standalone popupmenu, topLevelWidget would stop at the popupmenu,
whereas you want to go up until some kmainwindow (think about such
action being plugged in konqueror's RMB menu for instance).
> This findMainWindow() method would be handy, as I've basically copied the code
> from plugMainWindowAccel() that finds the KMainWindow parent. Why was it
> removed?
Because KAccel/KAction got a lot smarter ;)
But if there's a need for findMainWindow again, feel free to readd it.
--
David FAURE, david at mandrakesoft.com, faure at kde.org
http://people.mandrakesoft.com/~david/, http://www.konqueror.org/
KDE, Making The Future of Computing Available Today
More information about the kde-core-devel
mailing list