what's the difference between QStackedLayout and QStackedWidget?
-
From the documentation
QStackedWidget can be used to create a user interface similar to the one provided by QTabWidget. It is a convenience layout widget built on top of the QStackedLayout class.
QStackedLayout
QStackedWidget -
Their APIs are different, although they share a lot of similarities. And one is a widget, while the other one is a layout.
-
It'd rather recommend to use the one that is more convenient for your GUI architecture. If you already have a layout in your GUI, then it is easier to instert a widget into it - in such case I would vote for using QStackedWidget.
As for ""efficiency" depends on what you are interested in. CPU load? RAM usage? Number of CPU cache hits? You'll have to benchmark both solutions to get definite answers. I do not know whether any of the two is "better". The documentation claims QStackedWidget is done on top of QStackedLayout, but it is not inheritance (those classes are not related).