Here's my implementation of mousePressEvent:
{
if(event->button()==Qt::RightButton){
Owner owner(id);
owner.exec();
}
if(event->button()==Qt::LeftButton){
if(color == Qt::blue) color = Qt::red;
else color = Qt::blue;
}
}
void Node::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
if(event->button()==Qt::RightButton){
Owner owner(id);
owner.exec();
}
if(event->button()==Qt::LeftButton){
if(color == Qt::blue) color = Qt::red;
else color = Qt::blue;
}
}
To copy to clipboard, switch view to plain text mode
Owner inherits QInputDialog and Node inherits QGraphicsItem.
The problem is that when I click on the first item, everything is just fine. The item that was hit changes color and I make some input.
But when I click on any other item it doesn't change color. The first one does instead.
What could cause the trouble?
Bookmarks