Add a repro for a bug

This commit is contained in:
Sergio Martins
2022-10-20 17:41:57 +01:00
parent cb5a42ef2e
commit 02affc24c7
3 changed files with 53 additions and 18 deletions

View File

@@ -10,27 +10,40 @@
*/ */
import QtQuick 2.9 import QtQuick 2.9
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import QtQuick.Controls 1.5 as QQC1
import com.kdab.dockwidgets 2.0 as KDDW
Item { Item {
anchors.fill: parent anchors.fill: parent
property alias background: background.source property var background
property alias logo: logo.source property var logo
KDDW.LayoutSaver {
id: layoutSaver
}
Image { Rectangle {
id: background anchors.fill: parent
anchors.fill: parent color: "green"
fillMode: Image.PreserveAspectCrop
Image { ColumnLayout {
id: logo Button {
text: "Save"
onClicked: {
layoutSaver.saveToFile ("/tmp/layout");
}
}
fillMode: Image.PreserveAspectFit Button {
anchors { text: "Restore"
fill: parent onClicked: {
margins: 50 layoutSaver.restoreFromFile ("/tmp/layout");
} }
} }
} }
}
} }

View File

@@ -32,6 +32,26 @@ KDDW.TitleBarBase {
} }
} }
Rectangle {
id: floatButton
visible: root.floatButtonVisible
radius: 5
color: "red"
height: root.height - 20
width: height
anchors {
right: closeButton.left
rightMargin: 10
verticalCenter: root.verticalCenter
}
MouseArea {
anchors.fill: parent
onClicked: {
root.floatButtonClicked();
}
}
}
Rectangle { Rectangle {
id: closeButton id: closeButton
enabled: root.closeButtonEnabled enabled: root.closeButtonEnabled

View File

@@ -57,21 +57,23 @@ int main(int argc, char *argv[])
dw1->setGuestItem(QStringLiteral("qrc:/Guest1.qml")); dw1->setGuestItem(QStringLiteral("qrc:/Guest1.qml"));
dw1->resize(QSize(800, 800)); dw1->resize(QSize(800, 800));
dw1->open(); // dw1->open();
auto dw2 = new KDDockWidgets::Views::DockWidget_qtquick("Dock #2"); auto dw2 = new KDDockWidgets::Views::DockWidget_qtquick("Dock #2");
dw2->setGuestItem(QStringLiteral("qrc:/Guest2.qml")); dw2->setGuestItem(QStringLiteral("qrc:/Guest2.qml"));
dw2->resize(QSize(800, 800)); dw2->resize(QSize(800, 800));
dw2->open(); // dw2->open();
auto dw3 = new KDDockWidgets::Views::DockWidget_qtquick("Dock #3"); auto dw3 = new KDDockWidgets::Views::DockWidget_qtquick("Dock #3");
dw3->setGuestItem(QStringLiteral("qrc:/Guest3.qml")); dw3->setGuestItem(QStringLiteral("qrc:/Guest3.qml"));
dw1->addDockWidgetToContainingWindow(dw3, KDDockWidgets::Location_OnRight); // dw1->addDockWidgetToContainingWindow(dw3, KDDockWidgets::Location_OnRight);
// Access the main area we created in QML with DockingArea {} // Access the main area we created in QML with DockingArea {}
auto mainArea = KDDockWidgets::DockRegistry::self()->mainDockingAreas().constFirst(); auto mainArea = KDDockWidgets::DockRegistry::self()->mainDockingAreas().constFirst();
mainArea->addDockWidget(dw1, KDDockWidgets::Location_OnTop);
mainArea->addDockWidget(dw2, KDDockWidgets::Location_OnTop); mainArea->addDockWidget(dw2, KDDockWidgets::Location_OnTop);
mainArea->addDockWidget(dw3, KDDockWidgets::Location_OnTop);
return app.exec(); return app.exec();
} }