QMenu addSection Not Showing



  • Is there any reason why the addSection function of a QMenu would have no effect?

    For example, the following code:

    QMenu menu;
    menu.addSection("Connected");
    menu.addAction("None");
    menu.addSeparator();
    menu.addSection("Available");
    menu.addAction("None");
    menu.addSeparator();
    menu.addAction("Quit");
    

    Results in a menu with just the actions and separators visible.


  • Lifetime Qt Champion

    Hi,

    From the documentation from addSection:

    The rendering of the hint is style and platform dependent. Widget styles can use the 
    text information in the rendering for sections, or can choose to ignore it and render 
    sections like simple separators.
    


  • @SGaist thanks for the clarification - so I can presume then, that Windows does not render these sections. Thanks again.


Log in to reply
 

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