Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

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

    General and Desktop
    2
    2
    902
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • sonichy
      sonichy last edited by sonichy

      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();
          }
      }

      https://github.com/sonichy

      1 Reply Last reply Reply Quote 0
      • mrjj
        mrjj Lifetime Qt Champion last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post