Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-85301

dragging the tab will cause it to be selected

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.15.0
    • None
    • macOS

    Description

      Use QTabBar and set movable to true, I drag an unselected tab and it will be selected after letting go. I just want to move its position, could this be a bug?

      It doesn't have to be macOS, it will appear in any style plugin that sets SH_TabBar_SelectMouseType to QEvent::MouseButtonRelease.

      #include <QApplication>
      #include <QMainWindow>
      #include <QTabWidget>
      #include <QVBoxLayout>
      
      class TestWindow : public QMainWindow
      {
      public:
          TestWindow(QWidget *parent = nullptr) : QMainWindow(parent)
          {
              QTabWidget* tw = new QTabWidget;
      
              QWidget* w1 = new QWidget;
              QWidget* w2 = new QWidget;
      
              tw->addTab( w1, "One" );
              tw->addTab( w2, "Two");
              tw->setMovable(true);
      
              QVBoxLayout* l = new QVBoxLayout;
              l->addWidget(tw);
      
              QWidget* w = new QWidget;
              w->setLayout(l);
      
              setCentralWidget(w);
          }
      };
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
          TestWindow w;
          w.show();
          return a.exec();
      }
      
      1. Run the application
      2. Make sure the "One" tab is selected
      3. Press and move the "Two" tab to the "One" tab left side
      4. Release mouse button
      5. You will see the "Two" tab is selected

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-85301
          # Subject Branch Project Status CR V

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              zccrs JiDe Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There is 1 open Gerrit change