Results 1 to 3 of 3

Thread: need advice for GraphicsItem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2012
    Location
    Iran, Tehran
    Posts
    308
    Thanks
    75
    Thanked 24 Times in 21 Posts
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default need advice for GraphicsItem

    I want some advice :

    I want to implement a Dial Component with Qt. I want to use a scene and add items(Dial components) to this scene. Here are my alternatives for choosing how implement items:
    1) Use a QGraphicsItem and draw each layer(needle,overlay,background,shadow,...) of Dial by painter->DrawPixmap.
    2) Use a QGraphicsObjec and use a scene onto it and draw each layer of Dial by QGraphicsPixmapItem.
    3) Use a QWidget and the rest is same as 2.

    Which of the above choice has best performance. Not that in first choice i dont know how to rotate a specific layer which i has drawn by painter->drawpixmap in paint method.

  2. #2
    Join Date
    Jan 2012
    Location
    Iran, Tehran
    Posts
    308
    Thanks
    75
    Thanked 24 Times in 21 Posts
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default Re: need advice for GraphicsItem

    Just to make it easy:
    what is a good way to show a dial(has moving part(needle)) in Qt not qml. Is it QGraphicsItem or QGraphicsObject?

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: need advice for GraphicsItem

    With the very small number of components you will have in this, it probably does not matter at all from a performance point of view which way you implement this. Probably QWidget is the simplest if you are implementing a component that you will put into other GUI layouts like a dialog.

    If you want to do this as a learning experience, fine. If you want something you can use immediately (or maybe an example for how someone else has done it), you could take a look at AnalogWidgets from the QtApps web site.

    Is it QGraphicsItem or QGraphicsObject?
    QGraphicsItem is more lightweight, and unless you need the needle to be able to emit signals or have slots, QGraphicsObject is overkill.

  4. The following user says thank you to d_stranz for this useful post:

    alizadeh91 (8th March 2012)

Similar Threads

  1. GraphicsItem is flickering
    By anafor2004 in forum Qt Programming
    Replies: 3
    Last Post: 30th September 2009, 11:44
  2. resize graphicsitem
    By rogerholmes in forum Newbie
    Replies: 2
    Last Post: 18th August 2009, 05:55
  3. GraphicsItem Question
    By cwnelatury in forum Qt Programming
    Replies: 8
    Last Post: 14th May 2009, 20:11
  4. Best way for a graphicsitem to delete itself
    By pherthyl in forum Qt Programming
    Replies: 7
    Last Post: 22nd June 2008, 05:57
  5. Positinoning in GraphicsScene without using GraphicsItem
    By salmanmanekia in forum Qt Programming
    Replies: 2
    Last Post: 16th June 2008, 07:11

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.