Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QDockWidgetGroupWindow effectively sets new dockarea permissions on qdockwidget
Forum Updated to NodeBB v4.3 + New Features

QDockWidgetGroupWindow effectively sets new dockarea permissions on qdockwidget

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 3 Posters 739 Views 1 Watching
  • 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.
  • E Offline
    E Offline
    ESP123
    wrote on last edited by ESP123
    #1

    I have the following situation, tested also in minimal qt code in Creator:

    • create mainwindow and two dockwidgets A and B and enable all dockwidget features
    • set both dockwidgets allowed areas to one location only, RightDockWidgetArea for example
    • dock both them
    • now drag A out to float
    • drag B to float, but do not drop it, move it over A temporily and move it back to where it was, never dropping the dockwidget - A now has the hidden class object QDockWidgetGroupWindow as its parent, and its permissions are all messed up, it can dock anywhere .. .this is a problem for me and i need to get rid of it ... i tried watching for featureChanged event, but it is never called on the original dockwidget, its permissions are fine, but it seems the new parent causes this issue .. the problem is dockwidget A is only allowed in right area, but after this mouse manuever, it can go anywhere .. please help
    #include "mainwindow.h"
    
    #include <QApplication>
    #include <QDockWidget>
    #include <QIcon>
    #include <QHBoxLayout>
    #include <QGridLayout>
    #include <QDebug>
    
    
    class MyDW : public QDockWidget {
    
    public:
        explicit MyDW(QWidget *parent): QDockWidget(parent, Qt::WindowFlags()) {
            setMouseTracking(true);
            w = dynamic_cast<QMainWindow *>(parent);
        }
        virtual ~MyDW() {}
    protected:
        QMainWindow *w;
        virtual void mousePressEvent(QMouseEvent *event) override {
        }
    };
    
    
    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
    
        MainWindow outer;
        outer.show();
        outer.centralWidget()->setLayout(new QGridLayout);
        outer.centralWidget()->layout()->setContentsMargins(0,0,0,0);
        outer.centralWidget()->setMinimumSize(0,0);
        outer.setDockOptions(QMainWindow::AllowTabbedDocks | QMainWindow::GroupedDragging); // | QMainWindow::AllowNestedDocks);
    
    
        MyDW *d1 = new MyDW(&outer);
        d1->setWindowTitle("blue");
        d1->setFeatures(QDockWidget::AllDockWidgetFeatures);
        d1->setAllowedAreas(Qt::DockWidgetArea::LeftDockWidgetArea);
    
        MyDW *d2 = new MyDW(&outer);
        d2->setWindowTitle("red");
        d2->setFeatures(QDockWidget::AllDockWidgetFeatures);
        d2->setAllowedAreas(Qt::DockWidgetArea::RightDockWidgetArea);
    
        d1->show();
        d2->show();
    
        outer.addDockWidget(Qt::DockWidgetArea::LeftDockWidgetArea, d1);
        outer.addDockWidget(Qt::DockWidgetArea::RightDockWidgetArea, d2);
    
        return a.exec();
    }
    
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Which version of Qt ?
      On which OS ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • E Offline
        E Offline
        ESP123
        wrote on last edited by ESP123
        #3

        ok i think i have a workaround, but i still would like to know if there is a native Qt solution - this was a real pain for some time, only today i just found a solution but it is not ideal

        Big Sur and Qt v 5.15 in Creator

        I would attach a video but i am not allowed here it seems .. hpoefully the descr makes sense

        1 Reply Last reply
        0
        • E Offline
          E Offline
          ESP123
          wrote on last edited by
          #4

          in fact, now i see there is still an issue, that the combination of floating qdockwidgets can be docked anywhere .. i cannot allow this but there is no way i know of to set these permissions on the hidden class object, which is not accessible ... seems to be a major bug in this system? please advise

          1 Reply Last reply
          0
          • E Offline
            E Offline
            ESP123
            wrote on last edited by ESP123
            #5

            follow-up: can i set any docking permissions at all (even disable) on the group/combined dockwidgets inside QDockWidgetGroupWindow? it seems it does not respect the mainwindow settings either .. for example nested is allowed on the group even if disabled normally

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Looks like you may have found a bug.

              You should check the bug report system to see if there's something about it.

              Just in case there are other docking solution like KDAB's KDDockWidgets.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • Axel SpoerlA Offline
                Axel SpoerlA Offline
                Axel Spoerl
                Moderators
                wrote on last edited by
                #7

                It's a bug and we are working at it here.

                Software Engineer
                The Qt Company, Oslo

                1 Reply Last reply
                2
                • Axel SpoerlA Offline
                  Axel SpoerlA Offline
                  Axel Spoerl
                  Moderators
                  wrote on last edited by
                  #8

                  Fixed in 6.3, 6.2 and 15.5. Thanks for bringing this up.

                  Software Engineer
                  The Qt Company, Oslo

                  1 Reply Last reply
                  1

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved