Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QGraphicsItem mousepressevent not working with QMessageBox?
Forum Updated to NodeBB v4.3 + New Features

QGraphicsItem mousepressevent not working with QMessageBox?

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 534 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    buon43
    wrote on last edited by
    #1

    This is a really bizarre problem I am having. So, I have my custom QGraphicsItem. In that, I have MousePressEvent.

    @void myGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
    {
    engine->whatWasPressed(QString name_);
    }@

    Engine is another class and the name stands for the name of the QGraphicsItem. In the whatWasPressed function, I try setting up qDebug to see what was clicked. Fair enough, everything works. But then when I try calling for a QMessageBox in said function, everything seems to break. When I press another object again, it recognizes as if I had pressed the object that launched the QMessageBox. So, mousepressevent works when I simply debug the answers out, but if I call a QMessageBox, it doesn't work. I can only think of this being related to QMessagebox messing up the mousepressevent, since the message box is called kinda in the middle of the event, as the message box requires the user to press OK. So I have no idea how I could fix this. Any help?

    Edit: To clarify, I have four objects named triangle, square, line and circle. When I just check the names with qdebug, everything works. When I press circle, qdebug says circle. However if I set a message box, then the message box displays what I click, for instance square, but if I click anything after that, it still says I clicked square. Even the debugger says I click square after the message box has appeared once.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved