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

New items added to a QGraphicsLayout are sometimes painted (at the wrong position) before layout activation

    XMLWordPrintable

Details

    Description

      When adding a newly created qgwidget* foo to a qglayout* bar via addItem, the layout bar schedules an activation by calling invalidate()
      However it may happen that foo->paint() is called by the scene while bar->isActivated() is still false, hence the item will be painted
      with the default sizes at the default position (0,0).
      After this, the layout bar gets activated and subsequently the widget foo is painted with the correct geometry.

      Calling bar->activate() after insertion solves the issue.
      It looks like a timing issue... adding too many qDebugs results in a drop in reproducibility.

      This is confirmed by some qDebug investigation on a easily reproducible usecase (unfortunately involving plasma device notifier from KDE)
      I am now trying to set up a pure qt usecase, although it doesn't seem to be trivial

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            smd Jan Arve
            wilderkde Jacopo De Simoi
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes