Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docking bug with nested main windows #236

Open
delins opened this issue Sep 12, 2021 · 6 comments
Open

Docking bug with nested main windows #236

delins opened this issue Sep 12, 2021 · 6 comments
Labels
bug Something isn't working

Comments

@delins
Copy link

delins commented Sep 12, 2021

I've created an MWE that has a QMainWindow (level 0), that contains a KDDockWidgets::MainWindow (level 1), which in turn contains two KDDockWidgets::MainWindow (level 2). Docks in level 2 don't always work well: they only work in the KDDockWidgets::MainWindow that was created last.

In the screenshots below kdRootADock0 was created first and then kdRootADock1. kdRootADock1 can accept docks, but kdRootADock0 cannot.

image

image

I you move kdRootADock0 to a different main window, for instance kdRootB in the code below, it accepts drops again.

Code:

#include <QApplication>
#include <QMainWindow>
#include <QTextEdit>

#include <kddockwidgets/DockWidget.h>
#include <kddockwidgets/MainWindow>


KDDockWidgets::MainWindow* createSubMainWindow(int counter) {
    auto subName = QString::number(counter);
    KDDockWidgets::MainWindow *mw = new KDDockWidgets::MainWindow{subName};

    auto dock1 = new KDDockWidgets::DockWidget(subName + " dock 0");
    auto dock2 = new KDDockWidgets::DockWidget(subName + " dock 1");

    dock1->setWidget(new QTextEdit);
    dock1->setWidget(new QTextEdit);

    mw->addDockWidget(dock1, KDDockWidgets::Location::Location_OnRight);
    mw->addDockWidget(dock2, KDDockWidgets::Location::Location_OnRight);
    return mw;
}


int main(int argc, char* argv[]) {
    QApplication app{argc, argv};

    QMainWindow rootWindow;

    KDDockWidgets::MainWindow *kdRootA = new KDDockWidgets::MainWindow{"kdRootA"};
    rootWindow.setCentralWidget(kdRootA);

    auto aDock1 = new KDDockWidgets::DockWidget("kdRootADock0");
    auto aDock2 = new KDDockWidgets::DockWidget("kdRootADock1");

    aDock1->setWidget(createSubMainWindow(0));
    aDock2->setWidget(createSubMainWindow(1));

    kdRootA->addDockWidget(aDock1, KDDockWidgets::Location::Location_OnRight);
    kdRootA->addDockWidget(aDock2, KDDockWidgets::Location::Location_OnRight);

    rootWindow.showMaximized();
    rootWindow.show();

    QMainWindow secondWindow;
    KDDockWidgets::MainWindow *kdRootB = new KDDockWidgets::MainWindow{"kdRootB"};
    secondWindow.setCentralWidget(kdRootB);
    secondWindow.showMaximized();
    secondWindow.show();

    return app.exec();
}

cmake:

cmake_minimum_required(VERSION 3.3)
project(mwe)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

find_package(KDDockWidgets-qt6 CONFIG REQUIRED)
find_package(Qt6Widgets CONFIG REQUIRED)

add_executable(mwe main.cpp)

target_link_libraries(mwe Qt6::Widgets KDAB::kddockwidgets)

Tested on Kubuntu 20.04.2, Qt 6.1.3, various versions of KDDockWidgets including the latest master

@iamsergio iamsergio added the bug Something isn't working label Oct 12, 2021
@delins
Copy link
Author

delins commented Feb 18, 2022

Is this something that can be fixed? I'm not trying to push people to fix this, but it would be helpful for me to know the status.

@iamsergio
Copy link
Contributor

Hello Delins,

If you have license, just send me an email and I'll bump priority and I'll make sure KDAB schedules me for March on this.
Or, if this is for an opensource application, let me know which and I'll fix it in my free time, as I'm an opensource contributor too.

Otherwise it will have to wait, as I'm working on KDDW 2.0

@delins
Copy link
Author

delins commented Feb 18, 2022

Thanks for the quick response. I don't have a license, and it's just a project for myself. No worries.

Is KDAB planning to keep supporting this library, or will you switch to KDDW 2.0 at some point in the near future? Will the interface be roughly the same?

@delins delins closed this as completed Feb 18, 2022
@delins delins reopened this Feb 18, 2022
@iamsergio
Copy link
Contributor

2.0 is still far away and 1.x series will still be supported for a long time. 2.0 will have a similar interface, it will simply make it easier to introduce non-Qt implementations.

We just have too many tasks for the time available, so we have to give priority to license holders and to public opensource projects. I'd just help everyone if I could :) . Maybe make your project public and someone will be more likely to help you :)

@delins
Copy link
Author

delins commented Feb 18, 2022

Ah glad to hear 1.x is there to stay.

I might find time to fix it myself at some point, could you give some pointers on where I should look first?

@AndreMeyerRMC
Copy link

this may be related to #386

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants