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

QGraphicsItem ordering on QGraphicsScene

    XMLWordPrintable

Details

    Description

      A it stands in documentation about QGraphicsItem::setZValue():
      "If you restore the Z value, the item's insertion order will decide its stacking order."

      But I noticed that if method setZValue() isn't called with proper value (so by default z=0) insertion ordering won't work properly.
      I've called removeItem() and addItem() methods randomly and sometimes the stack order changes insertion order to its own random order.

      Moreover, if QGraphicsScene uses BSP tree indexing algorithm it causes items flickering.

      Pleas take a look on code inside my attachement. ( I'm sorry for a very ugly code but I's in hurry - however the problem is not in this code - I was testing this bug for whole day ).
      and take a look on canvas.cpp file, line 113. If you comment this line you probably find that everything works OK. So for testing leave it uncommented.
      Furthermore add path to some image file on your local dir in canvas.cpp line 226

      Than follow these steps:
      1. click right btn -> add item -> polygon
      2. click on scene to add item.
      3. add one more polygon and move it.
      4. drag some image to the app.
      5. remove first polygon
      6. add new polygon.
      7. drag second image.

      On my computer I noticed that first image was moved to the bottom of the stack.

      Attachments

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

        Activity

          People

            vgt Eirik Aavitsland
            coder89 Łukasz Spas
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes