Skip to content

Incorrect height of dock widgets when inserting a hidden dock in the chain #640

@Eism

Description

@Eism

Environment

  • OS: all platforms
  • Qt Version: 6.2 and 6.9
  • KDDockWidgets version: 1.7 and main branch
  • KDDockWidgets QtQuick or QtWidgets ? QtQuick

Self reproducible example

Project: examples/qtquick/dockwidgets

Changes:
In main.qml I removed all Dock Widgets
In main.cpp I added the following dock widgets

Changes
    auto dw1 = new KDDockWidgets::QtQuick::DockWidget("Dock #1");

    dw1->setGuestItem(QStringLiteral("qrc:/Guest1.qml"));
    dw1->resize(QSize(200, 200));

    auto dw2 = new KDDockWidgets::QtQuick::DockWidget("Dock #2");
    dw2->setGuestItem(QStringLiteral("qrc:/Guest2.qml"));
    dw2->resize(QSize(200, 200));

    auto dw3 = new KDDockWidgets::QtQuick::DockWidget("Dock #3");
    dw3->setGuestItem(QStringLiteral("qrc:/Guest3.qml"));

    auto dw4 = new KDDockWidgets::QtQuick::DockWidget("Dock #4");
    dw4->setGuestItem(QStringLiteral("qrc:/Guest3.qml"));

    KDDockWidgets::Core::MainWindow *mainWindow = KDDockWidgets::DockRegistry::self()->mainwindows().constFirst();
    mainWindow->addDockWidget(dw4->dockWidget(), KDDockWidgets::Location_OnTop);
    mainWindow->addDockWidget(dw1->dockWidget(), KDDockWidgets::Location_OnTop);
    mainWindow->addDockWidget(dw2->dockWidget(), KDDockWidgets::Location_OnRight, dw1->dockWidget(), KDDockWidgets::InitialVisibilityOption::StartHidden);
    mainWindow->addDockWidget(dw3->dockWidget(), KDDockWidgets::Location_OnRight, dw2->dockWidget());

Description

I’m building a layout using dock widgets, and everything works as expected unless one of the widgets in the chain is added as hidden (StartHidden). In that case, some of the dock widgets that follow in the layout chain get incorrect height.

While investigating MuseScore issue #27625, I initially attempted to fix the problem on the MuseScore side. However, after further analysis, it looks like the root cause lies within KDDockWidgets itself.

I was able to reproduce the issue both on the latest main branch of KDDockWidgets and on version 1.7, which is more important for MuseScore, as we’re still using that version.

Expected behavior Image Image
Actual behavior Image
Actual behavior if the dock is opened Image

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions