Can't show text in menu separator.



  • I followed certain aspects of documentation menus example for action groups and tried to make an action group bounded by separators with some text shown in the separator above the group. The important lime of code looks like:

    menu->addSeparator()->setText("My title");
    

    My checks show that the action created by addSeparator() has the desired text. However, the displayed menu does not show this text on the screen. Am I missing something or things don't work as advertised?


  • Qt Champions 2016

    @LRaiz said:

    Am I missing something or things don't work as advertised?

    How are they advertised? For example here it says:

    Actions can be added to an action group using addAction(), but it is usually more convenient to specify a group when creating actions; this ensures that actions are automatically created with a parent. Actions can be visually separated from each other by adding a separator action to the group; create an action and use QAction's setSeparator() function to make it considered a separator. Action groups are added to widgets with the QWidget::addActions() function.



  • @kshegunov - The action group documentation shows a picture of a menu where a separator just before action group is displayed with text. The code implementing this group is taken from menus example . However when I follow code pattern, my separator does not show text.

    Creating a dummy action with some text, adding it to the action group, and calling setSeparator(true) does not display action text in the separator either.


  • Lifetime Qt Champion

    Hi,

    Which OS are you running on ? Depending on that you might not have the separator text shown. For example, on OS X 10.8.5, it's not.


  • Qt Champions 2016

    @LRaiz

    Creating a dummy action with some text, adding it to the action group, and calling setSeparator(true) does not display action text in the separator either.

    That's what I was trying to emphasize indeed, but as @SGaist remarked I may have jumped the gun.



  • @SGaist I tested my code on Windows 10


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.