Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-36945

QLabel doesn't redraw correctly when setting an empty text, inside a layout with stretch

    XMLWordPrintable

Details

    Description

      When a QLabel is inside a QHBoxLayout with a stretch added before the label, it doesn't redraw correctly when doing setText("") it seems.

      I added a minimal C++ program to reproduce the bug. I tested it on Qt 5.0.2 and Qt 5.1.0, gcc, Ubuntu 13.10.

      Expected behavior: when timer fires, both labels are cleared.

      Actual behavior: only the second label is cleared. The first label appears unchanged. The first label gets cleared when its window gained focus.

      For the minimal example, using clear() instead works around the issue. In my real code, even that or doing update() after setting the text doesn't help, only redraw() does.

      StackOverflow thread with screenshots: http://stackoverflow.com/q/21890462/2085149

      Attachments

        1. main.cpp
          0.7 kB
        2. qtbug36945.zip
          1 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            the compiler Florian Bruhin
            Votes:
            4 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes