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

KDDockWidgets::MainWindow in QMainWindow central widget since 1.2 not useable any more #168

Closed
asti56x opened this issue Feb 14, 2021 · 3 comments

Comments

@asti56x
Copy link

asti56x commented Feb 14, 2021

I have ported my app to use KDDockwidgets.
Therefore i inserted KDDockWidgets::MainWindow into the central widget of my QMainWindow. My other QDockWindows on the sides of QMainWindow should stay as they are.
This works fine in version KDDockWidgets 1.1.
Since KDDockWidgets 1.2 the drag indicators are not shown anymore, so i'm not able to dock anywhere.

Any suggestions?

@iamsergio
Copy link
Contributor

Is your app GPL and what's the url so I can debug it ?

And which OS ?

I'm unaware of any breakage, but I'm not surprised... might need more tests

@asti56x
Copy link
Author

asti56x commented Feb 14, 2021

// For test purpose i have adjusted main.cpp from minimal example.
// Try to dock window 'dock 5'. I am on Win10 msvc2019_64 Qt 5.15.2

/*
This file is part of KDDockWidgets.

SPDX-FileCopyrightText: 2019-2021 Klarälvdalens Datakonsult AB, a KDAB Group company info@kdab.com
Author: Sérgio Martins sergio.martins@kdab.com

SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only

Contact KDAB at info@kdab.com for commercial licensing options.
*/

#include "MyWidget.h"

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

#include
#include
#include
#include
#include

// clazy:excludeall=qstring-allocations

using namespace KDDockWidgets;

int main(int argc, char **argv)
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif
QApplication app(argc, argv);

app.setOrganizationName(QStringLiteral("KDAB"));
app.setApplicationName(QStringLiteral("Test app"));

// Fusion looks better in general, but feel free to change
qApp->setStyle(QStyleFactory::create(QStringLiteral("Fusion")));

// Create Standard QMainWindow
QMainWindow win;
KDDockWidgets::MainWindow mainWindow(QStringLiteral("MyMainWindow"));
mainWindow.setWindowTitle("Main Window");

win.setCentralWidget(&mainWindow);

win.resize(1200, 1200);
win.show();

// # 2. Create a dock widget, it needs a unique name
auto dock1 = new KDDockWidgets::DockWidget(QStringLiteral("MyDock1"));
auto widget1 = new MyWidget();
dock1->setWidget(widget1);

auto dock2 = new KDDockWidgets::DockWidget(QStringLiteral("MyDock2"));
auto widget2 = new MyWidget(QStringLiteral(":/assets/base.png"),
                            QStringLiteral(":/assets/KDAB_bubble_fulcolor.png"));
dock2->setWidget(widget2);


auto dock3 = new KDDockWidgets::DockWidget(QStringLiteral("MyDock3"));
auto widget3 = new MyWidget(QStringLiteral(":/assets/base.png"),
                            QStringLiteral(":/assets/KDAB_bubble_fulcolor.png"));
dock3->setWidget(widget3);


auto dock4 = new KDDockWidgets::DockWidget(QStringLiteral("MyDock4"));
auto widget4 = new MyWidget(QStringLiteral(":/assets/base.png"),
                            QStringLiteral(":/assets/KDAB_bubble_fulcolor.png"));
dock4->setWidget(widget4);

auto dock5 = new KDDockWidgets::DockWidget(QStringLiteral("MyDock5"));
auto widget5 = new MyWidget(QStringLiteral(":/assets/base.png"),
                            QStringLiteral(":/assets/KDAB_bubble_fulcolor.png"));
dock5->setWidget(widget5);


// 3. Add them to the main window
mainWindow.addDockWidget(dock1, KDDockWidgets::Location_OnLeft);
mainWindow.addDockWidget(dock2, KDDockWidgets::Location_OnTop);

// 4. Add dock3 to the right of dock2
mainWindow.addDockWidget(dock3, KDDockWidgets::Location_OnRight, dock2);

// 5. dock4 is docked at the bottom, with 200px height
const QSize preferredSize(QSize(/*ignored*/0, 200));
mainWindow.addDockWidget(dock4, KDDockWidgets::Location_OnBottom, nullptr, preferredSize);


// 5. dock5 will be its own top level (floating window)
dock5->show();

return app.exec();

}

@iamsergio
Copy link
Contributor

Fixed in 206433e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants