Example for configuration dialog with qlistwidget and qstackedwidget ?
-
wrote on 25 Oct 2019, 10:22 last edited by
Hi,
I'm looking for an example of how to develop a configuration dialog with qlistwidget and qstackedwidget.
Thanks
-
Hi,
I'm looking for an example of how to develop a configuration dialog with qlistwidget and qstackedwidget.
Thanks
-
wrote on 3 Nov 2019, 14:42 last edited by
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 -
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
-
wrote on 4 Nov 2019, 20:59 last edited by
-
wrote on 4 Nov 2019, 21:54 last edited by NonNT 11 Apr 2019, 22:03
Screenshot is the options dialog of Qt Creator.
Then its like this:
QVBoxLayout QHBoxLayout QVBoxLayout QLineEdit QListWidget | QTreeWidget QVBoxLayout QLabel QTabWidget | QStackedWidget QDialogButtonBox
-
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.