Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QGraphicsItem move layer



  • I found only two api: collidingItems() and stackBefore().
    collidingItems(A) do not contain A itself, so I can not use collidingItems.indexOf(A) to get the layer of A and then move layer.

    QList<QGraphicsItem*> collidingItems = scene->collidingItems(scene->selectedItems().first());
    collidingItems.at(i)->stackBefore(scene->selectedItems().first());
    

Log in to reply