Important: Please read the Qt Code of Conduct -

Set Width of a QWidget

  • Hi, Currently I returned to develop the app that I started two years ago. I am finishing the infrastructure but the UI has some issue that I want to fix.

    I have been reading a lot these days but I am a little bit lost.

    I am tryint to adjust te size of a tabWidget using the size of a Qtablewidget that I have inside one tab, but always the size goes to (0.0), 'm trying something like that:

    void MainWindow::on_tabWidget_tabBarClicked(int index)
    QSize s;
    switch (index) {
    case 2:
    s = ui->rmTableWidget->size();
    s = ui->tabWidget->size();

    Could someone tell me how I could set that size.

    Thank you very much in advanced.

  • Moderators

    Use layouts, then UI will automatically adjust sizes of all elements.

Log in to reply