Hi all,
I am facing a problem when two QGraphicsItem movable items overlap on each other,
the overlapping surface of items is determined by the last QGraphicsView item added
to the QGraphicsScene. Say for example,
MainWindow:: MainWindow( QWidget *parent)
: QMainWindow(parent)
{
scene = new QGraphicsScene;
Shapes *Square= new Shapes; //where Shapes is subclass of QGraphicsItem
Shapes *Square1= new Shapes;
scene->addItem (square);
scene->addItem (square1);
triangle->setPos(0,0);
triangle1->setPos(100,60);
view = new QGraphicsView(scene); //make sure always pass the QGraphicsScene
view->setSceneRect(-400,-400,800,800);
setCentralWidget(view);
}
Please see the attached image, even when I try to move square1 on square2 in the overlapped area always the
square2 face will be exposed and square one will be hidden. Can somebody explain on how to solve this problem.
I mean to say the square which has the mouse press event should be the top surface when it is overlapping with another square.
Thanks in advance,
Prasanna Bhat
Bookmarks