PDA

View Full Version : QTabBar not emmiting currentChanged



ihoss
13th September 2007, 18:59
I have a QTabBar that I have added to my Widget, and I want to change the content whenever the tab changes. However, it never emits that it has changed on user input. If I add code to change it, like tabBar->setCurrent(2), then it emits, but not when I click a tab. I can also see that the current tab changes, so there isn't anything covering the tabBar.


TabbedZoomView::TabbedZoomView(QWidget *parent) : QWidget(parent){
tabBar = new QTabBar();
zoomView = new ZoomView(new QGraphicsScene());
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(tabBar);
layout->addWidget(zoomView);
setLayout(layout);
connect(tabBar, SIGNAL(currentChange(int)), this, SLOT(showScene(int)));
}
void TabbedZoomView::showScene(int index){
QMessageBox::warning(this, tr("Tab changed"),
tr("currentTab: " + index),
QMessageBox::Ok,
QMessageBox::Ok);
if(currentScene != index){
currentScene = index;
tabBar->setCurrentIndex(index);
zoomView->setScene(scenes[index]);
}
}

jpn
13th September 2007, 19:00
There's a tiny little typo in the connect-statement: "currentChange" -> "currentChanged".

ihoss
13th September 2007, 19:03
wow, I feel stupid now :p. Then how come it worked for the hard-coded changes?