XML GUI Separator after ActionList

Albert Astals Cid aacid at kde.org
Sat Apr 12 13:05:03 BST 2008


Moving the discussion to k-c-d as it's about a bug on core libs. Please only 
answer to k-c-d

A Dissabte 12 Abril 2008, Joris Guisson va escriure:
> Hi,

Hi

>
> I'm putting some menus into XML for greater extendability, and have run
> into a problem. If you put a Separator after an ActionList, it will not be
> shown. For example the following code snippet :
>
>     <Menu name="GroupsSubMenu" icon="application-x-bittorrent"><text>Add to
> Group</text>
>         <ActionList name="view_groups_list" />
>         <Separator />
>         <Action name="view_add_to_new_group" />
>     </Menu>
>
> Results in the view_add_to_new_group action always following the
> view_groups_list ActionList, the separator is never shown. If you first put
> the action, then the separator and finally the action list, it is shown.
>
> So is this a bug or a feature ? I can understand hiding the separator when
> the list is empty, but it should be shown when it is not empty.

It's a bug, on build time when KXMLGUIBuilder sees the separator, the menu is 
empty because your action list is still empty, so thinks the separator is at 
the beginning and should not be added. 

This could be fixed inside xmlgui, but won't be easy.

On the other side, QMenu is already smart enough not to paint 
leading/trailing/repeated separators (see QMenuPrivate::filterActions) so i 
suggest just removing these checks from KXMLGUIBuilder::createCustomElement

Opinions?

Albert

>
> Joris,
>
> Btw, I'm using KDE 4.0.2


-------------- next part --------------
A non-text attachment was scrubbed...
Name: kxmlguibuilder.cpp.patch
Type: text/x-diff
Size: 663 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080412/e218cfdd/attachment.patch>
-------------- next part --------------
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


More information about the kde-core-devel mailing list