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. Problem with text eliding on QToolButtons since Qt5.12 when text spans multiple lines
Forum Updated to NodeBB v4.3 + New Features

Problem with text eliding on QToolButtons since Qt5.12 when text spans multiple lines

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 4 Posters 1.0k Views 2 Watching
  • 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.
  • gde23G Offline
    gde23G Offline
    gde23
    wrote on last edited by
    #1

    I have some problem with the elided text behaviour since Qt5.12.

    Following example which is just a QToolButton with a 2-lined text and an icon.

        QToolButton* button = new QToolButton(parent);
        button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        button->setFixedWidth(100);
        button->setFixedHeight(200);
        button->setIconSize(QSize(50, 50));
        QIcon icon = style()->standardIcon(QStyle::SP_ComputerIcon);
        button->setIcon(icon);
        button->setText("TestTest\nTestTest");
        centralWidget()->layout()->addWidget(button);
    

    The result looks like this:

    alt text

    It seems that the function to check if the text fits the button test against the whole string and then replaces the \n with ... which results in a text that does not fit the button although the text would fit, if just the newline would be applied as intended.

    For some reason the problem only appears for buttons that have an icon set.

    Is there some way to disable the eliding completely?

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

      Hi,

      What OS are you running on ?

      Can you provide the full sample code to reproduce this ?

      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
      • gde23G Offline
        gde23G Offline
        gde23
        wrote on last edited by gde23
        #3

        The system is Debian Stretch with KDE and Qt5.12

        Minimal working example see here

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

          Can't reproduce that on macOS.

          Can you test if you get the same result with your Debian provided Qt ?

          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
          1
          • mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi
            Windows 10, Qt5.12
            alt text

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

              It's https://bugreports.qt.io/browse/QTBUG-72226
              But for multi-line texts the issue still remains. Will need to fix it :(
              It's a pity that every item is using it's own drawing stuff instead a common one (I fixed such issues for QTable/Tree/List items some times ago in another place...)

              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
              • Christian EhrlicherC Offline
                Christian EhrlicherC Offline
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on last edited by
                #7

                for reference and if someone wants to test it: https://codereview.qt-project.org/#/c/248836/

                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
                1

                • Login

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