[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: KPopupMenu in kaction
From: Simon Hausmann <shaus () helios ! Med ! Uni-Magdeburg ! DE>
Date: 2000-05-31 19:06:48
[Download RAW message or body]
On Wed, 31 May 2000, Kurt Granroth wrote:
> Simon Hausmann wrote:
> > On Wed, 31 May 2000, Kurt Granroth wrote:
> > > Joachim Ansorg wrote:
> > > > It is possible that KActionMenu and KAccelMenu could be changed to
> > > > inherit KPopupMenu so we have everywhere the same meu types. Without
> > > > it's impossible for coders to have KPopupMenu's titles in action and
> > > > KAccel menus.
> > >
> > > I don't see any problem with that. I'll do that now.
> >
> > Good idea!
> >
> > In addition we could add support for a <MenuTitle> element in the xmlgui
> > code :) (for setting the title from withing the xml document) .
>
> Okay, I did it. Now I *didn't* do a simple s/QPopupMenu/KPopupMenu
> everywhere in kaction. I'm not 100% sure where all of the methods are
> used and in what context.
>
> Now it seems to me that all methods that return a QPopupMenu could
> easily return a KPopupMenu, right? This is because any KPopupMenu can
> easily cast down to a QPopupMenu. But in all the ::plug methods, we
> have 'widget->inherits("QPopupMenu")'... I'm guessing that it's
> probably best to keep that as QPopupMenu to go for the lowest common
> denominator.
Yes, we have to keep them, otherwise KAction would not more be pluggable
into a plain QPopupMenu ;-)
> In short, I'd *like* to change *all* popupMenu() functions to return
> KPopupMenu instead of QPopupMenu. I would then leave all references
> to QPopupMenu whenever we are dealing with ->inherits()
>
> But the biggest reason I didn't just go do it is this function:
>
> QPopupMenu* KAction::popupMenu( int index ) const
> {
> QWidget* w = d->m_containers[ index ].m_container;
> if ( !w || !w->inherits( "QPopupMenu" ) )
> return 0;
>
> return (QPopupMenu*)w;
> }
>
> If we change the return type to KPopupMenu*, can we ensure that all of
> the popup menus in d->m_containers will always be KPopupMenu and never
> be QPopupMenu?
I don't think we can ensure that. At least not when we continue to allow
KAction to be plugged into a plain QPopupMenu, which we absolutely should
allow IMHO.
IMHO we should allocate a KPopupMenu whereever we allocate a QPopupMenu,
but still return a QPopupMenu, as lowest denominator (you can always cast
it down) .
Bye,
Simon
>> Visit http://master.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