Results 1 to 4 of 4

Thread: QGraphicsWidget vs. QGraphicsRectItem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2009
    Location
    Dundee, United Kingdom
    Posts
    18
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QGraphicsWidget vs. QGraphicsRectItem

    Hello,
    I've got a question concerning the QGraphicsWidget. I used QGraphicsRectItem before as a base class for MyRectangle class. Now I switched to QGraphicsWidget and as it seems the rectangles on the scene are ~4px above the expected position (as compared to QGraphicsRectItem)...
    Why is that? Is it possible to correct this situation?

    Thanks,
    Regards,
    Bill

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QGraphicsWidget vs. QGraphicsRectItem

    Why have you changed, because a QGraphics_XYZ_Item is in the most cases the better option since it is "lighter" than a QGraphicsWidget.

    QGraphicsWidget should be positioned like every other item but be aware of the widget's window frame margins and widget's contents margins.

  3. #3
    Join Date
    Jul 2009
    Location
    Dundee, United Kingdom
    Posts
    18
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QGraphicsWidget vs. QGraphicsRectItem

    Quote Originally Posted by Lykurg View Post
    Why have you changed, because a QGraphics_XYZ_Item is in the most cases the better option since it is "lighter" than a QGraphicsWidget.

    QGraphicsWidget should be positioned like every other item but be aware of the widget's window frame margins and widget's contents margins.
    Hi,
    I had to switch to QGraphicsWidget because I was struggling to draw a resize handle on my custom QGraphicsRectItem. I will only have around 10 items on the scene, so I think the performance should be ok...

    Thanks for your help, I'll try to investigate the QGraphicsProxyWidget properties.

    Regards,
    Bill

  4. #4
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QGraphicsWidget vs. QGraphicsRectItem

    i think its because of ContentsMargins of QGraphicsProxyWidget
    check this link
    http://doc.trolltech.com/4.5/qgraphicsproxywidget.html
    "Behind every great fortune lies a crime" - Balzac

Similar Threads

  1. Custom QGraphicsRectItem with size grip
    By Bill in forum Newbie
    Replies: 7
    Last Post: 23rd July 2009, 13:43
  2. QGraphicsRectItem and QGraphicsTextItem.
    By cydside in forum Qt Programming
    Replies: 13
    Last Post: 20th July 2009, 12:11
  3. QwebPage within a QGraphicsWidget
    By Osprey in forum Qt Programming
    Replies: 0
    Last Post: 16th June 2009, 17:32
  4. Question about QGraphicsRectItem
    By lni in forum Qt Programming
    Replies: 10
    Last Post: 28th January 2009, 21:58
  5. How can I use QGraphicsRectItem?
    By learning_qt in forum Qt Programming
    Replies: 3
    Last Post: 14th January 2009, 10:00

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.