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

List:       kde-devel
Subject:    KPopupMenu in kaction
From:       Kurt Granroth <granroth () kde ! org>
Date:       2000-05-31 18:50:19
[Download RAW message or body]

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.

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?
-- 
Kurt Granroth            | http://www.granroth.org
KDE Developer/Evangelist | SuSE Labs Open Source Developer
granroth@kde.org         | granroth@suse.com
           KDE -- Putting a Friendly Face on Unix
 
>> 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