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. [Solved] Strange problem with QGraphicsScene and a popup QDialog
Forum Update on Tuesday, May 27th 2025

[Solved] Strange problem with QGraphicsScene and a popup QDialog

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.4k 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.
  • S Offline
    S Offline
    stukdev
    wrote on 6 Dec 2012, 21:18 last edited by
    #1

    Hi, i create a QGraphicScene that have 3 object inside. This object is Service, the service is derived from PixmapItemAnimation, a simple QGraphicsPixmapItem with some animation. I want click on the Service object and open a QDialog.
    I use signal mousePressEvent from Service and connect to a slot servicePressed() on Home class. In the slot i use a qDebug() << id_service, to know what Service object is pressed. If i try click on it i correctly receive the id_service of the object. But if i open a QDialog and close. After a click on every zone of QGraphicScene generate a signal mousePressEvent with the latest id_service that have open the QDialog!!! It's incredible!
    If you have time look the source code... try this:
    1)click on object1 ...you get a normal id_service 1
    2)click object2 you get a QDialog...
    3) click on object1 or every zone of QGraphicScene...you get the previous QDialog!

    Someone can help me from this issue?
    Thank's

    this is the "zip file":https://www.dropbox.com/sh/htwdn3dy84ek5is/q24VStCphJ

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jake007
      wrote on 6 Dec 2012, 21:53 last edited by
      #2

      Hi!

      Looks like event is not processed correctly.

      If you change to:
      @void Service::mousePressEvent(QGraphicsSceneMouseEvent *event)
      {
      emit buttonPressed(id_service);

      PixmapItemAnimation::mousePressEvent(event);
      

      }@
      It'll work.

      Regards,
      Jake


      Code is poetry

      1 Reply Last reply
      0
      • S Offline
        S Offline
        stukdev
        wrote on 7 Dec 2012, 07:50 last edited by
        #3

        Thank's you Jake007 now works perfect!

        1 Reply Last reply
        0

        1/3

        6 Dec 2012, 21:18

        • Login

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