[SOLVED] QGraphicsScene Question



  • I have a question about the QGraphicsScene. I have a scene that contains various custom items. It is becoming increasingly more difficult to manage and position the various items in the scene as I add more items. My question is how do I create an object that contains other objects. For example, my application can be grouped into separate components, each containing various objects. I would like to create these components as a separate class, then add them to the scene.

    To be more precise, I have QGraphicsItems for directional arrows and rectangle items that slide back and forth between the arrows. The arrows signal the sliding animation. The rectangles can be selected. I call this my panel slider.

    Rather than adding each item to the scene
    scene->addItem(item x)

    I would like to be able to be able to
    scene->addItem(panel slider)

    I am fairly new to C++ and Qt. I am learning a ton from this forum and the Qt help directory. I think this has to do with parenting but im still learning how to use this concept as I mostly do embedded programming in C. Thanks for your advice



  • Hello Jadams1211, welcome to Qt-Project forums :)

    maybe this will help You: "Robot example":http://qt-project.org/doc/qt-5.0/qtwidgets/graphicsview-dragdroprobot.html ?

    with best regards,
    Robert



  • Thank you Robert.

    The robot example provided the answer I was looking for, and much much more.

    I love the Qt documentation!



  • Pls edit your topic name to include "SOLVED" :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.