Qt-interest Archive, August 2007
QTabWidget : hide/show strange behavior
Message 1 in thread
Hello,
Using SUSE 10.2 and QT 4.3.
In my application when a user can select to hide tab (page). I wrote the
following but it doesn't work the way I expected, the tab (page) stays
on BUT the content is hidden. I WANT the tab to be hidden with the content.
////////////////////////////////////////////////////////////////
// c-tor
MainWindow::MainWindow()
: ...
{
...
tabs = new QTabWidget(myMainSplitter); //tabs - private member
tabs->addTab( ctrlWidget, "&Controls");
tabs->addTab( viewWidget, "&Views");
...
}// c-tor */
///////////////////////////////////////////////////////////////
// this will be called when F9 is pressed
//
void MainWindow::tabsEnabler(int indx)
{
if (enableTabCheckBox) {
tabs->widget( indx )->hide();
}else{
tabs->widget( indx )->show();
}
}//tabsEnabler */
~~~~~~~~~
any idea ?
Thanks,
Joshua
--
[ signature omitted ]
Message 2 in thread
> In my application when a user can select to hide tab (page).
> I wrote the
> following but it doesn't work the way I expected, the tab
> (page) stays
> on BUT the content is hidden. I WANT the tab to be hidden
> with the content.
I ran into the same problem. You'll have to actually remove and add them
to the tabwidget, as needed, like this:
if(enable)
tabs->insertTab(tab[index], label[index], index);
else
tabs->removePage(tab[index]);
Cheers,
Peter
--
[ signature omitted ]