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

      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

        1. qtbug36945.zip
          1 kB
        2. main.cpp
          0.7 kB
        For Gerrit Dashboard: QTBUG-36945
        # Subject Branch Project Status CR V

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes