Important: Please read the Qt Code of Conduct -

Corruption when toggling visibility

  • Hi all,

    I'm developing an application for Maemo, and I'm experiencing a corruption issue with a QLabel. The situation: I have a QListView, displaying a header (QPushButton + QLineEdit) and some dynamic items. When no items other than the header are available, I fill the remaining space with a QLabel displaying an error message (getting this working properly "wasn't easy": Anyway, depending on the amount of items in my model, I toggle the visibility of the error QLabel and change the height of the QListView to size properly.

    The first time I fire up the widget, this works very well:
    ! QLabel displaying properly.)!

    After populating the QListView, the error QLabel gets hidden (label.setVisible(false)) and the QListView is expanded to the full window size:
    ! QLabel hidden, and QListView displaying some items.)!

    When however, I revisit the widget, after having deleted all the items in the QListView, reduced its size to the size of the header, and re-enabling the visibility of the error QLabel, I get to see some nice corruption:
    ! QLabel displaying corruption.)!

    Now, as soon as I drag the Xephyr window using Alt+LeftClick (I'm using Compiz compositing), the QLabel gets corrected instantly. However, I experience the exact same issue on my N900, where I have found no way of getting the QLabel redrawn properly.

    Could anyone shed some light on this issue? I tried repaint()ing, update()ing, calling show() before performing these actions (I currently execute these changes when the widget is not shown, to improve the user experience), but all in vain...

    Thanks in advance,

  • Nobody? I can't seem to work around this...

  • Did you try just destoying the label completely, and only creating it (again) when actually needed?

  • Re-creating the items within the layout obviously works, but is too much work, also for a workaround. However, I've found another way: forcing a redraw by quickly activating the progress indicator which is drawn on top of the visible space.

Log in to reply