Example for configuration dialog with qlistwidget and qstackedwidget ?
-
-
Thanks for your reply.
I was looking for an example like this:
QListWidget and QStackedWidget
I found an older example here:
https://www.tutorialspoint.com/pyqt/pyqt_qstackedwidget.htm -
@NonNT It looks rather like https://doc.qt.io/qt-5/qtabwidget.html
-
You had it correctly, the first time. The QStackedWidget will be used to switch between the various widgets that are related to the selection you have in the QListWidget.
In the example you have, the QTabWidget is part of the widget that that is related to the Kits. That "KitsWidget" is contained in the QStackedWidget.
-
@Denni-0 one example would be a configuration dialog which can be dynamically extended using plugins. Each plugin can provide its own configuration widget. In this case why should the dialog start fiddling with a QTabWidget ? Each configuration widget is that: one widget. The fact that it uses QTabWidget internally because it has several different aspects to configure or simply one QLineEdit is an implementation detail. Hence the combination of a QListView/Widget and a QStackedWidget which current index depends on the selected item in said QListView/Widget.
-
The idea behind a preference widget like shown here is that for each entry in the QListWidget, you have an independent widget shown. Hence the use of QStackedWidget. The fact that there might be a QTabWidget in one or more of these widgets is a technical detail. This allows you to design freely these widget without having to modify the dialog to fiddle with adding and removing tabs each time you click a different item in the list widget.