First Commit
This commit is contained in:
18
3rdparty/kddockwidgets/examples/qtquick/mdi/Another.qml
vendored
Normal file
18
3rdparty/kddockwidgets/examples/qtquick/mdi/Another.qml
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
Author: Sergio 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.
|
||||
*/
|
||||
|
||||
import QtQuick 2.9
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
color: "#0C2D48"
|
||||
anchors.fill: parent
|
||||
}
|
||||
35
3rdparty/kddockwidgets/examples/qtquick/mdi/CMakeLists.txt
vendored
Normal file
35
3rdparty/kddockwidgets/examples/qtquick/mdi/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
# This file is part of KDDockWidgets.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2019 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
# Author: Sergio 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.
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
project(qtquick_mdi)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIRS ON)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
if(NOT TARGET kddockwidgets)
|
||||
# For the purpose of our example, we're looking for Qt5 or Qt6 KDDW.
|
||||
# For your own purposes, just chose the one you need.
|
||||
find_package(KDDockWidgets QUIET)
|
||||
if(NOT KDDockWidgets_FOUND)
|
||||
find_package(KDDockWidgets-qt6 REQUIRED)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(RESOURCES_EXAMPLE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/resources_qtquick_mdi_example.qrc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../dockwidgets/resources_example.qrc
|
||||
)
|
||||
|
||||
add_executable(qtquick_mdi main.cpp ${RESOURCES_EXAMPLE_SRC})
|
||||
|
||||
target_link_libraries(qtquick_mdi PRIVATE KDAB::kddockwidgets)
|
||||
37
3rdparty/kddockwidgets/examples/qtquick/mdi/Guest.qml
vendored
Normal file
37
3rdparty/kddockwidgets/examples/qtquick/mdi/Guest.qml
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
Author: Sergio 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.
|
||||
*/
|
||||
|
||||
import QtQuick 2.9
|
||||
|
||||
Rectangle {
|
||||
color: "white"
|
||||
anchors.fill: parent
|
||||
|
||||
property alias background: background.source
|
||||
property alias logo: logo.source
|
||||
|
||||
|
||||
Image {
|
||||
id: background
|
||||
anchors.fill: parent
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
|
||||
Image {
|
||||
id: logo
|
||||
|
||||
fillMode: Image.PreserveAspectFit
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: 50
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
43
3rdparty/kddockwidgets/examples/qtquick/mdi/Guest1.qml
vendored
Normal file
43
3rdparty/kddockwidgets/examples/qtquick/mdi/Guest1.qml
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
Author: Sergio 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.
|
||||
*/
|
||||
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.12
|
||||
import com.kdab.dockwidgets 2.0 as KDDW
|
||||
|
||||
Guest {
|
||||
anchors.fill: parent
|
||||
background: "qrc:/assets/triangles.png"
|
||||
logo: "qrc:/assets/KDAB_bubble_white.png"
|
||||
|
||||
KDDW.DockWidget {
|
||||
id: another
|
||||
uniqueName: "another1"
|
||||
source: ":/Another.qml"
|
||||
}
|
||||
|
||||
Button {
|
||||
text: "Toggle Another"
|
||||
anchors {
|
||||
bottom: parent.bottom
|
||||
left: parent.left
|
||||
margins: 5
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
if (another.isOpen) {
|
||||
another.close();
|
||||
} else {
|
||||
another.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
17
3rdparty/kddockwidgets/examples/qtquick/mdi/Guest2.qml
vendored
Normal file
17
3rdparty/kddockwidgets/examples/qtquick/mdi/Guest2.qml
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
Author: Sergio 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.
|
||||
*/
|
||||
|
||||
import QtQuick 2.9
|
||||
|
||||
Guest {
|
||||
anchors.fill: parent
|
||||
logo: "qrc:/assets/KDAB_bubble_blue.png"
|
||||
}
|
||||
18
3rdparty/kddockwidgets/examples/qtquick/mdi/Guest3.qml
vendored
Normal file
18
3rdparty/kddockwidgets/examples/qtquick/mdi/Guest3.qml
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
Author: Sergio 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.
|
||||
*/
|
||||
|
||||
import QtQuick 2.9
|
||||
|
||||
Guest {
|
||||
anchors.fill: parent
|
||||
background: "qrc:/assets/base.png"
|
||||
logo: "qrc:/assets/KDAB_bubble_fulcolor.png"
|
||||
}
|
||||
62
3rdparty/kddockwidgets/examples/qtquick/mdi/main.cpp
vendored
Normal file
62
3rdparty/kddockwidgets/examples/qtquick/mdi/main.cpp
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
Author: Sergio 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 <kddockwidgets/Config.h>
|
||||
#include <kddockwidgets/qtquick/views/DockWidget.h>
|
||||
#include <kddockwidgets/qtquick/views/MainWindowMDI.h>
|
||||
#include <kddockwidgets/qtquick/Platform.h>
|
||||
#include <kddockwidgets/core/DockRegistry.h>
|
||||
#include "kddockwidgets/core/MainWindow.h"
|
||||
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QGuiApplication>
|
||||
#include <QCommandLineParser>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
QGuiApplication::setAttribute(Qt::AA_UseOpenGLES);
|
||||
#endif
|
||||
QGuiApplication app(argc, argv);
|
||||
KDDockWidgets::initFrontend(KDDockWidgets::FrontendType::QtQuick);
|
||||
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription("KDDockWidgets example application");
|
||||
parser.addHelpOption();
|
||||
|
||||
QQmlApplicationEngine appEngine;
|
||||
KDDockWidgets::QtQuick::Platform::instance()->setQmlEngine(&appEngine);
|
||||
appEngine.load((QUrl("qrc:/main.qml")));
|
||||
|
||||
auto dw1 = new KDDockWidgets::QtQuick::DockWidget("Dock #1");
|
||||
dw1->setGuestItem(QStringLiteral("qrc:/Guest1.qml"));
|
||||
dw1->resize(QSize(400, 400));
|
||||
|
||||
auto dw2 = new KDDockWidgets::QtQuick::DockWidget("Dock #2");
|
||||
dw2->setGuestItem(QStringLiteral("qrc:/Guest2.qml"));
|
||||
dw2->resize(QSize(400, 400));
|
||||
|
||||
auto dw3 = new KDDockWidgets::QtQuick::DockWidget("Dock #3");
|
||||
dw3->setGuestItem(QStringLiteral("qrc:/Guest3.qml"));
|
||||
|
||||
|
||||
// See main.qml for how to add dock widgets from QML.
|
||||
// Here's a low level C++ example just for educational purposes:
|
||||
auto mainAreaView = KDDockWidgets::DockRegistry::self()->mainDockingAreas().constFirst();
|
||||
auto mainAreaMDI = static_cast<KDDockWidgets::QtQuick::MainWindowMDI *>(mainAreaView);
|
||||
|
||||
mainAreaMDI->addDockWidget(dw1, QPoint(10, 10));
|
||||
mainAreaMDI->addDockWidget(dw2, QPoint(50, 50));
|
||||
mainAreaMDI->addDockWidget(dw3, QPoint(90, 90));
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
39
3rdparty/kddockwidgets/examples/qtquick/mdi/main.qml
vendored
Normal file
39
3rdparty/kddockwidgets/examples/qtquick/mdi/main.qml
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
Author: Sergio 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.
|
||||
*/
|
||||
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Controls 2.12
|
||||
import com.kdab.dockwidgets 2.0 as KDDW
|
||||
|
||||
ApplicationWindow {
|
||||
visible: true
|
||||
width: 1000
|
||||
height: 1200
|
||||
|
||||
KDDW.MDIDockingArea {
|
||||
id: dockingArea
|
||||
anchors.fill: parent
|
||||
uniqueName: "MyMainLayout"
|
||||
}
|
||||
|
||||
KDDW.DockWidget {
|
||||
id: someDock
|
||||
uniqueName: "someDock"
|
||||
Rectangle {
|
||||
color: "#413C58"
|
||||
anchors.fill: parent
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
dockingArea.addDockWidget(someDock, Qt.point(200, 200));
|
||||
}
|
||||
}
|
||||
10
3rdparty/kddockwidgets/examples/qtquick/mdi/resources_qtquick_mdi_example.qrc
vendored
Normal file
10
3rdparty/kddockwidgets/examples/qtquick/mdi/resources_qtquick_mdi_example.qrc
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>main.qml</file>
|
||||
<file>Guest1.qml</file>
|
||||
<file>Guest2.qml</file>
|
||||
<file>Guest3.qml</file>
|
||||
<file>Guest.qml</file>
|
||||
<file>Another.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
Reference in New Issue
Block a user