QTabWidget: Tab Bar white space double click create new tab ?



  • Like web browser operation

    alt text
    [signal] void QTabWidget::tabBarDoubleClicked(int index)
    This signal is emitted when the user double clicks on a tab at an index.
    index is the index of a clicked tab, or -1 if no tab is under the cursor.
    No tab is under the cursor double clicks doesn't emit signal!

    connect(ui->tabWidget,SIGNAL(tabBarDoubleClicked(int)),this,SLOT(tabBarDoubleClick(int)));
    void MainWindow::tabBarDoubleClick(int index)
    {
        qDebug() << "tab" << index;
        if(index==-1){
            newTab();
        }
    }

  • Qt Champions 2016

    Hi
    You can subclass QTabWidget and see if mousePressed Events is triggered there
    or use event filter to catch it and perform the wanted function.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.