diff --git a/example/App.qml b/example/App.qml index 7bbb1cd2..5cd88799 100644 --- a/example/App.qml +++ b/example/App.qml @@ -20,6 +20,9 @@ Window { "/login":"qrc:/page/LoginPage.qml", "/chat":"qrc:/page/ChatPage.qml", "/media":"qrc:/page/MediaPage.qml", + "/singleTaskWindow":"qrc:/page/SingleTaskWindow.qml", + "/standardWindow":"qrc:/page/StandardWindow.qml", + "/singleInstanceWindow":"qrc:/page/SingleInstanceWindow.qml" } FluApp.initialRoute = "/" FluApp.run() diff --git a/example/T_MultiWindow.qml b/example/T_MultiWindow.qml index 7bee76b8..ecffbdd1 100644 --- a/example/T_MultiWindow.qml +++ b/example/T_MultiWindow.qml @@ -24,6 +24,86 @@ FluScrollablePage{ } } + FluArea{ + Layout.fillWidth: true + height: 86 + paddings: 10 + Layout.topMargin: 20 + Column{ + spacing: 15 + anchors{ + verticalCenter: parent.verticalCenter + left: parent.left + } + FluText{ + text:"Standard模式窗口,每次都会创建新窗口" + } + FluButton{ + text:"点击创建窗口" + onClicked: { + FluApp.navigate("/standardWindow") + } + } + } + } + + FluArea{ + Layout.fillWidth: true + height: 86 + paddings: 10 + Layout.topMargin: 10 + Column{ + spacing: 15 + anchors{ + verticalCenter: parent.verticalCenter + left: parent.left + } + FluText{ + text:"SingleTask模式窗口,如果窗口存在,这激活该窗口" + textFormat: Text.RichText + } + FluButton{ + text:"点击创建窗口" + onClicked: { + FluApp.navigate("/singleTaskWindow") + } + } + } + } + + FluArea{ + Layout.fillWidth: true + height: 86 + paddings: 10 + Layout.topMargin: 10 + Column{ + spacing: 15 + anchors{ + verticalCenter: parent.verticalCenter + left: parent.left + } + FluText{ + text:"SingleInstance模式窗口,如果窗口存在,则销毁窗口,然后新建窗口" + } + FluButton{ + text:"点击创建窗口" + onClicked: { + FluApp.navigate("/singleInstanceWindow") + } + } + } + } + CodeExpander{ + Layout.fillWidth: true + code:'FluWindow{ + //launchMode: FluWindow.Standard + //launchMode: FluWindow.SingleTask + launchMode: FluWindow.SingleInstance +} +' + } + + FluArea{ Layout.fillWidth: true height: 100 diff --git a/example/page/SingleInstanceWindow.qml b/example/page/SingleInstanceWindow.qml new file mode 100644 index 00000000..1ea9f4d0 --- /dev/null +++ b/example/page/SingleInstanceWindow.qml @@ -0,0 +1,46 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import FluentUI + +FluWindow { + + id:window + + width: 500 + height: 600 + minimumWidth: 500 + minimumHeight: 600 + maximumWidth: 500 + maximumHeight: 600 + launchMode: FluWindow.SingleInstance + + title:"SingleInstance" + + FluAppBar{ + id:appbar + title:"SingleInstance" + width:parent.width + } + + FluTextBox{ + anchors{ + top:parent.top + topMargin:60 + horizontalCenter: parent.horizontalCenter + } + } + + FluText{ + wrapMode: Text.WrapAnywhere + anchors{ + left: parent.left + right: parent.right + leftMargin: 20 + rightMargin: 20 + verticalCenter: parent.verticalCenter + } + text:"我是一个SingleInstance模式的窗口,如果我存在,我会销毁之前的窗口,并创建一个新窗口" + } + +} diff --git a/example/page/SingleTaskWindow.qml b/example/page/SingleTaskWindow.qml new file mode 100644 index 00000000..6b3642cc --- /dev/null +++ b/example/page/SingleTaskWindow.qml @@ -0,0 +1,31 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import FluentUI + +FluWindow { + + id:window + + width: 500 + height: 600 + minimumWidth: 500 + minimumHeight: 600 + maximumWidth: 500 + maximumHeight: 600 + launchMode: FluWindow.SingleTask + + title:"SingleTask" + + FluAppBar{ + id:appbar + title:"SingleTask" + width:parent.width + } + + FluText{ + anchors.centerIn: parent + text:"我是一个SingleTask模式的窗口,如果我存在,我就激活窗口" + } + +} diff --git a/example/page/StandardWindow.qml b/example/page/StandardWindow.qml new file mode 100644 index 00000000..7a006cca --- /dev/null +++ b/example/page/StandardWindow.qml @@ -0,0 +1,31 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import FluentUI + +FluWindow { + + id:window + + width: 500 + height: 600 + minimumWidth: 500 + minimumHeight: 600 + maximumWidth: 500 + maximumHeight: 600 + launchMode: FluWindow.Standard + + title:"Standard" + + FluAppBar{ + id:appbar + title:"Standard" + width:parent.width + } + + FluText{ + anchors.centerIn: parent + text:"我是一个Standard模式的窗口,每次我都会创建一个新的窗口" + } + +} diff --git a/example/qml.qrc b/example/qml.qrc index b9b9433e..8aa329de 100644 --- a/example/qml.qrc +++ b/example/qml.qrc @@ -162,5 +162,8 @@ global/MainEvent.qml res/svg/home.svg res/svg/home_dark.svg + page/StandardWindow.qml + page/SingleTaskWindow.qml + page/SingleInstanceWindow.qml