How to switch on and off tab pages in runtime



  • Hi, all!

    in my application I have a tabWidget with some tabs, created in qtcreator. In a settings dialog the user can select the tabs he wants to be visible in various situations. I write this values with QSettings and read them each time, when the application starts. To remove the tabs is not such a big task with, for example

    @ui->tabWidget_ItemDetails->removeTab(3);@

    but I fail when I try to add this tab in another situation...

    I tried first to store the removed tab in a QWidget and after that to add this widget to the parent tab, but nothing happened, so obviously I did something wrong...

    @ QWidget *removedTab = ui->tab_Dimensions; // store the tab that will be removed
    ui->tabWidget_ItemDetails->removeTab(3); // remove the tab
    ui->tabWidget->addTab(removedTab,"TestWidget"); // here I try to add the tab...@

    Can someone show me the right direction to solve this task?

    thanks in advance,
    vittorio


Log in to reply
 

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