Results 1 to 3 of 3

Thread: QTabBar not emmiting currentChanged

  1. #1
    Join Date
    Aug 2007
    Posts
    39
    Thanks
    8

    Default QTabBar not emmiting currentChanged

    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.
    Qt Code:
    1. TabbedZoomView::TabbedZoomView(QWidget *parent) : QWidget(parent){
    2. tabBar = new QTabBar();
    3. zoomView = new ZoomView(new QGraphicsScene());
    4. QVBoxLayout *layout = new QVBoxLayout;
    5. layout->addWidget(tabBar);
    6. layout->addWidget(zoomView);
    7. setLayout(layout);
    8. connect(tabBar, SIGNAL(currentChange(int)), this, SLOT(showScene(int)));
    9. }
    10. void TabbedZoomView::showScene(int index){
    11. QMessageBox::warning(this, tr("Tab changed"),
    12. tr("currentTab: " + index),
    13. if(currentScene != index){
    14. currentScene = index;
    15. tabBar->setCurrentIndex(index);
    16. zoomView->setScene(scenes[index]);
    17. }
    18. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by ihoss; 13th September 2007 at 19:01. Reason: spelling error

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QTabBar not emmiting currentChanged

    There's a tiny little typo in the connect-statement: "currentChange" -> "currentChanged".
    J-P Nurmi

  3. The following user says thank you to jpn for this useful post:

    ihoss (13th September 2007)

  4. #3
    Join Date
    Aug 2007
    Posts
    39
    Thanks
    8

    Default Re: QTabBar not emmiting currentChanged

    wow, I feel stupid now . Then how come it worked for the hard-coded changes?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.