Search code examples
pythonpyqtpyqt5qt-designerqtabwidget

How to start project with TabWidget without QWidget


Everytime you create new project from Qt Creator there is on top QWidget which you can delete.

enter image description here

You can of course write the code manually as this:

app = QApplication(sys.argv)
ex = Main()
sys.exit(app.exec_())

where Main class is inherited from QTabWidget and everything works.

class Main(QTabWidget):

    def __init__(self):
        super().__init__()

Is there any way how to achieve this from Qt Designer? How can i delete QWidget and put QTabWidget on top of hierarchy?


Solution

  • When you create a GUI with Qt Designer you can choose the widget that you take as base as shown in the following image:

    enter image description here

    Generally we choose from the first option templates/forms, but we can also choose from Widgets (Second option)

    enter image description here

    In this second option we can choose as a basis for QTabWidget.

    enter image description here