Search code examples
qtqwidget

Show a QT UI in another one


I have a project including 3 UI files: win_main.ui, win_table.ui and win_table2.ui.

I want to show one of them inside of win_main.ui, and with a button, change them. I mean, there is a Box containing win_table.ui, and when I clicked the button, the box will change to win_table2.ui.

Example

I tried using QWidget, QQuickWidget, but they didn't worked.

Is it possible ? If yes, how ?


Solution

  • Try using a QTabWidget. You can flip between tables using tabs.

    QTabWidget layout

    If there is a specific reason why you wouldn't want win_table2.ui showing before a button is pressed, you can disable that tab programmatically until it is ready. You can also flip between which tab is currently showing using code as well.