Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[SOLVED] Help with reversing the functionality of QVBoxLayout
I know that adding widgets to _QVBoxLayout_ aligns the widgets vertically one after the other.
QVBoxLayout *vbl = new QVBoxLayout();
vbl->addWidget(label1, 0, Qt::AlignBottom);
vbl->addWidget(label2, 0, Qt::AlignBottom);
vbl->addWidget(label3, 0, Qt::AlignBottom);
This results in the labels being aligned in the following sequence
Now, if I want to start adding widgets from bottom to top so the sequence is like
How do I do it? I add widgets to the layout dynamically and I want them to be stacked one above the other. Please help!
EDIT: I just read about BottomToTop. Trying to figure out how to use it
Sorry guys. I figured out the answer minutes after posting this question. Anyway, for those who might need help to this question,
This will change the direction of the BoxLayout. "This":http://doc.qt.digia.com/stable/qboxlayout.html#Direction-enum should help for further information.
tzander last edited by
This looks like a 'rubber-duck' solution :P
Maybe you can change the topic of the first post to include '[Solved]' ?
b1gsnak3 last edited by
or you could have just added the labels with label3 first :) seems like a much easier solution (especially when you have more stuff in the layout)
[quote author="b1gsnak3" date="1360307539"]or you could have just added the labels with label3 first :) seems like a much easier solution (especially when you have more stuff in the layout[/quote]
That was not possible because I'll be adding the labels dynamically based on the user input. So they might layer in any order like label1, label2, label3 or label3, label1, label2 etc. I want this layer to happen from bottom to top so it looks like the labels are sitting at the bottom of the screen.
Bah! I know that was a horrible explanation of what I'm trying to do. Hope you could understand.
[quote author="Thomas Zander" date="1360306620"]This looks like a 'rubber-duck' solution :P[/quote]
I laughed so hard reading that link. I can't imagine myself talking to a rubber duck. Hahaha! :)