How do we rearrange widgets added to a Grid Layout at runtime?
-
AFAIK using Grid Layout it can be done only manually (so you need to manually catch mode change and rearrange elements). Maybe QML is an option? It can be done slighlty easy there.
-
I can detect mode change. But how to rearrange the labels inside gridlayout. I couldn't locate any api for removing or rearranging the widgets added in the GridLayout.
QML is still in its early stages so don't want to try that now.
-
You can use two different layouts for landscape and portrait modes I think. No idea about other ways, I'm using qml for mobile UIs and it fits all my needs :).
-
If using two different layouts, how should we switch it. Can we hide a layout and all its controls.
-
-
I don't prefer that but still would like to know how to do that if that is possible.
-
Thank you, I was looking for something like QLayout::removeWidget(). I will try something like what you have suggested above.
Also is there any other better solution available for handling orientation change.
-
Have you seen this "blog":http://labs.qt.nokia.com/2009/02/26/animated-layouts-with-qt-kinetic/ entry from last year? I really would like ot see this functionality included into Qt but you might be able to get the code for this research project somewhere.
I am also interested in tracking this down. If I find it I'll post a comment on here too.
-
[quote author="QtK" date="1287741731"]Thank you, I was looking for something like QLayout::removeWidget()[/quote]
you could alternatively use QLayout::removeItem(), and then add them back with QLayout::addItem().. you probably already also know this by now :)