Insert different widgets listwidget or listview?
-
Hello i want to insert a few hundred widgets harnessing the drag and drop power qlistview/qlistwidget. But i read that setlistWidgetItem is really a bad idea for many items so i thought about using QStyledItemDelegate. However the widgets im inserting are rather complex, so defining an individual paint for all of them would be really really tedious. So here my question is there any better way or a way to automate the painting?
More info according to the widgets:
-they all slighly vary but in general its a qformlayout with:
"Label": Widget
"Label2": OtherWidget
.... and so onI want something like in QT Design Studio but with dragable modules:
-
@StudentScripter said in Insert different widgets listwidget or listview?:
However the widgets im inserting are rather complex, so defining an individual paint for all of them would be really really tedious
When you dont want to do this, another option might be creating your own layout/widget, where you can drag+move child widgets at runtime.
Like here
But there is also suggested to better use a model/view instead... so I guess it's still the best/cleanest solution. I mean, you just have to do it once, if all widgets are similar. -
@Pl45m4 But is creating widgets in layouts really more efficient than setlistwidgetItem()? I mean it still would be the same amount of widgets.
However could listwidget still be an option if just add all the widgets on startup to the listwidget and than just call remove() and reuse the widgets later? I guess that wouldn't be to taxating right?
Regarding the delegate, yes the widgets are similar but how to setup the paint event that flexible?
Also thank you for trying to help me. :) Have a nice day.
-
bumping this up. Anyone can hint me how to mass paint controls?