PDA

View Full Version : QTabBar Select added Bar



airglide
23rd October 2012, 22:12
Hello everyone,

My program contains a QTabBar. When I open a File, I do tabBar.addTab("blabla"). If I add another tab, I've got the problem that this one isn't selected, because the first one is still selected. I want to select everytime the new Tab which is inserted. I'm really stuck ;)

thank you for your help ;)

airglide

StrikeByte
24th October 2012, 15:46
Use setCurrentIndex(int index) the index of the new tab is the return value of addTab see the next code:



myTabBar->setCurrentIndex(myTabBar->addTab("Some title"));



if you use a tabwidget you can also use setCurrentWidget(QWidget *widget)

airglide
25th October 2012, 15:21
great, thank you, that's what I've looked for ;)