Results 1 to 4 of 4

Thread: QGraphicsView, QGraphicsScene and QGraphicsItem Problem :(

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2011
    Posts
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Re: QGraphicsView, QGraphicsScene and QGraphicsItem Problem :(

    Hey dennis81,

    thanks for ur reply

    now i have solced my problem and get a new one
    when i click on my scene then i get a debug output: "MainScene: Pressed". thats all right, but when i click now on a roundrectitem in the scene, then i get this output:
    "RoundRectItem: Pressed
    MainScene: Pressed"

    but i dont want that the scene gets an MousePressEvent, because i just want to "press" the RoundRectItem.
    How can i made this? do i need an eventFilter in the Scene?

    And another question i have:
    Is it better, when i make my own SceneItems like RoundRectitem, to inherit from QGraphicsItem or QGraphicsObject?

    I ask, because when i inherit from QGraphicsItem and QObject and want to Animate like move in x-direction, then i need to create a new Q_PROPERTY. But when i inherit from QGraphicsObejct, then i have more defined Propertys, which i can animate.

    Thanks for helping

    with best regards

    nudels

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android
    Thanked 342 Times in 324 Posts

    Default Re: QGraphicsView, QGraphicsScene and QGraphicsItem Problem :(

    How can i made this? do i need an eventFilter in the Scene?
    You can call event->accept() in rect item, and test if event->isAccepted() in scene mousePressEvent.
    About your second question, I think you answered it yourself - if inheriting from QGraphicsItem requires you to do more work, isn't it better to use QGraphicsObject ?

  3. The following user says thank you to stampede for this useful post:

    nudels (26th October 2011)

Similar Threads

  1. problem with QGraphicsScene\QGraphicsView
    By Wojtek_SZ in forum Qt Programming
    Replies: 4
    Last Post: 11th August 2011, 16:03
  2. QGraphicsView, QGraphicsItem, QGraphicsScene
    By Shuchi Agrawal in forum Newbie
    Replies: 10
    Last Post: 23rd March 2011, 21:50
  3. mouseMoveEvent problem in QGraphicsView/QGraphicsScene
    By Lendrick in forum Qt Programming
    Replies: 3
    Last Post: 23rd September 2010, 06:26
  4. weird problem in QGraphicsView / QGraphicsScene
    By Mrdata in forum Qt Programming
    Replies: 3
    Last Post: 24th November 2009, 20:26
  5. (QT4.2-RC1) QGraphicsScene QGraphicsView QGraphicsItem
    By antonio.r.tome in forum Qt Programming
    Replies: 1
    Last Post: 20th September 2006, 11:56

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
  •  
Qt is a trademark of The Qt Company.