Qt6 topics merged with General

Problem with QTabWidget resizing @ runtime

  • Hi All,
    I would to like to Expand QTabWidget control where i have 4 tabs on it and i set the TabPosition as East.
    and i embedded the QtabWidget into the RightDockWidgetArea of DockWindow.

    Now where i try to Expand the tabWidegt , the Entire thing is getting expanded, but i want only the TabWidget content page alone expand, not the entire QDockWidget or the Tabs in TabWidget.

    Please let me know ur thoughts.. here is my code.
    Here the TestDlg has the QTabWidget control..

    Void CreateDockWindow()
    QDockWidget *dlgDock= new QDockWidget(this);
    TestDlg *tstDlg= new TestDlg;

        dlgDock->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
        addDockWidget(Qt::RightDockWidgetArea, dlgDock);


  • Now i have designed the TabWidget control from Qt designer instead of embedding into the dialog & then into the DockWidget.

    Now i am able to set the properties of each tab expand to fit into the size of the TabWidget..

    But i want to know ...how to expand the size of the TabWidget area at runtime from the mainWindow ..like what we do in Qt Designer..

Log in to reply