Qt 6.11 is out! See what's new in the release
blog
Connect dynamically created QGraphicsItem to parent
General and Desktop
6
Posts
2
Posters
1.6k
Views
1
Watching
-
Hi all,
I look for a way to connect QGraphicsItems to its parent by Signal/Slot. I believe I can inherit from QOject, to produce signals.
But my QGraphicsItems are dynamically created.
- The first problem is that I haven't found the method to create any dynamically array of QGraphicsItem derived class,
- and how to connect to its parent please ???
Thanks in advance ;)
-
Hi and welcome to devnet,
You might be interested by "QGraphicsObject":http://doc.qt.io/qt-5/QGraphicsObject.html
- You have to create them all and add them to your array
- The children should not be responsible of the connection, they should only emit signals so you can change easily what is connected to that signal.
Hope it helps
-
The post size have a limit. Did you try to paste a big chunk of code ?
Is something like
@QVector<QObject *> myStorage;@
What you have in mind ? -
No it's not, QObject is not copyable