First Commit
This commit is contained in:
18
3rdparty/kddockwidgets/examples/qtquick/mdi_with_docking/Another.qml
vendored
Normal file
18
3rdparty/kddockwidgets/examples/qtquick/mdi_with_docking/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: "green"
|
||||
anchors.fill: parent
|
||||
}
|
||||
35
3rdparty/kddockwidgets/examples/qtquick/mdi_with_docking/CMakeLists.txt
vendored
Normal file
35
3rdparty/kddockwidgets/examples/qtquick/mdi_with_docking/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_dockwidgets)
|
||||
|
||||
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_example.qrc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../dockwidgets/resources_example.qrc
|
||||
)
|
||||
|
||||
add_executable(qtquick_mdi_with_docking main.cpp ${RESOURCES_EXAMPLE_SRC})
|
||||
|
||||
target_link_libraries(qtquick_mdi_with_docking PRIVATE KDAB::kddockwidgets)
|
||||
36
3rdparty/kddockwidgets/examples/qtquick/mdi_with_docking/Guest.qml
vendored
Normal file
36
3rdparty/kddockwidgets/examples/qtquick/mdi_with_docking/Guest.qml
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
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
|
||||
|
||||
Item {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
19
3rdparty/kddockwidgets/examples/qtquick/mdi_with_docking/Guest1.qml
vendored
Normal file
19
3rdparty/kddockwidgets/examples/qtquick/mdi_with_docking/Guest1.qml
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
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 com.kdab.dockwidgets 2.0 as KDDW
|
||||
|
||||
Guest {
|
||||
anchors.fill: parent
|
||||
background: "qrc:/assets/triangles.png"
|
||||
logo: "qrc:/assets/KDAB_bubble_white.png"
|
||||
}
|
||||
17
3rdparty/kddockwidgets/examples/qtquick/mdi_with_docking/Guest2.qml
vendored
Normal file
17
3rdparty/kddockwidgets/examples/qtquick/mdi_with_docking/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_with_docking/Guest3.qml
vendored
Normal file
18
3rdparty/kddockwidgets/examples/qtquick/mdi_with_docking/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"
|
||||
}
|
||||
73
3rdparty/kddockwidgets/examples/qtquick/mdi_with_docking/main.cpp
vendored
Normal file
73
3rdparty/kddockwidgets/examples/qtquick/mdi_with_docking/main.cpp
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
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/core/DockRegistry.h>
|
||||
#include <kddockwidgets/core/MDILayout.h>
|
||||
#include <kddockwidgets/qtquick/ViewFactory.h>
|
||||
#include <kddockwidgets/qtquick/Platform.h>
|
||||
#include <kddockwidgets/qtquick/views/DockWidget.h>
|
||||
#include <kddockwidgets/qtquick/views/MainWindow.h>
|
||||
#include <kddockwidgets/qtquick/views/MDILayout.h>
|
||||
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QGuiApplication>
|
||||
#include <QCommandLineParser>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
QGuiApplication::setAttribute(Qt::AA_UseOpenGLES);
|
||||
#endif
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
#endif
|
||||
QGuiApplication app(argc, argv);
|
||||
|
||||
KDDockWidgets::initFrontend(KDDockWidgets::FrontendType::QtQuick);
|
||||
|
||||
// Create your engine which loads main.qml. A simple QQuickView would work too.
|
||||
QQmlApplicationEngine appEngine;
|
||||
KDDockWidgets::QtQuick::Platform::instance()->setQmlEngine(&appEngine);
|
||||
appEngine.load((QUrl("qrc:/main.qml")));
|
||||
|
||||
// Below we illustrate usage of our C++ API. Alternatively you can use declarative API.
|
||||
// See main.qml for examples of dockwidgets created directly in QML
|
||||
|
||||
auto dw1 = new KDDockWidgets::QtQuick::DockWidget("Dock #1");
|
||||
|
||||
dw1->setGuestItem(QStringLiteral("qrc:/Guest1.qml"));
|
||||
dw1->resize(QSize(800, 800));
|
||||
dw1->open();
|
||||
|
||||
auto dw3 = new KDDockWidgets::QtQuick::DockWidget("Dock #3");
|
||||
dw3->setGuestItem(QStringLiteral("qrc:/Guest3.qml"));
|
||||
|
||||
dw1->addDockWidgetToContainingWindow(dw3, KDDockWidgets::Location_OnRight);
|
||||
|
||||
// Access the main area we created in QML with DockingArea {}
|
||||
auto mainArea = KDDockWidgets::DockRegistry::self()->mainDockingAreas().constFirst();
|
||||
auto mdiLayout = new KDDockWidgets::Core::MDILayout();
|
||||
mainArea->setPersistentCentralView(mdiLayout->view()->asWrapper());
|
||||
|
||||
auto dwInMDI1 = new KDDockWidgets::QtQuick::DockWidget("Dock #mdi1");
|
||||
dwInMDI1->setGuestItem(QStringLiteral("qrc:/Guest3.qml"));
|
||||
|
||||
auto dwInMDI2 = new KDDockWidgets::QtQuick::DockWidget("Dock #mdi2");
|
||||
dwInMDI2->setGuestItem(QStringLiteral("qrc:/Guest3.qml"));
|
||||
|
||||
mdiLayout->addDockWidget(dwInMDI1->dockWidget(), { 100, 100 });
|
||||
mdiLayout->addDockWidget(dwInMDI2->dockWidget(), { 140, 140 });
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
75
3rdparty/kddockwidgets/examples/qtquick/mdi_with_docking/main.qml
vendored
Normal file
75
3rdparty/kddockwidgets/examples/qtquick/mdi_with_docking/main.qml
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
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: 1300
|
||||
height: 1300
|
||||
|
||||
menuBar: MenuBar {
|
||||
Menu {
|
||||
title: qsTr("&File")
|
||||
|
||||
Action {
|
||||
text: qsTr("Close All")
|
||||
onTriggered: {
|
||||
_kddwDockRegistry.clear();
|
||||
}
|
||||
}
|
||||
|
||||
MenuSeparator { }
|
||||
Action { text: qsTr("&Quit")
|
||||
onTriggered: {
|
||||
Qt.quit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KDDW.DockingArea {
|
||||
options: KDDW.KDDockWidgets.MainWindowOption_HasCentralWidget
|
||||
anchors.fill: parent
|
||||
|
||||
// Each main layout needs a unique id
|
||||
uniqueName: "MainLayout-1"
|
||||
|
||||
KDDW.DockWidget {
|
||||
id: dock5
|
||||
uniqueName: "dock5"
|
||||
Rectangle {
|
||||
id: guest
|
||||
color: "pink"
|
||||
anchors.fill: parent
|
||||
}
|
||||
}
|
||||
|
||||
KDDW.DockWidget {
|
||||
id: dock6
|
||||
uniqueName: "dock6"
|
||||
Rectangle {
|
||||
color: "black"
|
||||
anchors.fill: parent
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
// Add dock4 to the Bottom location
|
||||
addDockWidget(dock5, KDDW.KDDockWidgets.Location_OnLeft, null, Qt.size(150, 0));
|
||||
|
||||
// Add dock5 to the left of dock4
|
||||
addDockWidget(dock6, KDDW.KDDockWidgets.Location_OnBottom, null, Qt.size(0, 150));
|
||||
}
|
||||
}
|
||||
}
|
||||
10
3rdparty/kddockwidgets/examples/qtquick/mdi_with_docking/resources_qtquick_example.qrc
vendored
Normal file
10
3rdparty/kddockwidgets/examples/qtquick/mdi_with_docking/resources_qtquick_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