-
Notifications
You must be signed in to change notification settings - Fork 171
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
How to make KDDockWidgetsMainWindow work within another provided main window? #204
Comments
Perhaps this is the same bug as issue #168. |
Can you modify examples/minimal/ then attach a .diff file here (or a link to your github with the change commited) ? Then I can debug it quickly |
Attached is a minimal file which creates a class derived from QMainWindow. Code is also copied/pasted. That class holds another widget which contains a VBoxLayout which contains a KDDockWidgets::MainWindow with a number of DockWidgets. It renders the dockwidgets properly, but docking does not occur within the window. If I remove dockwidgets from the window, docking can occur in a floating window, but I cannot get the floating window back into the VBox #include class Widget : public QWidget
}; |
Hi Sergio,
See attached minimal example.
On Sun, Jun 13, 2021 at 6:09 AM Sergio Martins ***@***.***> wrote:
Can you modify examples/minimal/ then attach a .diff file here (or a link
to your github with the change commited) ?
Then I can debug it quickly
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#204 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAPOE4IWCBJJJSV3XG5MHMTTSR7UBANCNFSM46R3LTIA>
.
#include <QApplication>
#include <QMainWindow>
#include <QVBoxLayout>
#include <QLabel>
#include <kddockwidgets/DockWidget.h>
#include <kddockwidgets/MainWindow.h>
class Widget : public QWidget
{
public:
Widget(QWidget* parent = nullptr, Qt::WindowFlags flags = 0)
: QWidget(parent, flags)
{
KDDockWidgets::MainWindow* dockMainWindow = new KDDockWidgets::MainWindow(QStringLiteral("KDDocker"), KDDockWidgets::MainWindowOption_None);
dockMainWindow->setFixedHeight(500);
for(int i = 1; i <= 5; ++i)
{
QString name = ("window_" + std::to_string(i)).c_str();
auto dock = new KDDockWidgets::DockWidget(name);
auto* label = new QLabel(dock);
label->setText(name);
dock->setWidget(label);
dockMainWindow->addDockWidget(dock, KDDockWidgets::Location_OnLeft);
}
QVBoxLayout* vBoxLayout = new QVBoxLayout(this);
vBoxLayout->addWidget(dockMainWindow);
}
};
class MainWindowTest : public QMainWindow
{
public:
MainWindowTest(QWidget* parent = nullptr, Qt::WindowFlags flags = 0)
: QMainWindow(parent, flags)
{
Widget* widget = new Widget(this);
setCentralWidget(widget);
show();
}
};
int main(int argc, char* argv[])
{
QApplication qApplication(argc, argv);
MainWindowTest mainWindowTest;
qApplication.exec();
return 0;
}
|
Fixed in 206433e |
I am still showing the same behaviour with the code I sent... Using
Microsoft Windows, VS 2019
#include <QApplication>
#include <QMainWindow>
#include <QVBoxLayout>
#include <QLabel>
#include <kddockwidgets/DockWidget.h>
#include <kddockwidgets/MainWindow.h>
class Widget : public QWidget
{
public:
Widget(QWidget* parent = nullptr, Qt::WindowFlags flags = 0)
: QWidget(parent, flags)
{
KDDockWidgets::MainWindow* dockMainWindow = new
KDDockWidgets::MainWindow(QStringLiteral("KDDocker"),
KDDockWidgets::MainWindowOption_None);
dockMainWindow->setFixedHeight(500);
for(int i = 1; i <= 5; ++i)
{
QString name = ("window_" + std::to_string(i)).c_str();
auto dock = new KDDockWidgets::DockWidget(name);
auto* label = new QLabel(dock);
label->setText(name);
dock->setWidget(label);
dockMainWindow->addDockWidget(dock,
KDDockWidgets::Location_OnLeft);
}
QVBoxLayout* vBoxLayout = new QVBoxLayout(this);
vBoxLayout->addWidget(dockMainWindow);
}
};
class MainWindowTest : public QMainWindow
{
public:
MainWindowTest(QWidget* parent = nullptr, Qt::WindowFlags flags = 0)
: QMainWindow(parent, flags)
{
Widget* widget = new Widget(this);
setCentralWidget(widget);
show();
}
};
int main(int argc, char* argv[])
{
QApplication qApplication(argc, argv);
MainWindowTest mainWindowTest;
qApplication.exec();
return 0;
}
…On Mon, Jun 14, 2021 at 1:45 AM Sergio Martins ***@***.***> wrote:
Fixed in 206433e
<206433e>
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#204 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAPOE4LJBFET6VUH6VD5RA3TSWJRHANCNFSM46R3LTIA>
.
|
How to make KDDockWidgetsMainWindow work within another provided main window?
I have another MainWindow provided by a component vendor, so I must use that.
I set the parent of KDDockWidgets::MainWindow to the other main window.
I then add this to a layout which is part of the CentralWidget.
I get what looks like a functional DockWidget -- but it is half broken. I cannot dock the widgets to each other or within the window. The docking indicator displays do not appear at all... The image shows the two widgets created successfully at the bottom of the screen (data1, data2), but moving the widgets around does not transmit events to the underlying main (I presume) - so the widgets are unaware of how to dock. How do I use KDDockWidget when a MainWindow is already provided? This is probably a common usage case. Picture & code follows as:
KDDockWidgets::MainWindow * dmw = new KDDockWidgets::MainWindow(QStringLiteral("KDDocker"), KDDockWidgets::MainWindowOption_None, this);
dmw->setFixedHeight(120);
{
auto dock = new KDDockWidgets::DockWidget(QStringLiteral("data1"));
auto* label = new QLabel(dock);
label->setText("1.1111");
label->setFont(QFont("Arial", 16));
dock->setWidget(label);
dock->show();
dmw->addDockWidget(dock, KDDockWidgets::Location_OnLeft);
}
{
auto dock = new KDDockWidgets::DockWidget(QStringLiteral("data2"));
auto* label = new QLabel(dock);
label->setText("22222.22");
label->setFont(QFont("Arial", 16));
dock->setWidget(label);
dock->show();
dmw->addDockWidget(dock, KDDockWidgets::Location_OnRight);
}
_WidgetSwitcher->_CentralWidgetVBoxLayout->addWidget(dmw);
dmw->show();
setCentralWidget(_WidgetSwitcher);
Thanks for any responses,
David Linenberg
The text was updated successfully, but these errors were encountered: