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. What does the ellipsis (...) mean in the text QString of QAction objects?

What does the ellipsis (...) mean in the text QString of QAction objects?

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 4 Posters 941 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.
  • Y Offline
    Y Offline
    Yuta
    wrote on last edited by
    #1

    Hello forums,

    I have seen example Qt source code where QActions are created with text strings that terminate with an ellipsis (...):

    QAction *openAct = new QAction(tr("&Open...", this));
    

    In the above example, I know that the actual text shown for this action will be simply "Open", with the ampersand (&) and ellipsis (...) omitted.

    I understand that the ampersand which precedes the letter "O" means that the keyboard shortcut for this action will be set to alt+O.

    However, I am still unsure what the ellipsis at the end means and what its function is. What does it do? Will setting the QAction's text string to "&Open" be any different from setting it to "&Open..."?

    Thank you very much guys!

    1 Reply Last reply
    0
    • nageshN Offline
      nageshN Offline
      nagesh
      wrote on last edited by
      #4
      Ah– I thought that the ellipsis would be ignored when displaying the text. This is why I think this:
      

      If you want QAction to display .eliipsis(...), You can override this behavior by setting a specific description with setText().

      But in any case, why would you put an ellipsis at the end of the descriptive text of the action anyways?
      

      Qt creator do have it in File menu as "New File or Project ..."
      What I feel is when intended description of action implies "many formats or multiple options and further input is required " then descriptions text can contain ellipsis(...)

      As discussed in this post usage of ellipsis is based on GUI guidelines
      https://stackoverflow.com/questions/637683/when-to-use-ellipsis-after-menu-items#:~:text=When it appears in the,associated operation can be performed.

      Does it serve some function? (like how the ampersand indicates alt-key shortcuts?)
      

      It's simply the text which following some GUI guidelines, unlike ampersand.

      Y 1 Reply Last reply
      2
      • Christian EhrlicherC Online
        Christian EhrlicherC Online
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #2

        @Yuta said in What does the ellipsis (...) mean in the text QString of QAction objects?:

        I know that the actual text shown for this action will be simply "Open", with the ampersand (&) and ellipsis (...) omitted.

        This is wrong - it shows what tr("&Open...") returns for your loaded translator and it looks like it returns '&Open'.

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        Y 1 Reply Last reply
        0
        • Christian EhrlicherC Christian Ehrlicher

          @Yuta said in What does the ellipsis (...) mean in the text QString of QAction objects?:

          I know that the actual text shown for this action will be simply "Open", with the ampersand (&) and ellipsis (...) omitted.

          This is wrong - it shows what tr("&Open...") returns for your loaded translator and it looks like it returns '&Open'.

          Y Offline
          Y Offline
          Yuta
          wrote on last edited by
          #3

          @Christian-Ehrlicher Thank you for your reply!

          Ah– I thought that the ellipsis would be ignored when displaying the text. This is why I think this:

          From QAction docs:

          The action uses a stripped version of text (e.g. "&Menu Option..." becomes "Menu Option") as descriptive text for tool buttons.

          But in any case, why would you put an ellipsis at the end of the descriptive text of the action anyways? Does it serve some function? (like how the ampersand indicates alt-key shortcuts?)

          W 1 Reply Last reply
          0
          • nageshN Offline
            nageshN Offline
            nagesh
            wrote on last edited by
            #4
            Ah– I thought that the ellipsis would be ignored when displaying the text. This is why I think this:
            

            If you want QAction to display .eliipsis(...), You can override this behavior by setting a specific description with setText().

            But in any case, why would you put an ellipsis at the end of the descriptive text of the action anyways?
            

            Qt creator do have it in File menu as "New File or Project ..."
            What I feel is when intended description of action implies "many formats or multiple options and further input is required " then descriptions text can contain ellipsis(...)

            As discussed in this post usage of ellipsis is based on GUI guidelines
            https://stackoverflow.com/questions/637683/when-to-use-ellipsis-after-menu-items#:~:text=When it appears in the,associated operation can be performed.

            Does it serve some function? (like how the ampersand indicates alt-key shortcuts?)
            

            It's simply the text which following some GUI guidelines, unlike ampersand.

            Y 1 Reply Last reply
            2
            • nageshN nagesh
              Ah– I thought that the ellipsis would be ignored when displaying the text. This is why I think this:
              

              If you want QAction to display .eliipsis(...), You can override this behavior by setting a specific description with setText().

              But in any case, why would you put an ellipsis at the end of the descriptive text of the action anyways?
              

              Qt creator do have it in File menu as "New File or Project ..."
              What I feel is when intended description of action implies "many formats or multiple options and further input is required " then descriptions text can contain ellipsis(...)

              As discussed in this post usage of ellipsis is based on GUI guidelines
              https://stackoverflow.com/questions/637683/when-to-use-ellipsis-after-menu-items#:~:text=When it appears in the,associated operation can be performed.

              Does it serve some function? (like how the ampersand indicates alt-key shortcuts?)
              

              It's simply the text which following some GUI guidelines, unlike ampersand.

              Y Offline
              Y Offline
              Yuta
              wrote on last edited by
              #5

              @nagesh Thank you for your reply– understood. So it's an UI convention/guideline as opposed to some programmatic thing. Appreciate the answer and links :)

              1 Reply Last reply
              0
              • Christian EhrlicherC Online
                Christian EhrlicherC Online
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on last edited by
                #6

                The documentation is a little bit weak here.
                The action's text stays &Open... but when the action is used for a QToolButton then the text for QToolButton is retrieved from QAction::iconText() which really strips away the ampersand and three ... if you did not call QAction::setIconText() with something else before. See https://code.woboq.org/qt5/qtbase/src/widgets/kernel/qaction.cpp.html#_ZNK7QAction8iconTextEv

                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                Visit the Qt Academy at https://academy.qt.io/catalog

                1 Reply Last reply
                3
                • Y Yuta

                  @Christian-Ehrlicher Thank you for your reply!

                  Ah– I thought that the ellipsis would be ignored when displaying the text. This is why I think this:

                  From QAction docs:

                  The action uses a stripped version of text (e.g. "&Menu Option..." becomes "Menu Option") as descriptive text for tool buttons.

                  But in any case, why would you put an ellipsis at the end of the descriptive text of the action anyways? Does it serve some function? (like how the ampersand indicates alt-key shortcuts?)

                  W Offline
                  W Offline
                  wrosecrans
                  wrote on last edited by
                  #7

                  @Yuta said in What does the ellipsis (...) mean in the text QString of QAction objects?:

                  But in any case, why would you put an ellipsis at the end of the descriptive text of the action anyways? Does it serve some function?

                  It's just a convention that implies a menu entry will open a dialog box. It's a hint to the user, not something the API cares about. Like, "Open..." will trigger a file requester dialog. But "Bold" will just make the selected text bold with no additional interaction. Look at a lot of the apps you use, and you'll see the pattern now that you know what to look for.

                  1 Reply Last reply
                  4

                  • Login

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