Get element in Qgridlayout
I have a question about accessing items in a Qlayout like Qgridlayout, vertical layouts and horizontal layouts...
Well the item I put inside the layout is:
class CardGui : public QToolButton
I'm planning to make a card list... And having access to the elements could be important then.
There is a function itematposition which returns a QLayoutItem.
How can I change this to my CardGui button... with a dynamic cast or could it be something more complex?
Or Am I doing this wrong?
Thx in advance,
Re: Get element in Qgridlayout
QLayoutItem widget() method looks like it does what you need, but i never used it so you should test it and see if it helps.
Another way is to keep pointers to CardGui into some data structure (like QVector<CardGui*> or if you like QVector<QVector<...) this won't be such and overhead and you can then access every widget very easy.