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

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

Simon Hausmann wrote:
> > 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) .
 
How about this:

KPopupMenu* KAction::popupMenu( int index ) const
{
  QWidget* w = d->m_containers[ index ].m_container;
  if ( !w || !w->inherits( "QPopupMenu" ) )
    return 0;

  return (KPopupMenu*)w;
}

This would be casting the "wrong way"... but it should work, right?
-- 
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