Results 1 to 3 of 3

Thread: Custom objects in a QGraphicScene

  1. #1
    Join Date
    Jul 2007
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Custom objects in a QGraphicScene

    Hi there,
    I am trying to create some custom objects and use them in a GraphicScene
    The objects should have some editable text boxes which should allow setting some of the parameters of the object. The only thing I saw appropriate for this would be QGraphicsTextItem.

    My question is:
    - could I have more complex stuff in a GraphicsItem like comboBoxes, LineEdits or other advanced editable objects? How could I include this stuff in QGraphicsItem?


    Cheers

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Custom objects in a QGraphicScene

    I am trying to create some custom objects and use them in a GraphicScene
    The objects should have some editable text boxes which should allow setting some of the parameters of the object. The only thing I saw appropriate for this would be QGraphicsTextItem.
    You should subclass QGraphicsItem and do everything in there. Maybe this should be an item group, containing a text item and possibly something else, depending on what you need.

    My question is:
    - could I have more complex stuff in a GraphicsItem like comboBoxes, LineEdits or other advanced editable objects? How could I include this stuff in QGraphicsItem?
    There has been an attempt:
    http://labs.trolltech.com/blogs/2007...s-and-widgets/

    But my guess is you should make your own items that behave that way. For example, like a combo box.
    This way you could really customize their look&feel very easy, since it's all a matter of drawing something in the right place.

    Regards

  3. #3
    Join Date
    Jul 2007
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Custom objects in a QGraphicScene

    Yes, sub classing QGraphicsItem is what I'm doing anyway ...but it is just not enough
    I think it all comes down to displaying QWidgets on the scene. Following your link I stumbled upon http://labs.trolltech.com/page/Proje...Graphics_Items which mostly summarizes my problem.
    If you know more about this issue or have other example of such implementations I would really appreciate the help

    Thanks for the link!

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.