From bcada80b0d0c8a6e8bf1fccdcfd75e93f4393c50 Mon Sep 17 00:00:00 2001 From: hewenfei Date: Fri, 23 Dec 2022 11:32:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qml/AppUI/App.qml | 8 -------- qml/{UkuiMenuUI.qml => AppUI/AppPage.qml} | 21 ++----------------- qml/AppUI/FullScreenUI.qml | 15 ++++++++++++++ qml/AppUI/NormalUI.qml | 25 +++++++++++++++++++++++ qml/AppUI/Sidebar.qml | 8 ++++++++ qml/AppUI/qmldir | 5 ++++- qml/main.qml | 17 +++++++++++++-- qml/qml.qrc | 6 ++++-- 8 files changed, 73 insertions(+), 32 deletions(-) delete mode 100644 qml/AppUI/App.qml rename qml/{UkuiMenuUI.qml => AppUI/AppPage.qml} (56%) create mode 100644 qml/AppUI/FullScreenUI.qml create mode 100644 qml/AppUI/NormalUI.qml create mode 100644 qml/AppUI/Sidebar.qml diff --git a/qml/AppUI/App.qml b/qml/AppUI/App.qml deleted file mode 100644 index 7c8f760..0000000 --- a/qml/AppUI/App.qml +++ /dev/null @@ -1,8 +0,0 @@ -import QtQuick 2.0 - -Rectangle { - color: "blue"; - Text { - text: "AppUI" - } -} diff --git a/qml/UkuiMenuUI.qml b/qml/AppUI/AppPage.qml similarity index 56% rename from qml/UkuiMenuUI.qml rename to qml/AppUI/AppPage.qml index 73096b2..430f0d7 100644 --- a/qml/UkuiMenuUI.qml +++ b/qml/AppUI/AppPage.qml @@ -1,21 +1,9 @@ -import QtQuick 2.12 -import QtQuick.Controls 2.0 as QQC2 - -import AppUI 1.0 as AppUI -import AppControls2 1.0 as AppControls2 +import QtQuick 2.0 Item { - AppUI.AppTest { - width: 200 - height: 480 - } - ListView { - x: 200 - width: 200 - height: 480 + anchors.fill: parent clip: true - model: modelManager.getAppModel() delegate: Rectangle { width: ListView.view.width; @@ -30,9 +18,4 @@ Item { } } - AppControls2.AppTest { - x: 400 - width: 200 - height: 480 - } } diff --git a/qml/AppUI/FullScreenUI.qml b/qml/AppUI/FullScreenUI.qml new file mode 100644 index 0000000..f59978c --- /dev/null +++ b/qml/AppUI/FullScreenUI.qml @@ -0,0 +1,15 @@ +import QtQuick 2.0 + +Item { + Rectangle { + anchors.fill: parent + color: "yellow" + + MouseArea { + anchors.fill: parent; + onClicked: { + mainWindow.isFullScreen = !mainWindow.isFullScreen; + } + } + } +} diff --git a/qml/AppUI/NormalUI.qml b/qml/AppUI/NormalUI.qml new file mode 100644 index 0000000..36a93f8 --- /dev/null +++ b/qml/AppUI/NormalUI.qml @@ -0,0 +1,25 @@ +import QtQuick 2.12 +import QtQuick.Controls 2.0 as QQC2 + +Item { + Row { + anchors.fill: parent; + + AppPage { + width: 300 + height: parent.height; + } + + Sidebar { + width: parent.width - 300; + height: parent.height; + + MouseArea { + anchors.fill: parent; + onClicked: { + mainWindow.isFullScreen = !mainWindow.isFullScreen; + } + } + } + } +} diff --git a/qml/AppUI/Sidebar.qml b/qml/AppUI/Sidebar.qml new file mode 100644 index 0000000..e668f72 --- /dev/null +++ b/qml/AppUI/Sidebar.qml @@ -0,0 +1,8 @@ +import QtQuick 2.0 +import AppControls2 1.0 as AppControls2 + +Item { + AppControls2.AppTest { + anchors.fill: parent; + } +} diff --git a/qml/AppUI/qmldir b/qml/AppUI/qmldir index 9d5f677..f4c42e2 100644 --- a/qml/AppUI/qmldir +++ b/qml/AppUI/qmldir @@ -1,2 +1,5 @@ module AppUI -AppTest 1.0 App.qml +AppPage 1.0 AppPage.qml +Sidebar 1.0 Sidebar.qml +NormalUI 1.0 NormalUI.qml +FullScreenUI 1.0 FullScreenUI.qml diff --git a/qml/main.qml b/qml/main.qml index 3b5ca38..204e2e5 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -1,6 +1,7 @@ import QtQuick 2.12 import org.ukui.menu.core 1.0 +import AppUI 1.0 as AppUI MenuMainWindow { id: mainWindow @@ -12,10 +13,22 @@ MenuMainWindow { onIsFullScreenChanged: { console.log("full screen", isFullScreen) + //loader.source = isFullScreen ? "qrc:/qml/FullScreenUI.qml" : "qrc:/qml/NormalUI.qml"; } - Loader { + AppUI.NormalUI { anchors.fill: mainWindow.contentItem; - source: "qrc:/qml/UkuiMenuUI.qml" + transitions: Transition { + NumberAnimation { + easing.type: Easing.OutBounce; + properties: "width,height"; + duration: 4000; + } + } + Behavior on width { + PropertyAnimation { + + } + } } } diff --git a/qml/qml.qrc b/qml/qml.qrc index c17420f..ebf0fc2 100644 --- a/qml/qml.qrc +++ b/qml/qml.qrc @@ -1,9 +1,11 @@ main.qml - UkuiMenuUI.qml AppUI/qmldir - AppUI/App.qml + AppUI/NormalUI.qml + AppUI/FullScreenUI.qml + AppUI/AppPage.qml + AppUI/Sidebar.qml AppControls2/qmldir AppControls2/App.qml