Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Can't show text in menu separator.
QtWS25 Last Chance

Can't show text in menu separator.

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 2.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    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?

    kshegunovK 1 Reply Last reply
    0
    • ? A Former User

      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?

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by
      #2

      @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.

      Read and abide by the Qt Code of Conduct

      ? 1 Reply Last reply
      0
      • kshegunovK kshegunov

        @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.

        ? Offline
        ? Offline
        A Former User
        wrote on last edited by A Former User
        #3

        @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.

        kshegunovK 1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          ? 1 Reply Last reply
          0
          • ? A Former User

            @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.

            kshegunovK Offline
            kshegunovK Offline
            kshegunov
            Moderators
            wrote on last edited by
            #5

            @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.

            Read and abide by the Qt Code of Conduct

            1 Reply Last reply
            0
            • SGaistS SGaist

              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.

              ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #6

              @SGaist I tested my code on Windows 10

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved