Autoresizing qtabwidget



  • hi,

    i would like to ask how it is possible to autoresize a qtabwidet in order to gain the empty space that it is created within each different tab page. I found this "example":http://doc.qt.digia.com/qq/qq06-qwidgetstack.html and i tried to ported to my code:

    @void MainWindow::currentChanged(int index)
    {
    const QSizePolicy ignored(QSizePolicy::Ignored, QSizePolicy::Ignored);
    const QSizePolicy preferred(QSizePolicy::Preferred, QSizePolicy::Preferred);

    if (index == ui->tabWidget->indexOf(ui->tab)) {
        ui->tab->setSizePolicy(preferred);
        ui->tab_2->setSizePolicy(ignored);
        ui->tab_3->setSizePolicy(ignored);
    } else if(index == ui->tabWidget->indexOf(ui->tab_2)){
        ui->tab->setSizePolicy(ignored);
        ui->tab_2->setSizePolicy(preferred);
        ui->tab_3->setSizePolicy(ignored);
    } else if(index == ui->tabWidget->indexOf(ui->tab_3)){
        ui->tab->setSizePolicy(ignored);
        ui->tab_2->setSizePolicy(ignored);
        ui->tab_3->setSizePolicy(preferred);
    }
    
    ui->dockWidget->layout()->activate();
    

    // ui->tabWidget->setFixedSize(minimumSizeHint());
    }@

    This works fine for the vertical space but not for the horizontal one. How i can make it work for the horizontal space as well?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.