[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: Tear-off handles for KPopupMenu
From: m_elter () t-online ! de (Matthias Elter)
Date: 2000-04-27 11:43:44
[Download RAW message or body]
> The xmlgui stuff supports tear-off handles, by specifying a tearoffhandle
> tag in a menu.
The tear-off handles on/off should be a KDE-global setting. Some apps using tear-off \
handles, others not is not acceptable IMHO.
> The problem with KPopupMenu inserting an item at the very beginning of the
> menu will most likely break the xmlgui stuff, because it heavily relies on
> knowing about _all_ items in a container widget (like a popupmenu is)
> (otherwise the merging screws up) .
Store the id's of the items you insert in a dict and you are save. Ok you are right \
you have to be carefull with stuff like indexOf(). Perhaps it's possible to hide the \
tear-off items by overloading methods like indexOf in KPopupMenu. I'm going to look \
into this.
> I think inserting a tear-off handle at the beginning without the
> application knowing about it is also likely to break other apps. Think of
> the following example:
> Imaging a Recent-Documents menu, created not with all the action stuff,
> just with plain insertItem. I already saw code that connects to the
> activated( int id ) signal of the menu and does something like
>
> slot()
> {
> doSomething( listOfItems[ menu->indexOf( id ) ] );
> }
>
> As indexOf returns a different value than the programmer expects (because
> KPopupMenu inserted an item the programmer does not know about) the
> program is likely to break ;-) . Just doing a indexOf( id ) - 1 won't work
> either because the user might change the gui settings in kcontrol so that
> KPopupMenu does not insert that tear-off item.
Using indexOf(id) to identify menu items is bad design IMHO. You should always work \
with id's and never rely on the index to identify menu items.
But as I said, it might be possible to "hide" the tear-off handles. I'm looking into \
this.
--
Matthias Elter
elter@kde.org
me@caldera.de
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic