hi,
how is it possible to add new widgets at top in a grid layout? I like to fill it up dynamic, but after i add the first i would like to at the second at the row 1...
anybody an idea?
greez
hi,
how is it possible to add new widgets at top in a grid layout? I like to fill it up dynamic, but after i add the first i would like to at the second at the row 1...
anybody an idea?
greez
Does that mean you don't want to arrange them layout, one over the other?
Create the child widgets with parent (one which contains the layout), and don't add to layout.
Last edited by Santosh Reddy; 8th June 2011 at 19:06. Reason: updated contents
more in detail at the moment i have a list (vector) contains the objects. this list will be grow while the application runs. because i don't want to rearrange all the object in the layout i just add the last one:
Qt Code:
vector<Object> list = someObjects; for (int i = lastCount; i < list.size(); i++){ label->setText(list[i]->toString()); lastCount++; ui.view->repaint(); }To copy to clipboard, switch view to plain text mode
however i like to arrange them so:
third object
second object
first object
thx
Last edited by rouge; 8th June 2011 at 20:21. Reason: updated contents
This may not possible with QGridLayout, you need you write a custom Layout Manager.
Oee alternate way which you can try is to create all the QLabels upfront (with null strings), and populate the text, as the applciation gorws. (you should know the number of QLabels upfront). This is not a good practle solution though.
Have you tried simply adding new widgets to row 0 of the layout?
Yes i tried this...but its only override the first row...Have you tried simply adding new widgets to row 0 of the layout?
You better use QVBoxLayout, then you can use the insertWidget method
Thx for the help...the best way i find is to use a QTreeWidget.
Bookmarks