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

QLabel::setText() overwrites previously displayed text

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P1: Critical
    • None
    • 6.2.2
    • None
    • Linux/Wayland, macOS

    Description

      QLabel::setText overwrites the previously displayed text when the text is updated:

      QLabels above are added on a form in Qt designer and then added onto one tab of a QTabWidget at runtime.  The text overwrite is not visible when the the tab / form is first displayed, but when navigating back from another tab or just updating the label values.

      Result is consistent on MacOs and Linux.  Have not tried on Windows.

      Have tried using QLabel::clear() and QLabel::repaint() before QLabel::setText() without success.

      ----------------------------------------------------------------------------Added later

      Minimal Example:
      Please find attached.

      Cause:
      Re-adding a Form into the same cell of a QGridLayout, without first deleting the previous previous Form, causes the new Form to overwrite the previous Form (causing the updated label text to be overwritten).

      Expected:
      Would be ideal if the cell area can be reset to the background color before a new form (forms have transparent backgrounds by default) is displayed in the cell area. Failing which, it would be nice if this behavior was documented, possibly as part of the QGridLayout::addWidget() method.

      Attachments

        1. form.ui
          0.6 kB
        2. LabelTextOverwrite.png
          LabelTextOverwrite.png
          30 kB
        3. main.cpp
          0.2 kB
        4. mainwindow.cpp
          2 kB
        5. mainwindow.h
          0.8 kB
        6. overwrite.pro
          0.1 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            myk Michael Arnold
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes