XML GUI Separator after ActionList

David Faure faure at kde.org
Mon Apr 14 10:26:01 BST 2008


On Saturday 12 April 2008, Albert Astals Cid wrote:
> 
> 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. 

Yep. This bug was in kde3 too, then.

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

Agreed.
Unit test written, problem confirmed, patch committed.

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kde-core-devel mailing list