Results 1 to 2 of 2

Thread: QGraphicsItem event->ignore()

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2007
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default QGraphicsItem event->ignore()

    I have a subclassed QGraphicsItem with a reimplemented mousePressEvent in which I only accept the event based on some logic(which works fine).

    The problem is the times when the item should not handle the mousePressEvent, due to my test. I call event->ignore, but the item is still the mousegrabber. And prevents me from selecting any other items. FYI, if the test fails I want the "scene" to be the mousegrabber if the test fails.

    In the documentation i read:
    If you call QEvent::ignore() on event, this item will lose the mouse grab, and event will propagate to any topmost item beneath. No further mouse events will be delivered to this item unless a new mouse press event is received.

    If there is no other item beneath, does the view/scene become the mousegrabber automatically?

    Thanks

  2. #2
    Join Date
    Jun 2007
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QGraphicsItem event->ignore()

    A "quick fix" that seem to work ok:
    If my test to select the item or not fails, I just call
    setEnabled(false);
    setEnabled(true);
    in the the mousePressEvent method.

    ^^

Similar Threads

  1. QGraphicsItem hover event
    By xgoan in forum Qt Programming
    Replies: 6
    Last Post: 4th January 2016, 16:08
  2. destruction of QGraphicsItem
    By killkolor in forum Qt Programming
    Replies: 2
    Last Post: 5th December 2009, 11:31
  3. Replies: 1
    Last Post: 16th October 2007, 23:41
  4. The event fired by the mouse click on the frame
    By Placido Currò in forum Qt Programming
    Replies: 8
    Last Post: 3rd March 2007, 10:05
  5. Workload in a QThread blocks main application's event loop ?
    By 0xBulbizarre in forum Qt Programming
    Replies: 14
    Last Post: 9th April 2006, 22:55

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.