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. QComboBox bug in Qt5.15
Forum Updated to NodeBB v4.3 + New Features

QComboBox bug in Qt5.15

Scheduled Pinned Locked Moved Unsolved General and Desktop
25 Posts 7 Posters 3.3k Views 4 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.
  • S sjlee

    @JonB
    FYI, You can capture image for combobox popup using gimp (File > Create > Screenshot). You are unable to capture using the PrtScrn key since the combobox grabbed the keyboard focus.

    JonBJ Online
    JonBJ Online
    JonB
    wrote on last edited by JonB
    #15

    @sjlee
    I installed gimp. Maybe you can make it work, I can't, at best I get a black rectangle captured for the combo box! I think/hope you can manage without a screenshot from my explanation, maybe you can reproduce same (if you use same default fonts/sizes etc. as I get).

    1 Reply Last reply
    0
    • S sjlee

      @ChrisW67

      Please try your code with "landscape & this" and "portrait & this" items instead of ro/rw. I mean longer string than its width.

      Thank you.

      C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #16

      @sjlee said in QComboBox bug in Qt5.15:

      @ChrisW67

      Please try your code with "landscape & this" and "portrait & this" items instead of ro/rw. I mean longer string than its width.

      Thank you.

      @sjlee You mean text that is longer than the combo box width, like "Text that is too long" that you already have an example of? How about you provide your code that demonstrates the alleged bug.

      1 Reply Last reply
      2
      • JonBJ JonB

        @ChrisW67
        I too have Qt 15.5.3. I am under Ubuntu 22.04, with GNOME desktop. I think you are different because of the "X" in the top left of your combo, I do not get this, I think you are using a different window manager?

        You will have to bear with my explanations, because I cannot figure how to take screen shots with a combo dropped down :(

        I do not get the behaviour you show with your code. When the "Text that ..." is added I get no ellipsis, instead the whole line is shown but with the dropped-down portion being allowed to be wider than the combo box width, so it sticks out right below. Just saying.

        @sjlee
        Your instructions are most unclear as to exactly what you want the whole thing changed to. I won't go through all the combinations I tried as to what precisely you might mean, they behave in various ways. However, I did come across one oddity which just might be a clue to what is going on and the oddity of &. Try exactly this:

        int main(int argc, char **argv)
        {
            QApplication app(argc, argv);
        
            QComboBox *cb1 = new QComboBox();
            cb1->addItem(QStringLiteral("portrait & this"));
            cb1->show();
        
            QTimer::singleShot(5000, [=]() { cb1->addItem(QStringLiteral("landscap & this")); } );
            return app.exec();
        }
        

        Note that my landscap [sic.] is deliberately written like this. Now when I do this if you look very closely at the appended item I see

        landsc..._this
        

        The space before this is an underlined space. That implies [to me] that at some level Qt is treating the & [ampersand followed by space] as shortcut indicator, not a literal ampersand. And my guess is that somewhere in the ellipsisation code this "incorrect interpretation" is made. But not always, because it does not happen in other cases, e.g. landscape & this shows as landsca...& this, no shortcut. Maybe something like "if & is the last character "chopped off" by inserting ellipses then it incorrectly treats the following, preserved character as having been marked as a shortcut by the removed & preceding it".

        I don't know whether this helps! But maybe there is indeed some special treatment of & going on here, only showing up under special circumstances?

        C Offline
        C Offline
        ChrisW67
        wrote on last edited by
        #17

        @JonB said in QComboBox bug in Qt5.15:

        I too have Qt 15.5.3. I am under Ubuntu 22.04, with GNOME desktop. I think you are different because of the "X" in the top left of your combo, I do not get this, I think you are using a different window manager?

        @JonB
        It is KDE (so kwin). It's a pain in the backside to capture the open combo box there also. With a standalone combo box the window manager will have input into size constraints and the constraint it imposes here causes text to elided. In the OP's screen shot the size of the combo box is constrained to some degree by the table cell the delegate is opening it over, and by the options set, and text is elided. This is exactly what was shown in the OP's opening screen shot. The ampersand was completed elided and there was no errant underline.

        The oddity you noticed with the ampersand I will try to reproduce when I am back at my Linux box.

        C 1 Reply Last reply
        1
        • C ChrisW67

          @JonB said in QComboBox bug in Qt5.15:

          I too have Qt 15.5.3. I am under Ubuntu 22.04, with GNOME desktop. I think you are different because of the "X" in the top left of your combo, I do not get this, I think you are using a different window manager?

          @JonB
          It is KDE (so kwin). It's a pain in the backside to capture the open combo box there also. With a standalone combo box the window manager will have input into size constraints and the constraint it imposes here causes text to elided. In the OP's screen shot the size of the combo box is constrained to some degree by the table cell the delegate is opening it over, and by the options set, and text is elided. This is exactly what was shown in the OP's opening screen shot. The ampersand was completed elided and there was no errant underline.

          The oddity you noticed with the ampersand I will try to reproduce when I am back at my Linux box.

          C Offline
          C Offline
          ChrisW67
          wrote on last edited by
          #18

          @JonB Whatever that behaviour is, it is sensitive to the environment. This is what your code does by default in my KDE environment:

          4b979957-5722-47c8-b2ff-ef2ea88ddebf-image.png

          If I subsequently narrow the window as much as the window decorations allow:
          4cc3555d-e33e-4f8e-9f89-77b98d123932-image.png
          Note, no spurious underscore. I fiddled a bit but could not reproduce it (Fusion or Windows style). Qt 6.4.2 did something different again

          JonBJ 1 Reply Last reply
          0
          • C ChrisW67

            @JonB Whatever that behaviour is, it is sensitive to the environment. This is what your code does by default in my KDE environment:

            4b979957-5722-47c8-b2ff-ef2ea88ddebf-image.png

            If I subsequently narrow the window as much as the window decorations allow:
            4cc3555d-e33e-4f8e-9f89-77b98d123932-image.png
            Note, no spurious underscore. I fiddled a bit but could not reproduce it (Fusion or Windows style). Qt 6.4.2 did something different again

            JonBJ Online
            JonBJ Online
            JonB
            wrote on last edited by
            #19

            @ChrisW67
            For one, thing you are using both a different font and a different window-look. Understandably. I can only suggest if you want to try to replicate mine, you find a string such that Qt puts ellipsis into it to shorten and the last character of what was removed is the & character. So the eliding produces abc... def from what used to be something like abc123 & def.

            Meanwhile I might be more confident about producing a screen shot from a dropped-down combo so will have another go at producing that for pasting soon :)

            1 Reply Last reply
            1
            • K Offline
              K Offline
              kkyzivat
              wrote on last edited by
              #20

              For what it's worth, I am also seeing this strange behavior, and it seems to not relate to text eliding in the contained QAbstractItemView, either that, or the QAbstractItemView is ignoring my setTextElideMode(Qt::ElideNone) call.

              The project in question I am working with is apitrace, and I can reproduce this behavior in the app build, but not in just a standalone example showing just the dialog that contains this combo box.

              The & is replaced with ... even when I call combo->view()->setTextElideMode(Qt::ElideNone).

              This occurs for me in Qt 5.15.14, and Qt 6.5.1.

              To see my attempts to reproduce the issue outside of qapitrace, and to explain how to reproduce this in qapitrace, clone this small repo and follow the README.md:
              https://github.com/keithel/qapitrace-combobox-elide-bug

              Christian EhrlicherC K 2 Replies Last reply
              0
              • K kkyzivat

                For what it's worth, I am also seeing this strange behavior, and it seems to not relate to text eliding in the contained QAbstractItemView, either that, or the QAbstractItemView is ignoring my setTextElideMode(Qt::ElideNone) call.

                The project in question I am working with is apitrace, and I can reproduce this behavior in the app build, but not in just a standalone example showing just the dialog that contains this combo box.

                The & is replaced with ... even when I call combo->view()->setTextElideMode(Qt::ElideNone).

                This occurs for me in Qt 5.15.14, and Qt 6.5.1.

                To see my attempts to reproduce the issue outside of qapitrace, and to explain how to reproduce this in qapitrace, clone this small repo and follow the README.md:
                https://github.com/keithel/qapitrace-combobox-elide-bug

                Christian EhrlicherC Offline
                Christian EhrlicherC Offline
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on last edited by
                #21

                @kkyzivat if you have a simple reproducer then please create a bug report and post the link here.

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

                K 1 Reply Last reply
                0
                • Christian EhrlicherC Christian Ehrlicher

                  @kkyzivat if you have a simple reproducer then please create a bug report and post the link here.

                  K Offline
                  K Offline
                  kkyzivat
                  wrote on last edited by kkyzivat
                  #22

                  @Christian-Ehrlicher
                  Oh, of course. I just haven't gotten there yet. Simple reproducer doesn't seem to be reproducing the issue (though I am using a different Qt build, one part of Pypi Qt for Python build). I should just rewrite my reproducer in C++ to test apples to apples.

                  I find writing these simple reproducers in Python is often quicker.

                  Christian EhrlicherC 1 Reply Last reply
                  0
                  • K kkyzivat

                    @Christian-Ehrlicher
                    Oh, of course. I just haven't gotten there yet. Simple reproducer doesn't seem to be reproducing the issue (though I am using a different Qt build, one part of Pypi Qt for Python build). I should just rewrite my reproducer in C++ to test apples to apples.

                    I find writing these simple reproducers in Python is often quicker.

                    Christian EhrlicherC Offline
                    Christian EhrlicherC Offline
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    wrote on last edited by
                    #23

                    @kkyzivat said in QComboBox bug in Qt5.15:

                    I find writing these simple reproducers in Python is often quicker

                    Maybe, but it makes debugging for the dev harder as he has to create a c++ test case in most cases first. So providing a small c++ reproducer will likely result in an earlier bugfix.

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

                    K 1 Reply Last reply
                    0
                    • Christian EhrlicherC Christian Ehrlicher

                      @kkyzivat said in QComboBox bug in Qt5.15:

                      I find writing these simple reproducers in Python is often quicker

                      Maybe, but it makes debugging for the dev harder as he has to create a c++ test case in most cases first. So providing a small c++ reproducer will likely result in an earlier bugfix.

                      K Offline
                      K Offline
                      kkyzivat
                      wrote on last edited by
                      #24

                      @Christian-Ehrlicher Yeah - I often will rewrite it in C++ before attaching.

                      1 Reply Last reply
                      1
                      • K kkyzivat

                        For what it's worth, I am also seeing this strange behavior, and it seems to not relate to text eliding in the contained QAbstractItemView, either that, or the QAbstractItemView is ignoring my setTextElideMode(Qt::ElideNone) call.

                        The project in question I am working with is apitrace, and I can reproduce this behavior in the app build, but not in just a standalone example showing just the dialog that contains this combo box.

                        The & is replaced with ... even when I call combo->view()->setTextElideMode(Qt::ElideNone).

                        This occurs for me in Qt 5.15.14, and Qt 6.5.1.

                        To see my attempts to reproduce the issue outside of qapitrace, and to explain how to reproduce this in qapitrace, clone this small repo and follow the README.md:
                        https://github.com/keithel/qapitrace-combobox-elide-bug

                        K Offline
                        K Offline
                        kkyzivat
                        wrote on last edited by
                        #25

                        Ok - this seems to actually be a bug in Qt introduced in Qt 5.15.3 - however it is resolved some time between Qt 6.0.0 and 6.5.1.

                        I retested with Qt 6.5.1, and it seems not to reproduce there.

                        The bug shows up in Qt 5.15.3, but not in Qt 5.15.2 and not in Qt 6.5.1.

                        Given this, it isn't worth making a bug report about it, since it is already fixed in Qt 6.

                        If anyone reading this is interested to test, I have updated my bug exploration repo with this new info:
                        https://github.com/keithel/qapitrace-combobox-elide-bug

                        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