From d64ff8c6cd95ce3fe44e6ba0eec9ddf0a9a4d82f Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Tue, 15 Nov 2022 18:39:36 +0000 Subject: [PATCH] examples|qtquick: Show a .qml dockwidget as well The customtitlebar example only had C++ dock widgets. Now it has a .qml one too. While testing issue #325 --- examples/qtquick/customtitlebar/Guest4.qml | 18 ++++++++++++++++++ examples/qtquick/customtitlebar/main.qml | 15 +++++++++++++++ .../resources_qtquick_example.qrc | 1 + 3 files changed, 34 insertions(+) create mode 100644 examples/qtquick/customtitlebar/Guest4.qml diff --git a/examples/qtquick/customtitlebar/Guest4.qml b/examples/qtquick/customtitlebar/Guest4.qml new file mode 100644 index 00000000..ac66ffbc --- /dev/null +++ b/examples/qtquick/customtitlebar/Guest4.qml @@ -0,0 +1,18 @@ +/* + This file is part of KDDockWidgets. + + SPDX-FileCopyrightText: 2020-2022 Klarälvdalens Datakonsult AB, a KDAB Group company + Author: Sergio Martins + + SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only + + Contact KDAB at for commercial licensing options. +*/ + +import QtQuick 2.9 + +Guest { + anchors.fill: parent + background: "qrc:/assets/triangles.png" + logo: "qrc:/assets/KDAB_bubble_white.png" +} diff --git a/examples/qtquick/customtitlebar/main.qml b/examples/qtquick/customtitlebar/main.qml index d3f46fd8..ed5f891b 100644 --- a/examples/qtquick/customtitlebar/main.qml +++ b/examples/qtquick/customtitlebar/main.qml @@ -23,5 +23,20 @@ ApplicationWindow { anchors.fill: parent uniqueName: "MyMainLayout" + + KDDW.DockWidget { + id: dock4 + uniqueName: "dock4" + source: "qrc:/Guest4.qml" + onIsFocusedChanged: { + console.log("Dock4 focus changed to: " + isFocused); + } + } + + Component.onCompleted: { + // The other 3 dock widgets are created via C++ in main.cpp + // For illustration purposes, here's a .qml version. Maybe it's te preferred form even. + addDockWidget(dock4, KDDW.KDDockWidgets.Location_OnBottom); + } } } diff --git a/examples/qtquick/customtitlebar/resources_qtquick_example.qrc b/examples/qtquick/customtitlebar/resources_qtquick_example.qrc index 295a5f1c..f6fd854a 100644 --- a/examples/qtquick/customtitlebar/resources_qtquick_example.qrc +++ b/examples/qtquick/customtitlebar/resources_qtquick_example.qrc @@ -4,6 +4,7 @@ Guest1.qml Guest2.qml Guest3.qml + Guest4.qml Guest.qml MyTitleBar.qml