PDA

View Full Version : Problem when creating different sofy keys on different tabs



reticent
31st July 2010, 12:54
Hi,

I was trying to create different softkeys on different Tabs. Creating the softkeys was fine but however until I press on one of the widgets the softkeys aren't visible. Here is how my code looks like

QMainWindow *mainWindow = new QMainWIndow;
QTabWidget *central = new QTabWidget;
setCentralWidget(central);
xTab = new QWidget;
.
.
.
yTab = new QWidget;
central->addTab(xTab);
central->addTab(yTab);
connect(central, SIGNAL(currentChanged(int)), this, SLOT(onTabChanged(int)));
}

//SLOT

void onTabChanged(int index)
{
if(index ==1)
{
sKey1 = new QAction(yTab);
skey1->setSoftKeyRole(QAction:: PositiveSoftKey);
yTab->addAction(sKey1);
}
}

This skey1 softkey I created in yTab is visible only when I click on one of the widgets inside the tab.
However if I add the sKey1 to central it displays properly but as I need to have different soft keys appear on different tabs that doesn't work.
I really appreciate if anyone can provide any ideas/suggestions.