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

Dragging multiple tabs into a floating group of tabs switches the tab position to South

XMLWordPrintable

      If you have a main window which has several tab windows in a group, with dockOptions set to a combo of nested | tabbed | groupedDragging.

       

      Set the features flag of each tab to Movable | Floatable.

      In the constructor of your window, set the tab areas to North so tabs are on top:

      Snippet

      setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::TabPosition::North);

       

      Dragging the tabs from one dock area to another works fine.

       

      However, floating one tab, then dragging another onto it exhibits a weird behavior: it flips the tab positions to South. Once you drag this floating group to a dock location, the tabs revert back to their usual location of North.

       

      I believe I have found the code responsible for this:

       

      https://github.com/openwebos/qt/blob/master/src/gui/widgets/qmainwindow.cpp

       

      We see a lot of code like this which returns a default of South of the check fails:

       

      if (!checkDockWidgetArea(area, "QMainWindow::tabPosition"))

      return QTabWidget::South;

       

      And if we look into that function, we see that it accounts for the 4 areas tabs can be docked at, but it does not account for what happens when a tab is floating and is not docked anywhere:

       

      static bool checkDockWidgetArea(Qt::DockWidgetArea area, const char *where)
      {
      switch (area) {
      case Qt::LeftDockWidgetArea:
      case Qt::RightDockWidgetArea:
      case Qt::TopDockWidgetArea:
      case Qt::BottomDockWidgetArea:
      return true;
      default:
      break;
      }
      qWarning("%s: invalid 'area' argument", where);
      return false;

      }

       

      I think this might be easily fixable if we add an enum to account for the tabs being in a floating state.

       

      Thank you.

       

        1. qtbug65247.zip
          2 kB
          Lysandra Sola
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            axelspoerl Axel Spoerl
            mfeemster Matt Feemster
            Votes:
            7 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes