Qt World Summit: Submit your Presentation

Error with QTabWidget and apple magic mouse

  • On Mac (am running 10.9.3), QTabWidget emits currentChanged(int) signal more than once when a tab is simply clicked with the magic mouse. It does not happen always, but this happens consistently. My QTabWidget had 6 tabs and when the app is minimized and gets focus back and on clicking the tabs, you would see the effect of fingers on a piano. Wrong tabs get activated and you can see multiple currentChanged signal being emitted for just a simple click.

    QTabWidget *tabWidget;
    connect(tabWidget,signal(currentChanged(int), this,SLOT(TabWidgetCurrentChanged(int)));


    void MainWindow::TabWidgetCurrentChanged(int index)
    qDebug() << "TabWidgetCurrentChanged = " << index;

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You should also add which version of Qt and Xcode you are using.

    Can you reproduce this with a minimal example ?

  • Thanks for the reply. I use XCode 5.1.1 and Qt 4.8.5

    The example http://qt-project.org/doc/qt-4.8/dialogs-tabdialog.html is sufficient to reproduce this effect. This has no slot connected to currentChanged(int) signal, but I connected that just to receive the bogus signals,

  • Lifetime Qt Champion

    Since you are running Mavericks you should use Qt 4.8.6. It's the first version that officially supports 10.9

Log in to reply