[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:24:38
[Download RAW message or body]



On Wed, 31 May 2000, Kurt Granroth wrote:

> 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?

This looks like a major hack to me. It claims to return a KPopupMenu and
the caller cannot be sure that it really is a KPopupMenu. The caller would
_have_ to do an inherits("KPopupMenu") call.

I definitely vote against that.


How about just keeping the old method?

Or adding a KAction::kpopupMenu?

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