mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-26 21:37:04 +08:00
update
This commit is contained in:
parent
9354b8c0bf
commit
8e1e8a9db5
@ -187,5 +187,6 @@
|
|||||||
<file>qml/page/T_StaggeredView.qml</file>
|
<file>qml/page/T_StaggeredView.qml</file>
|
||||||
<file>qml/viewmodel/SettingsViewModel.qml</file>
|
<file>qml/viewmodel/SettingsViewModel.qml</file>
|
||||||
<file>qml/viewmodel/TextBoxViewModel.qml</file>
|
<file>qml/viewmodel/TextBoxViewModel.qml</file>
|
||||||
|
<file>qml/page/T_Clip.qml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@ -139,7 +139,8 @@ FluExpander{
|
|||||||
"FluRangeSlider",
|
"FluRangeSlider",
|
||||||
"FluStaggeredView",
|
"FluStaggeredView",
|
||||||
"FluProgressButton",
|
"FluProgressButton",
|
||||||
"FluLoadingButton"
|
"FluLoadingButton",
|
||||||
|
"FluClip"
|
||||||
];
|
];
|
||||||
code = code.replace(/\n/g, "<br>");
|
code = code.replace(/\n/g, "<br>");
|
||||||
code = code.replace(/ /g, " ");
|
code = code.replace(/ /g, " ");
|
||||||
|
@ -207,6 +207,12 @@ FluObject{
|
|||||||
onDropped:{ FluApp.navigate("/pageWindow",{title:title,url:url}) }
|
onDropped:{ FluApp.navigate("/pageWindow",{title:title,url:url}) }
|
||||||
onTap:{ navigationView.push(url) }
|
onTap:{ navigationView.push(url) }
|
||||||
}
|
}
|
||||||
|
FluPaneItem{
|
||||||
|
title:"Clip"
|
||||||
|
url:"qrc:/example/qml/page/T_Clip.qml"
|
||||||
|
onDropped:{ FluApp.navigate("/pageWindow",{title:title,url:url}) }
|
||||||
|
onTap:{ navigationView.push(url) }
|
||||||
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"StatusView"
|
title:"StatusView"
|
||||||
url:"qrc:/example/qml/page/T_StatusView.qml"
|
url:"qrc:/example/qml/page/T_StatusView.qml"
|
||||||
|
@ -25,7 +25,7 @@ FluContentPage {
|
|||||||
leftMargin: 14
|
leftMargin: 14
|
||||||
}
|
}
|
||||||
onClicked: {
|
onClicked: {
|
||||||
grid_view.model = FluApp.awesomelist(text_box.text)
|
grid_view.model = FluTheme.awesomeList(text_box.text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GridView{
|
GridView{
|
||||||
@ -34,7 +34,7 @@ FluContentPage {
|
|||||||
cellHeight: 80
|
cellHeight: 80
|
||||||
clip: true
|
clip: true
|
||||||
boundsBehavior: GridView.StopAtBounds
|
boundsBehavior: GridView.StopAtBounds
|
||||||
model:FluApp.awesomelist()
|
model:FluTheme.awesomeList()
|
||||||
ScrollBar.vertical: FluScrollBar {}
|
ScrollBar.vertical: FluScrollBar {}
|
||||||
anchors{
|
anchors{
|
||||||
topMargin: 10
|
topMargin: 10
|
||||||
|
107
example/qml-Qt6/page/T_Clip.qml
Normal file
107
example/qml-Qt6/page/T_Clip.qml
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Window
|
||||||
|
import FluentUI
|
||||||
|
import "qrc:///example/qml/component"
|
||||||
|
|
||||||
|
FluScrollablePage{
|
||||||
|
|
||||||
|
title:"Clip"
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: 20
|
||||||
|
height: 380
|
||||||
|
paddings: 10
|
||||||
|
|
||||||
|
Column{
|
||||||
|
spacing: 15
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
FluText{
|
||||||
|
text:"配合图片使用(software渲染下该组件将没有效果)"
|
||||||
|
font: FluTextStyle.Subtitle
|
||||||
|
Layout.topMargin: 20
|
||||||
|
}
|
||||||
|
RowLayout{
|
||||||
|
spacing: 14
|
||||||
|
FluClip{
|
||||||
|
width: 50
|
||||||
|
height: 50
|
||||||
|
radius:[25,0,25,25]
|
||||||
|
Image {
|
||||||
|
asynchronous: true
|
||||||
|
anchors.fill: parent
|
||||||
|
source: "qrc:/example/res/svg/avatar_1.svg"
|
||||||
|
sourceSize: Qt.size(width,height)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluClip{
|
||||||
|
width: 50
|
||||||
|
height: 50
|
||||||
|
radius:[10,10,10,10]
|
||||||
|
Image {
|
||||||
|
asynchronous: true
|
||||||
|
anchors.fill: parent
|
||||||
|
sourceSize: Qt.size(width,height)
|
||||||
|
source: "qrc:/example/res/svg/avatar_2.svg"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluClip{
|
||||||
|
width: 50
|
||||||
|
height: 50
|
||||||
|
radius:[25,25,25,25]
|
||||||
|
Image {
|
||||||
|
asynchronous: true
|
||||||
|
anchors.fill: parent
|
||||||
|
sourceSize: Qt.size(width,height)
|
||||||
|
source: "qrc:/example/res/svg/avatar_3.svg"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluClip{
|
||||||
|
width: 50
|
||||||
|
height: 50
|
||||||
|
radius:[0,25,25,25]
|
||||||
|
Image {
|
||||||
|
asynchronous: true
|
||||||
|
anchors.fill: parent
|
||||||
|
sourceSize: Qt.size(width,height)
|
||||||
|
source: "qrc:/example/res/svg/avatar_4.svg"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluClip{
|
||||||
|
width: 1920/5
|
||||||
|
height: 1200/5
|
||||||
|
radius:[8,8,8,8]
|
||||||
|
Image {
|
||||||
|
asynchronous: true
|
||||||
|
source: "qrc:/example/res/image/banner_1.jpg"
|
||||||
|
anchors.fill: parent
|
||||||
|
sourceSize: Qt.size(2*width,2*height)
|
||||||
|
}
|
||||||
|
Layout.topMargin: 20
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluClip{
|
||||||
|
radius: [25,25,25,25]
|
||||||
|
width: 50
|
||||||
|
height: 50
|
||||||
|
Image{
|
||||||
|
asynchronous: true
|
||||||
|
anchors.fill: parent
|
||||||
|
source: "qrc:/example/res/svg/avatar_4.svg"
|
||||||
|
sourceSize: Qt.size(width,height)
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -12,16 +12,15 @@ FluScrollablePage{
|
|||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
height: 460
|
height: 80
|
||||||
paddings: 10
|
paddings: 10
|
||||||
|
|
||||||
Column{
|
Column{
|
||||||
spacing: 15
|
spacing: 15
|
||||||
anchors{
|
anchors{
|
||||||
verticalCenter: parent.verticalCenter
|
|
||||||
left: parent.left
|
left: parent.left
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout{
|
RowLayout{
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
FluRectangle{
|
FluRectangle{
|
||||||
@ -61,70 +60,6 @@ FluScrollablePage{
|
|||||||
radius:[0,0,0,15]
|
radius:[0,0,0,15]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluText{
|
|
||||||
text:"配合图片使用"
|
|
||||||
font: FluTextStyle.Subtitle
|
|
||||||
Layout.topMargin: 20
|
|
||||||
}
|
|
||||||
RowLayout{
|
|
||||||
spacing: 14
|
|
||||||
FluClip{
|
|
||||||
width: 50
|
|
||||||
height: 50
|
|
||||||
radius:[25,0,25,25]
|
|
||||||
Image {
|
|
||||||
asynchronous: true
|
|
||||||
anchors.fill: parent
|
|
||||||
source: "qrc:/example/res/svg/avatar_1.svg"
|
|
||||||
sourceSize: Qt.size(width,height)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FluClip{
|
|
||||||
width: 50
|
|
||||||
height: 50
|
|
||||||
radius:[10,10,10,10]
|
|
||||||
Image {
|
|
||||||
asynchronous: true
|
|
||||||
anchors.fill: parent
|
|
||||||
sourceSize: Qt.size(width,height)
|
|
||||||
source: "qrc:/example/res/svg/avatar_2.svg"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FluClip{
|
|
||||||
width: 50
|
|
||||||
height: 50
|
|
||||||
radius:[25,25,25,25]
|
|
||||||
Image {
|
|
||||||
asynchronous: true
|
|
||||||
anchors.fill: parent
|
|
||||||
sourceSize: Qt.size(width,height)
|
|
||||||
source: "qrc:/example/res/svg/avatar_3.svg"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FluClip{
|
|
||||||
width: 50
|
|
||||||
height: 50
|
|
||||||
radius:[0,25,25,25]
|
|
||||||
Image {
|
|
||||||
asynchronous: true
|
|
||||||
anchors.fill: parent
|
|
||||||
sourceSize: Qt.size(width,height)
|
|
||||||
source: "qrc:/example/res/svg/avatar_4.svg"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FluClip{
|
|
||||||
width: 1920/5
|
|
||||||
height: 1200/5
|
|
||||||
radius:[8,8,8,8]
|
|
||||||
Image {
|
|
||||||
asynchronous: true
|
|
||||||
source: "qrc:/example/res/image/banner_1.jpg"
|
|
||||||
anchors.fill: parent
|
|
||||||
sourceSize: Qt.size(2*width,2*height)
|
|
||||||
}
|
|
||||||
Layout.topMargin: 20
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
@ -134,14 +69,6 @@ FluScrollablePage{
|
|||||||
radius: [25,25,25,25]
|
radius: [25,25,25,25]
|
||||||
width: 50
|
width: 50
|
||||||
height: 50
|
height: 50
|
||||||
Image{
|
|
||||||
asynchronous: true
|
|
||||||
anchors.fill: parent
|
|
||||||
source: "qrc:/example/res/svg/avatar_4.svg"
|
|
||||||
sourceSize: Qt.size(width,height)
|
|
||||||
}
|
|
||||||
}'
|
}'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -84,8 +84,7 @@ FluScrollablePage{
|
|||||||
negativeText: "取消"
|
negativeText: "取消"
|
||||||
positiveText:"确定"
|
positiveText:"确定"
|
||||||
onPositiveClicked:{
|
onPositiveClicked:{
|
||||||
window.deleteWindow()
|
FluApp.exit(931)
|
||||||
AppInfo.restart()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ CustomWindow {
|
|||||||
id:viewmodel_settings
|
id:viewmodel_settings
|
||||||
}
|
}
|
||||||
|
|
||||||
closeFunc:function(event){
|
closeListener:function(event){
|
||||||
dialog_close.open()
|
dialog_close.open()
|
||||||
event.accepted = false
|
event.accepted = false
|
||||||
}
|
}
|
||||||
@ -58,8 +58,7 @@ CustomWindow {
|
|||||||
MenuItem {
|
MenuItem {
|
||||||
text: "退出"
|
text: "退出"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
window.deleteWindow()
|
FluApp.exit()
|
||||||
FluApp.closeApp()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -86,8 +85,7 @@ CustomWindow {
|
|||||||
positiveText:"退出"
|
positiveText:"退出"
|
||||||
neutralText:"取消"
|
neutralText:"取消"
|
||||||
onPositiveClicked:{
|
onPositiveClicked:{
|
||||||
window.deleteWindow()
|
FluApp.exit()
|
||||||
FluApp.closeApp()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,8 @@ FluExpander{
|
|||||||
"FluRangeSlider",
|
"FluRangeSlider",
|
||||||
"FluStaggeredView",
|
"FluStaggeredView",
|
||||||
"FluProgressButton",
|
"FluProgressButton",
|
||||||
"FluLoadingButton"
|
"FluLoadingButton",
|
||||||
|
"FluClip"
|
||||||
];
|
];
|
||||||
code = code.replace(/\n/g, "<br>");
|
code = code.replace(/\n/g, "<br>");
|
||||||
code = code.replace(/ /g, " ");
|
code = code.replace(/ /g, " ");
|
||||||
|
@ -207,6 +207,12 @@ FluObject{
|
|||||||
onDropped:{ FluApp.navigate("/pageWindow",{title:title,url:url}) }
|
onDropped:{ FluApp.navigate("/pageWindow",{title:title,url:url}) }
|
||||||
onTap:{ navigationView.push(url) }
|
onTap:{ navigationView.push(url) }
|
||||||
}
|
}
|
||||||
|
FluPaneItem{
|
||||||
|
title:"Clip"
|
||||||
|
url:"qrc:/example/qml/page/T_Clip.qml"
|
||||||
|
onDropped:{ FluApp.navigate("/pageWindow",{title:title,url:url}) }
|
||||||
|
onTap:{ navigationView.push(url) }
|
||||||
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"StatusView"
|
title:"StatusView"
|
||||||
url:"qrc:/example/qml/page/T_StatusView.qml"
|
url:"qrc:/example/qml/page/T_StatusView.qml"
|
||||||
|
@ -25,7 +25,7 @@ FluContentPage {
|
|||||||
leftMargin: 14
|
leftMargin: 14
|
||||||
}
|
}
|
||||||
onClicked: {
|
onClicked: {
|
||||||
grid_view.model = FluApp.awesomelist(text_box.text)
|
grid_view.model = FluTheme.awesomeList(text_box.text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GridView{
|
GridView{
|
||||||
@ -34,7 +34,7 @@ FluContentPage {
|
|||||||
cellHeight: 80
|
cellHeight: 80
|
||||||
clip: true
|
clip: true
|
||||||
boundsBehavior: GridView.StopAtBounds
|
boundsBehavior: GridView.StopAtBounds
|
||||||
model:FluApp.awesomelist()
|
model:FluTheme.awesomeList()
|
||||||
ScrollBar.vertical: FluScrollBar {}
|
ScrollBar.vertical: FluScrollBar {}
|
||||||
anchors{
|
anchors{
|
||||||
topMargin: 10
|
topMargin: 10
|
||||||
|
108
example/qml/page/T_Clip.qml
Normal file
108
example/qml/page/T_Clip.qml
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
import QtQuick 2.15
|
||||||
|
import QtQuick.Layouts 1.15
|
||||||
|
import QtQuick.Controls 2.15
|
||||||
|
import QtQuick.Window 2.15
|
||||||
|
import FluentUI 1.0
|
||||||
|
import "../component"
|
||||||
|
import "qrc:///example/qml/component"
|
||||||
|
|
||||||
|
FluScrollablePage{
|
||||||
|
|
||||||
|
title:"Clip"
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: 20
|
||||||
|
height: 380
|
||||||
|
paddings: 10
|
||||||
|
|
||||||
|
Column{
|
||||||
|
spacing: 15
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
FluText{
|
||||||
|
text:"配合图片使用(software渲染下该组件将没有效果)"
|
||||||
|
font: FluTextStyle.Subtitle
|
||||||
|
Layout.topMargin: 20
|
||||||
|
}
|
||||||
|
RowLayout{
|
||||||
|
spacing: 14
|
||||||
|
FluClip{
|
||||||
|
width: 50
|
||||||
|
height: 50
|
||||||
|
radius:[25,0,25,25]
|
||||||
|
Image {
|
||||||
|
asynchronous: true
|
||||||
|
anchors.fill: parent
|
||||||
|
source: "qrc:/example/res/svg/avatar_1.svg"
|
||||||
|
sourceSize: Qt.size(width,height)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluClip{
|
||||||
|
width: 50
|
||||||
|
height: 50
|
||||||
|
radius:[10,10,10,10]
|
||||||
|
Image {
|
||||||
|
asynchronous: true
|
||||||
|
anchors.fill: parent
|
||||||
|
sourceSize: Qt.size(width,height)
|
||||||
|
source: "qrc:/example/res/svg/avatar_2.svg"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluClip{
|
||||||
|
width: 50
|
||||||
|
height: 50
|
||||||
|
radius:[25,25,25,25]
|
||||||
|
Image {
|
||||||
|
asynchronous: true
|
||||||
|
anchors.fill: parent
|
||||||
|
sourceSize: Qt.size(width,height)
|
||||||
|
source: "qrc:/example/res/svg/avatar_3.svg"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluClip{
|
||||||
|
width: 50
|
||||||
|
height: 50
|
||||||
|
radius:[0,25,25,25]
|
||||||
|
Image {
|
||||||
|
asynchronous: true
|
||||||
|
anchors.fill: parent
|
||||||
|
sourceSize: Qt.size(width,height)
|
||||||
|
source: "qrc:/example/res/svg/avatar_4.svg"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluClip{
|
||||||
|
width: 1920/5
|
||||||
|
height: 1200/5
|
||||||
|
radius:[8,8,8,8]
|
||||||
|
Image {
|
||||||
|
asynchronous: true
|
||||||
|
source: "qrc:/example/res/image/banner_1.jpg"
|
||||||
|
anchors.fill: parent
|
||||||
|
sourceSize: Qt.size(2*width,2*height)
|
||||||
|
}
|
||||||
|
Layout.topMargin: 20
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluClip{
|
||||||
|
radius: [25,25,25,25]
|
||||||
|
width: 50
|
||||||
|
height: 50
|
||||||
|
Image{
|
||||||
|
asynchronous: true
|
||||||
|
anchors.fill: parent
|
||||||
|
source: "qrc:/example/res/svg/avatar_4.svg"
|
||||||
|
sourceSize: Qt.size(width,height)
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -13,16 +13,15 @@ FluScrollablePage{
|
|||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
height: 460
|
height: 80
|
||||||
paddings: 10
|
paddings: 10
|
||||||
|
|
||||||
Column{
|
Column{
|
||||||
spacing: 15
|
spacing: 15
|
||||||
anchors{
|
anchors{
|
||||||
verticalCenter: parent.verticalCenter
|
|
||||||
left: parent.left
|
left: parent.left
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout{
|
RowLayout{
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
FluRectangle{
|
FluRectangle{
|
||||||
@ -62,70 +61,6 @@ FluScrollablePage{
|
|||||||
radius:[0,0,0,15]
|
radius:[0,0,0,15]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluText{
|
|
||||||
text:"配合图片使用"
|
|
||||||
font: FluTextStyle.Subtitle
|
|
||||||
Layout.topMargin: 20
|
|
||||||
}
|
|
||||||
RowLayout{
|
|
||||||
spacing: 14
|
|
||||||
FluClip{
|
|
||||||
width: 50
|
|
||||||
height: 50
|
|
||||||
radius:[25,0,25,25]
|
|
||||||
Image {
|
|
||||||
asynchronous: true
|
|
||||||
anchors.fill: parent
|
|
||||||
source: "qrc:/example/res/svg/avatar_1.svg"
|
|
||||||
sourceSize: Qt.size(width,height)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FluClip{
|
|
||||||
width: 50
|
|
||||||
height: 50
|
|
||||||
radius:[10,10,10,10]
|
|
||||||
Image {
|
|
||||||
asynchronous: true
|
|
||||||
anchors.fill: parent
|
|
||||||
sourceSize: Qt.size(width,height)
|
|
||||||
source: "qrc:/example/res/svg/avatar_2.svg"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FluClip{
|
|
||||||
width: 50
|
|
||||||
height: 50
|
|
||||||
radius:[25,25,25,25]
|
|
||||||
Image {
|
|
||||||
asynchronous: true
|
|
||||||
anchors.fill: parent
|
|
||||||
sourceSize: Qt.size(width,height)
|
|
||||||
source: "qrc:/example/res/svg/avatar_3.svg"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FluClip{
|
|
||||||
width: 50
|
|
||||||
height: 50
|
|
||||||
radius:[0,25,25,25]
|
|
||||||
Image {
|
|
||||||
asynchronous: true
|
|
||||||
anchors.fill: parent
|
|
||||||
sourceSize: Qt.size(width,height)
|
|
||||||
source: "qrc:/example/res/svg/avatar_4.svg"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FluClip{
|
|
||||||
width: 1920/5
|
|
||||||
height: 1200/5
|
|
||||||
radius:[8,8,8,8]
|
|
||||||
Image {
|
|
||||||
asynchronous: true
|
|
||||||
source: "qrc:/example/res/image/banner_1.jpg"
|
|
||||||
anchors.fill: parent
|
|
||||||
sourceSize: Qt.size(2*width,2*height)
|
|
||||||
}
|
|
||||||
Layout.topMargin: 20
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
@ -135,14 +70,6 @@ FluScrollablePage{
|
|||||||
radius: [25,25,25,25]
|
radius: [25,25,25,25]
|
||||||
width: 50
|
width: 50
|
||||||
height: 50
|
height: 50
|
||||||
Image{
|
|
||||||
asynchronous: true
|
|
||||||
anchors.fill: parent
|
|
||||||
source: "qrc:/example/res/svg/avatar_4.svg"
|
|
||||||
sourceSize: Qt.size(width,height)
|
|
||||||
}
|
|
||||||
}'
|
}'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -87,8 +87,7 @@ FluScrollablePage{
|
|||||||
negativeText: "取消"
|
negativeText: "取消"
|
||||||
positiveText:"确定"
|
positiveText:"确定"
|
||||||
onPositiveClicked:{
|
onPositiveClicked:{
|
||||||
window.deleteWindow()
|
FluApp.exit(931)
|
||||||
AppInfo.restart()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ CustomWindow {
|
|||||||
id:viewmodel_settings
|
id:viewmodel_settings
|
||||||
}
|
}
|
||||||
|
|
||||||
closeFunc:function(event){
|
closeListener:function(event){
|
||||||
dialog_close.open()
|
dialog_close.open()
|
||||||
event.accepted = false
|
event.accepted = false
|
||||||
}
|
}
|
||||||
@ -61,8 +61,7 @@ CustomWindow {
|
|||||||
MenuItem {
|
MenuItem {
|
||||||
text: "退出"
|
text: "退出"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
window.deleteWindow()
|
FluApp.exit()
|
||||||
FluApp.closeApp()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -89,8 +88,7 @@ CustomWindow {
|
|||||||
positiveText:"退出"
|
positiveText:"退出"
|
||||||
neutralText:"取消"
|
neutralText:"取消"
|
||||||
onPositiveClicked:{
|
onPositiveClicked:{
|
||||||
window.deleteWindow()
|
FluApp.exit()
|
||||||
FluApp.closeApp()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,3 @@ void AppInfo::changeLang(const QString& locale){
|
|||||||
lang(new En());
|
lang(new En());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppInfo::restart(){
|
|
||||||
qApp->exit(931);
|
|
||||||
}
|
|
||||||
|
@ -18,7 +18,6 @@ public:
|
|||||||
SINGLETONG(AppInfo)
|
SINGLETONG(AppInfo)
|
||||||
void init(QQmlApplicationEngine *engine);
|
void init(QQmlApplicationEngine *engine);
|
||||||
Q_INVOKABLE void changeLang(const QString& locale);
|
Q_INVOKABLE void changeLang(const QString& locale);
|
||||||
Q_INVOKABLE void restart();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // APPINFO_H
|
#endif // APPINFO_H
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
#include <QFontDatabase>
|
#include <QFontDatabase>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include "Def.h"
|
|
||||||
|
|
||||||
FluApp::FluApp(QObject *parent):QObject{parent}{
|
FluApp::FluApp(QObject *parent):QObject{parent}{
|
||||||
httpInterceptor(nullptr);
|
httpInterceptor(nullptr);
|
||||||
@ -18,7 +17,7 @@ FluApp::~FluApp(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FluApp::init(QQuickWindow *window){
|
void FluApp::init(QQuickWindow *window){
|
||||||
this->appWindow = window;
|
this->_application = window;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluApp::run(){
|
void FluApp::run(){
|
||||||
@ -30,7 +29,7 @@ void FluApp::navigate(const QString& route,const QJsonObject& argument,FluRegist
|
|||||||
qCritical()<<"No route found "<<route;
|
qCritical()<<"No route found "<<route;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QQmlEngine *engine = qmlEngine(appWindow);
|
QQmlEngine *engine = qmlEngine(_application);
|
||||||
QQmlComponent component(engine, routes().value(route).toString());
|
QQmlComponent component(engine, routes().value(route).toString());
|
||||||
if (component.isError()) {
|
if (component.isError()) {
|
||||||
qCritical() << component.errors();
|
qCritical() << component.errors();
|
||||||
@ -42,65 +41,47 @@ void FluApp::navigate(const QString& route,const QJsonObject& argument,FluRegist
|
|||||||
properties.insert("_pageRegister",QVariant::fromValue(fluRegister));
|
properties.insert("_pageRegister",QVariant::fromValue(fluRegister));
|
||||||
}
|
}
|
||||||
properties.insert("argument",argument);
|
properties.insert("argument",argument);
|
||||||
QQuickWindow *view=nullptr;
|
QQuickWindow *win=nullptr;
|
||||||
for (auto& pair : wnds) {
|
for (const auto& pair : _windows.toStdMap()) {
|
||||||
QString r = pair->property("_route").toString();
|
QString r = pair.second->property("_route").toString();
|
||||||
if(r == route){
|
if(r == route){
|
||||||
view = pair;
|
win = pair.second;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(view){
|
if(win){
|
||||||
//如果窗口存在,则判断启动模式
|
int launchMode = win->property("launchMode").toInt();
|
||||||
int launchMode = view->property("launchMode").toInt();
|
|
||||||
if(launchMode == 1){
|
if(launchMode == 1){
|
||||||
view->setProperty("argument",argument);
|
win->setProperty("argument",argument);
|
||||||
view->show();
|
win->show();
|
||||||
view->raise();
|
win->raise();
|
||||||
view->requestActivate();
|
win->requestActivate();
|
||||||
return;
|
return;
|
||||||
}else if(launchMode == 2){
|
}else if(launchMode == 2){
|
||||||
view->close();
|
win->close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
view = qobject_cast<QQuickWindow*>(component.createWithInitialProperties(properties));
|
win = qobject_cast<QQuickWindow*>(component.createWithInitialProperties(properties));
|
||||||
wnds.insert(view->winId(),view);
|
|
||||||
if(fluRegister){
|
if(fluRegister){
|
||||||
fluRegister->to(view);
|
fluRegister->to(win);
|
||||||
}
|
}
|
||||||
view->setColor(QColor(Qt::transparent));
|
win->setColor(QColor(Qt::transparent));
|
||||||
}
|
}
|
||||||
|
|
||||||
QJsonArray FluApp::awesomelist(const QString& keyword){
|
void FluApp::exit(int retCode){
|
||||||
QJsonArray arr;
|
for (const auto& pair : _windows.toStdMap()) {
|
||||||
QMetaEnum enumType = Fluent_Awesome::staticMetaObject.enumerator(Fluent_Awesome::staticMetaObject.indexOfEnumerator("Fluent_AwesomeType"));
|
removeWindow(pair.second);
|
||||||
for(int i=0; i < enumType.keyCount(); ++i){
|
|
||||||
QString name = enumType.key(i);
|
|
||||||
int icon = enumType.value(i);
|
|
||||||
if(keyword.isEmpty()){
|
|
||||||
QJsonObject obj;
|
|
||||||
obj.insert("name",name);
|
|
||||||
obj.insert("icon",icon);
|
|
||||||
arr.append(obj);
|
|
||||||
}else{
|
|
||||||
if(name.contains(keyword)){
|
|
||||||
QJsonObject obj;
|
|
||||||
obj.insert("name",name);
|
|
||||||
obj.insert("icon",icon);
|
|
||||||
arr.append(obj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return arr;
|
qApp->exit(retCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluApp::closeApp(){
|
void FluApp::addWindow(QQuickWindow* window){
|
||||||
qApp->exit(0);
|
_windows.insert(window->winId(),window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluApp::deleteWindow(QQuickWindow* window){
|
void FluApp::removeWindow(QQuickWindow* window){
|
||||||
if(window){
|
if(window){
|
||||||
wnds.remove(window->winId());
|
_windows.remove(window->winId());
|
||||||
window->deleteLater();
|
window->deleteLater();
|
||||||
window = nullptr;
|
window = nullptr;
|
||||||
}
|
}
|
||||||
|
11
src/FluApp.h
11
src/FluApp.h
@ -33,13 +33,12 @@ public:
|
|||||||
Q_INVOKABLE void run();
|
Q_INVOKABLE void run();
|
||||||
Q_INVOKABLE void navigate(const QString& route,const QJsonObject& argument = {},FluRegister* fluRegister = nullptr);
|
Q_INVOKABLE void navigate(const QString& route,const QJsonObject& argument = {},FluRegister* fluRegister = nullptr);
|
||||||
Q_INVOKABLE void init(QQuickWindow *window);
|
Q_INVOKABLE void init(QQuickWindow *window);
|
||||||
Q_INVOKABLE QJsonArray awesomelist(const QString& keyword = "");
|
Q_INVOKABLE void exit(int retCode = 0);
|
||||||
Q_INVOKABLE void closeApp();
|
void addWindow(QQuickWindow* window);
|
||||||
Q_INVOKABLE void deleteWindow(QQuickWindow* window);
|
void removeWindow(QQuickWindow* window);
|
||||||
public:
|
|
||||||
QMap<quint64, QQuickWindow*> wnds;
|
|
||||||
private:
|
private:
|
||||||
QWindow *appWindow;
|
QMap<quint64, QQuickWindow*> _windows;
|
||||||
|
QWindow* _application;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FLUAPP_H
|
#endif // FLUAPP_H
|
||||||
|
@ -110,11 +110,16 @@ void FluHttp::post(HttpRequest* r,HttpCallable* c){
|
|||||||
part.setBody(value.toUtf8());
|
part.setBody(value.toUtf8());
|
||||||
multiPart.append(part);
|
multiPart.append(part);
|
||||||
}
|
}
|
||||||
QEventLoop loop;
|
|
||||||
QNetworkReply* reply = manager.post(req,&multiPart);
|
QNetworkReply* reply = manager.post(req,&multiPart);
|
||||||
|
if(!QPointer(qApp)){
|
||||||
|
reply->deleteLater();
|
||||||
|
reply = nullptr;
|
||||||
|
return;
|
||||||
|
}
|
||||||
_cacheReply.append(reply);
|
_cacheReply.append(reply);
|
||||||
|
QEventLoop loop;
|
||||||
connect(&manager,&QNetworkAccessManager::finished,&manager,[&loop](QNetworkReply *reply){loop.quit();});
|
connect(&manager,&QNetworkAccessManager::finished,&manager,[&loop](QNetworkReply *reply){loop.quit();});
|
||||||
connect(qApp,&QGuiApplication::aboutToQuit,&manager, [&loop](){loop.quit();});
|
connect(qApp,&QGuiApplication::aboutToQuit,&manager, [&loop,reply](){reply->abort(),loop.quit();});
|
||||||
loop.exec();
|
loop.exec();
|
||||||
QString result = QString::fromUtf8(reply->readAll());
|
QString result = QString::fromUtf8(reply->readAll());
|
||||||
int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||||
@ -169,11 +174,16 @@ void FluHttp::postString(HttpRequest* r,HttpCallable* c){
|
|||||||
addHeaders(&req,data["headers"].toMap());
|
addHeaders(&req,data["headers"].toMap());
|
||||||
QString contentType = QString("text/plain;charset=utf-8");
|
QString contentType = QString("text/plain;charset=utf-8");
|
||||||
req.setHeader(QNetworkRequest::ContentTypeHeader, contentType);
|
req.setHeader(QNetworkRequest::ContentTypeHeader, contentType);
|
||||||
QEventLoop loop;
|
|
||||||
QNetworkReply* reply = manager.post(req,params.toUtf8());
|
QNetworkReply* reply = manager.post(req,params.toUtf8());
|
||||||
|
if(!QPointer(qApp)){
|
||||||
|
reply->deleteLater();
|
||||||
|
reply = nullptr;
|
||||||
|
return;
|
||||||
|
}
|
||||||
_cacheReply.append(reply);
|
_cacheReply.append(reply);
|
||||||
|
QEventLoop loop;
|
||||||
connect(&manager,&QNetworkAccessManager::finished,&manager,[&loop](QNetworkReply *reply){loop.quit();});
|
connect(&manager,&QNetworkAccessManager::finished,&manager,[&loop](QNetworkReply *reply){loop.quit();});
|
||||||
connect(qApp,&QGuiApplication::aboutToQuit,&manager, [&loop](){loop.quit();});
|
connect(qApp,&QGuiApplication::aboutToQuit,&manager, [&loop,reply](){reply->abort(),loop.quit();});
|
||||||
loop.exec();
|
loop.exec();
|
||||||
QString result = QString::fromUtf8(reply->readAll());
|
QString result = QString::fromUtf8(reply->readAll());
|
||||||
int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||||
@ -227,11 +237,16 @@ void FluHttp::postJson(HttpRequest* r,HttpCallable* c){
|
|||||||
addHeaders(&req,data["headers"].toMap());
|
addHeaders(&req,data["headers"].toMap());
|
||||||
QString contentType = QString("application/json;charset=utf-8");
|
QString contentType = QString("application/json;charset=utf-8");
|
||||||
req.setHeader(QNetworkRequest::ContentTypeHeader, contentType);
|
req.setHeader(QNetworkRequest::ContentTypeHeader, contentType);
|
||||||
QEventLoop loop;
|
|
||||||
QNetworkReply* reply = manager.post(req,QJsonDocument::fromVariant(data["params"]).toJson());
|
QNetworkReply* reply = manager.post(req,QJsonDocument::fromVariant(data["params"]).toJson());
|
||||||
|
if(!QPointer(qApp)){
|
||||||
|
reply->deleteLater();
|
||||||
|
reply = nullptr;
|
||||||
|
return;
|
||||||
|
}
|
||||||
_cacheReply.append(reply);
|
_cacheReply.append(reply);
|
||||||
|
QEventLoop loop;
|
||||||
connect(&manager,&QNetworkAccessManager::finished,&manager,[&loop](QNetworkReply *reply){loop.quit();});
|
connect(&manager,&QNetworkAccessManager::finished,&manager,[&loop](QNetworkReply *reply){loop.quit();});
|
||||||
connect(qApp,&QGuiApplication::aboutToQuit,&manager, [&loop](){loop.quit();});
|
connect(qApp,&QGuiApplication::aboutToQuit,&manager, [&loop,reply](){reply->abort(),loop.quit();});
|
||||||
loop.exec();
|
loop.exec();
|
||||||
QString result = QString::fromUtf8(reply->readAll());
|
QString result = QString::fromUtf8(reply->readAll());
|
||||||
int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||||
@ -284,11 +299,16 @@ void FluHttp::get(HttpRequest* r,HttpCallable* c){
|
|||||||
addQueryParam(&url,data["params"].toMap());
|
addQueryParam(&url,data["params"].toMap());
|
||||||
QNetworkRequest req(url);
|
QNetworkRequest req(url);
|
||||||
addHeaders(&req,data["headers"].toMap());
|
addHeaders(&req,data["headers"].toMap());
|
||||||
QEventLoop loop;
|
QNetworkReply* reply = manager.get(req);
|
||||||
auto reply = QPointer(manager.get(req));
|
if(!QPointer(qApp)){
|
||||||
|
reply->deleteLater();
|
||||||
|
reply = nullptr;
|
||||||
|
return;
|
||||||
|
}
|
||||||
_cacheReply.append(reply);
|
_cacheReply.append(reply);
|
||||||
|
QEventLoop loop;
|
||||||
connect(&manager,&QNetworkAccessManager::finished,&manager,[&loop](QNetworkReply *reply){loop.quit();});
|
connect(&manager,&QNetworkAccessManager::finished,&manager,[&loop](QNetworkReply *reply){loop.quit();});
|
||||||
connect(qApp,&QGuiApplication::aboutToQuit,&manager, [&loop](){loop.quit();});
|
connect(qApp,&QGuiApplication::aboutToQuit,&manager, [&loop,reply](){reply->abort(),loop.quit();});
|
||||||
loop.exec();
|
loop.exec();
|
||||||
int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||||
QString errorString = reply->errorString();
|
QString errorString = reply->errorString();
|
||||||
@ -337,9 +357,6 @@ void FluHttp::download(HttpRequest* r,HttpCallable* c){
|
|||||||
if (!dir.exists(dir.path())){
|
if (!dir.exists(dir.path())){
|
||||||
dir.mkpath(dir.path());
|
dir.mkpath(dir.path());
|
||||||
}
|
}
|
||||||
QEventLoop loop;
|
|
||||||
connect(&manager,&QNetworkAccessManager::finished,&manager,[&loop](QNetworkReply *reply){loop.quit();});
|
|
||||||
connect(qApp,&QGuiApplication::aboutToQuit,&manager, [&loop](){loop.quit();});
|
|
||||||
qint64 seek = 0;
|
qint64 seek = 0;
|
||||||
auto filePath = getCacheFilePath(httpId);
|
auto filePath = getCacheFilePath(httpId);
|
||||||
QSharedPointer<QFile> fileCache(new QFile(filePath));
|
QSharedPointer<QFile> fileCache(new QFile(filePath));
|
||||||
@ -364,7 +381,15 @@ void FluHttp::download(HttpRequest* r,HttpCallable* c){
|
|||||||
file->open(QIODevice::WriteOnly|QIODevice::Truncate);
|
file->open(QIODevice::WriteOnly|QIODevice::Truncate);
|
||||||
}
|
}
|
||||||
QNetworkReply* reply = manager.get(req);
|
QNetworkReply* reply = manager.get(req);
|
||||||
|
if(!QPointer(qApp)){
|
||||||
|
reply->deleteLater();
|
||||||
|
reply = nullptr;
|
||||||
|
return;
|
||||||
|
}
|
||||||
_cacheReply.append(reply);
|
_cacheReply.append(reply);
|
||||||
|
QEventLoop loop;
|
||||||
|
connect(&manager,&QNetworkAccessManager::finished,&manager,[&loop](QNetworkReply *reply){loop.quit();});
|
||||||
|
connect(qApp,&QGuiApplication::aboutToQuit,&manager, [&loop,reply](){reply->abort(),loop.quit();});
|
||||||
if (!fileCache->open(QIODevice::WriteOnly|QIODevice::Truncate))
|
if (!fileCache->open(QIODevice::WriteOnly|QIODevice::Truncate))
|
||||||
{
|
{
|
||||||
qDebug()<<"FileCache Error";
|
qDebug()<<"FileCache Error";
|
||||||
@ -411,7 +436,6 @@ void FluHttp::upload(HttpRequest* request,HttpCallable* callable){
|
|||||||
QNetworkRequest req(url);
|
QNetworkRequest req(url);
|
||||||
addHeaders(&req,data["headers"].toMap());
|
addHeaders(&req,data["headers"].toMap());
|
||||||
QHttpMultiPart multiPart(QHttpMultiPart::FormDataType);
|
QHttpMultiPart multiPart(QHttpMultiPart::FormDataType);
|
||||||
qDebug()<<data["params"].toMap();
|
|
||||||
for (const auto& each : data["params"].toMap().toStdMap())
|
for (const auto& each : data["params"].toMap().toStdMap())
|
||||||
{
|
{
|
||||||
const QString& key = each.first;
|
const QString& key = each.first;
|
||||||
@ -426,11 +450,16 @@ void FluHttp::upload(HttpRequest* request,HttpCallable* callable){
|
|||||||
part.setBodyDevice(file);
|
part.setBodyDevice(file);
|
||||||
multiPart.append(part);
|
multiPart.append(part);
|
||||||
}
|
}
|
||||||
QEventLoop loop;
|
|
||||||
QNetworkReply* reply = manager.post(req,&multiPart);
|
QNetworkReply* reply = manager.post(req,&multiPart);
|
||||||
|
if(!QPointer(qApp)){
|
||||||
|
reply->deleteLater();
|
||||||
|
reply = nullptr;
|
||||||
|
return;
|
||||||
|
}
|
||||||
_cacheReply.append(reply);
|
_cacheReply.append(reply);
|
||||||
|
QEventLoop loop;
|
||||||
connect(&manager,&QNetworkAccessManager::finished,&manager,[&loop](QNetworkReply *reply){loop.quit();});
|
connect(&manager,&QNetworkAccessManager::finished,&manager,[&loop](QNetworkReply *reply){loop.quit();});
|
||||||
connect(qApp,&QGuiApplication::aboutToQuit,&manager, [&loop](){loop.quit();});
|
connect(qApp,&QGuiApplication::aboutToQuit,&manager, [&loop,reply](){reply->abort(),loop.quit();});
|
||||||
connect(reply,&QNetworkReply::uploadProgress,reply,[=](qint64 bytesSent, qint64 bytesTotal){
|
connect(reply,&QNetworkReply::uploadProgress,reply,[=](qint64 bytesSent, qint64 bytesTotal){
|
||||||
onUploadProgress(callable,bytesSent,bytesTotal);
|
onUploadProgress(callable,bytesSent,bytesTotal);
|
||||||
});
|
});
|
||||||
|
@ -36,6 +36,22 @@ bool FluTheme::eventFilter(QObject *obj, QEvent *event){
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QJsonArray FluTheme::awesomeList(const QString& keyword){
|
||||||
|
QJsonArray arr;
|
||||||
|
QMetaEnum enumType = Fluent_Awesome::staticMetaObject.enumerator(Fluent_Awesome::staticMetaObject.indexOfEnumerator("Fluent_AwesomeType"));
|
||||||
|
for(int i=0; i < enumType.keyCount(); ++i){
|
||||||
|
QString name = enumType.key(i);
|
||||||
|
int icon = enumType.value(i);
|
||||||
|
if(keyword.isEmpty() || name.contains(keyword)){
|
||||||
|
QJsonObject obj;
|
||||||
|
obj.insert("name",name);
|
||||||
|
obj.insert("icon",icon);
|
||||||
|
arr.append(obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
bool FluTheme::systemDark(){
|
bool FluTheme::systemDark(){
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0))
|
||||||
return (QGuiApplication::styleHints()->colorScheme() == Qt::ColorScheme::Dark);
|
return (QGuiApplication::styleHints()->colorScheme() == Qt::ColorScheme::Dark);
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QtQml/qqml.h>
|
#include <QtQml/qqml.h>
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QJsonObject>
|
||||||
#include "FluColorSet.h"
|
#include "FluColorSet.h"
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "singleton.h"
|
#include "singleton.h"
|
||||||
@ -26,9 +28,10 @@ private:
|
|||||||
bool systemDark();
|
bool systemDark();
|
||||||
public:
|
public:
|
||||||
SINGLETONG(FluTheme)
|
SINGLETONG(FluTheme)
|
||||||
|
Q_INVOKABLE QJsonArray awesomeList(const QString& keyword = "");
|
||||||
|
Q_SIGNAL void darkChanged();
|
||||||
static FluTheme *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine){return getInstance();}
|
static FluTheme *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine){return getInstance();}
|
||||||
bool dark();
|
bool dark();
|
||||||
Q_SIGNAL void darkChanged();
|
|
||||||
private:
|
private:
|
||||||
bool _dark;
|
bool _dark;
|
||||||
bool _systemDark;
|
bool _systemDark;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "FluentUI.h"
|
#include "FluentUI.h"
|
||||||
|
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
#include "WindowHelper.h"
|
#include "WindowLifecycle.h"
|
||||||
#include "Def.h"
|
#include "Def.h"
|
||||||
#include "FluApp.h"
|
#include "FluApp.h"
|
||||||
#include "FluColors.h"
|
#include "FluColors.h"
|
||||||
@ -42,7 +42,7 @@ void FluentUI::registerTypes(const char *uri){
|
|||||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 2, 0))
|
#if (QT_VERSION < QT_VERSION_CHECK(6, 2, 0))
|
||||||
Q_INIT_RESOURCE(fluentui);
|
Q_INIT_RESOURCE(fluentui);
|
||||||
#endif
|
#endif
|
||||||
qmlRegisterType<WindowHelper>(uri,major,minor,"WindowHelper");
|
qmlRegisterType<WindowLifecycle>(uri,major,minor,"WindowLifecycle");
|
||||||
qmlRegisterType<QRCode>(uri,major,minor,"QRCode");
|
qmlRegisterType<QRCode>(uri,major,minor,"QRCode");
|
||||||
qmlRegisterType<FluCaptcha>(uri,major,minor,"FluCaptcha");
|
qmlRegisterType<FluCaptcha>(uri,major,minor,"FluCaptcha");
|
||||||
qmlRegisterType<FluWatermark>(uri,major,minor,"FluWatermark");
|
qmlRegisterType<FluWatermark>(uri,major,minor,"FluWatermark");
|
||||||
|
@ -202,7 +202,6 @@ Item {
|
|||||||
d.dropIndex = -1
|
d.dropIndex = -1
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
console.debug(index)
|
|
||||||
if(tree_model.hitHasChildrenExpanded(index) && y>index*control.cellHeight+control.cellHeight/2){
|
if(tree_model.hitHasChildrenExpanded(index) && y>index*control.cellHeight+control.cellHeight/2){
|
||||||
d.dropIndex = index + 1
|
d.dropIndex = index + 1
|
||||||
d.isDropTopArea = true
|
d.isDropTopArea = true
|
||||||
|
@ -19,9 +19,9 @@ Window {
|
|||||||
}
|
}
|
||||||
property var _pageRegister
|
property var _pageRegister
|
||||||
property string _route
|
property string _route
|
||||||
property var closeFunc: function(event){
|
property var closeListener: function(event){
|
||||||
if(closeDestory){
|
if(closeDestory){
|
||||||
deleteWindow()
|
destoryOnClose()
|
||||||
}else{
|
}else{
|
||||||
visible = false
|
visible = false
|
||||||
event.accepted = false
|
event.accepted = false
|
||||||
@ -31,12 +31,18 @@ Window {
|
|||||||
id:window
|
id:window
|
||||||
color:"transparent"
|
color:"transparent"
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
helper.initWindow(window)
|
lifecycle.onCompleted(window)
|
||||||
initArgument(argument)
|
initArgument(argument)
|
||||||
}
|
}
|
||||||
|
Component.onDestruction: {
|
||||||
|
lifecycle.onDestruction()
|
||||||
|
}
|
||||||
|
onVisibleChanged: {
|
||||||
|
lifecycle.onVisible(visible)
|
||||||
|
}
|
||||||
Connections{
|
Connections{
|
||||||
target: window
|
target: window
|
||||||
function onClosing(event){closeFunc(event)}
|
function onClosing(event){closeListener(event)}
|
||||||
}
|
}
|
||||||
Component{
|
Component{
|
||||||
id:com_background
|
id:com_background
|
||||||
@ -126,8 +132,11 @@ Window {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WindowHelper{
|
WindowLifecycle{
|
||||||
id:helper
|
id:lifecycle
|
||||||
|
}
|
||||||
|
function destoryOnClose(){
|
||||||
|
lifecycle.onDestoryOnClose()
|
||||||
}
|
}
|
||||||
function showLoading(text = "加载中...",cancel = true){
|
function showLoading(text = "加载中...",cancel = true){
|
||||||
loader_loading.loadingText = text
|
loader_loading.loadingText = text
|
||||||
@ -150,10 +159,7 @@ Window {
|
|||||||
infoBar.showError(text,duration,moremsg)
|
infoBar.showError(text,duration,moremsg)
|
||||||
}
|
}
|
||||||
function registerForWindowResult(path){
|
function registerForWindowResult(path){
|
||||||
return helper.createRegister(window,path)
|
return lifecycle.createRegister(window,path)
|
||||||
}
|
|
||||||
function deleteWindow(){
|
|
||||||
FluApp.deleteWindow(window)
|
|
||||||
}
|
}
|
||||||
function onResult(data){
|
function onResult(data){
|
||||||
if(_pageRegister){
|
if(_pageRegister){
|
||||||
|
@ -4,7 +4,7 @@ import QtQuick.tooling 1.2
|
|||||||
// It is used for QML tooling purposes only.
|
// It is used for QML tooling purposes only.
|
||||||
//
|
//
|
||||||
// This file was auto-generated by:
|
// This file was auto-generated by:
|
||||||
// 'qmlplugindump -nonrelocatable FluentUI 1.0 D:\QtProjects\build-FluentUI-Desktop_Qt_5_15_2_MSVC2019_64bit-Release\src'
|
// 'qmlplugindump -nonrelocatable FluentUI 1.0 D:/QtProjects/build-FluentUI-Desktop_Qt_5_15_2_MSVC2019_64bit-Release/src'
|
||||||
|
|
||||||
Module {
|
Module {
|
||||||
dependencies: ["QtQuick 2.0"]
|
dependencies: ["QtQuick 2.0"]
|
||||||
@ -288,10 +288,11 @@ Module {
|
|||||||
}
|
}
|
||||||
Component {
|
Component {
|
||||||
name: "FluTreeModel"
|
name: "FluTreeModel"
|
||||||
prototype: "QAbstractTableModel"
|
prototype: "QAbstractItemModel"
|
||||||
exports: ["FluentUI/FluTreeModel 1.0"]
|
exports: ["FluentUI/FluTreeModel 1.0"]
|
||||||
exportMetaObjectRevisions: [0]
|
exportMetaObjectRevisions: [0]
|
||||||
Property { name: "dataSourceSize"; type: "int" }
|
Property { name: "dataSourceSize"; type: "int" }
|
||||||
|
Property { name: "selectionModel"; type: "QList<Node*>" }
|
||||||
Method {
|
Method {
|
||||||
name: "removeRows"
|
name: "removeRows"
|
||||||
Parameter { name: "row"; type: "int" }
|
Parameter { name: "row"; type: "int" }
|
||||||
@ -327,7 +328,29 @@ Module {
|
|||||||
name: "dragAnddrop"
|
name: "dragAnddrop"
|
||||||
Parameter { name: "dragIndex"; type: "int" }
|
Parameter { name: "dragIndex"; type: "int" }
|
||||||
Parameter { name: "dropIndex"; type: "int" }
|
Parameter { name: "dropIndex"; type: "int" }
|
||||||
|
Parameter { name: "isDropTopArea"; type: "bool" }
|
||||||
}
|
}
|
||||||
|
Method {
|
||||||
|
name: "getNode"
|
||||||
|
type: "Node*"
|
||||||
|
Parameter { name: "row"; type: "int" }
|
||||||
|
}
|
||||||
|
Method {
|
||||||
|
name: "refreshNode"
|
||||||
|
Parameter { name: "row"; type: "int" }
|
||||||
|
}
|
||||||
|
Method {
|
||||||
|
name: "checkRow"
|
||||||
|
Parameter { name: "row"; type: "int" }
|
||||||
|
Parameter { name: "chekced"; type: "bool" }
|
||||||
|
}
|
||||||
|
Method {
|
||||||
|
name: "hitHasChildrenExpanded"
|
||||||
|
type: "bool"
|
||||||
|
Parameter { name: "row"; type: "int" }
|
||||||
|
}
|
||||||
|
Method { name: "allExpand" }
|
||||||
|
Method { name: "allCollapse" }
|
||||||
}
|
}
|
||||||
Component {
|
Component {
|
||||||
name: "FluTreeViewType"
|
name: "FluTreeViewType"
|
||||||
@ -2123,7 +2146,6 @@ Module {
|
|||||||
Parameter { name: "value"; type: "QVariant" }
|
Parameter { name: "value"; type: "QVariant" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Component { name: "QAbstractTableModel"; prototype: "QAbstractItemModel" }
|
|
||||||
Component {
|
Component {
|
||||||
name: "QRCode"
|
name: "QRCode"
|
||||||
defaultProperty: "data"
|
defaultProperty: "data"
|
||||||
@ -2168,14 +2190,20 @@ Module {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Component {
|
Component {
|
||||||
name: "WindowHelper"
|
name: "WindowLifecycle"
|
||||||
prototype: "QObject"
|
prototype: "QObject"
|
||||||
exports: ["FluentUI/WindowHelper 1.0"]
|
exports: ["FluentUI/WindowLifecycle 1.0"]
|
||||||
exportMetaObjectRevisions: [0]
|
exportMetaObjectRevisions: [0]
|
||||||
Method {
|
Method {
|
||||||
name: "initWindow"
|
name: "onCompleted"
|
||||||
Parameter { name: "window"; type: "QQuickWindow"; isPointer: true }
|
Parameter { name: "window"; type: "QQuickWindow"; isPointer: true }
|
||||||
}
|
}
|
||||||
|
Method { name: "onDestruction" }
|
||||||
|
Method {
|
||||||
|
name: "onVisible"
|
||||||
|
Parameter { name: "visible"; type: "bool" }
|
||||||
|
}
|
||||||
|
Method { name: "onDestoryOnClose" }
|
||||||
Method {
|
Method {
|
||||||
name: "createRegister"
|
name: "createRegister"
|
||||||
type: "QVariant"
|
type: "QVariant"
|
||||||
@ -2286,10 +2314,13 @@ Module {
|
|||||||
Property { name: "textColor"; type: "QColor" }
|
Property { name: "textColor"; type: "QColor" }
|
||||||
Property { name: "minimizeNormalColor"; type: "QColor" }
|
Property { name: "minimizeNormalColor"; type: "QColor" }
|
||||||
Property { name: "minimizeHoverColor"; type: "QColor" }
|
Property { name: "minimizeHoverColor"; type: "QColor" }
|
||||||
|
Property { name: "minimizePressColor"; type: "QColor" }
|
||||||
Property { name: "maximizeNormalColor"; type: "QColor" }
|
Property { name: "maximizeNormalColor"; type: "QColor" }
|
||||||
Property { name: "maximizeHoverColor"; type: "QColor" }
|
Property { name: "maximizeHoverColor"; type: "QColor" }
|
||||||
|
Property { name: "maximizePressColor"; type: "QColor" }
|
||||||
Property { name: "closeNormalColor"; type: "QColor" }
|
Property { name: "closeNormalColor"; type: "QColor" }
|
||||||
Property { name: "closeHoverColor"; type: "QColor" }
|
Property { name: "closeHoverColor"; type: "QColor" }
|
||||||
|
Property { name: "closePressColor"; type: "QColor" }
|
||||||
Property { name: "showDark"; type: "bool" }
|
Property { name: "showDark"; type: "bool" }
|
||||||
Property { name: "showClose"; type: "bool" }
|
Property { name: "showClose"; type: "bool" }
|
||||||
Property { name: "showMinimize"; type: "bool" }
|
Property { name: "showMinimize"; type: "bool" }
|
||||||
@ -2549,6 +2580,7 @@ Module {
|
|||||||
Property { name: "size"; type: "double" }
|
Property { name: "size"; type: "double" }
|
||||||
Property { name: "textRight"; type: "bool" }
|
Property { name: "textRight"; type: "bool" }
|
||||||
Property { name: "textSpacing"; type: "double" }
|
Property { name: "textSpacing"; type: "double" }
|
||||||
|
Property { name: "enableAnimation"; type: "bool" }
|
||||||
Property { name: "clickListener"; type: "QVariant" }
|
Property { name: "clickListener"; type: "QVariant" }
|
||||||
Property { name: "textColor"; type: "QColor" }
|
Property { name: "textColor"; type: "QColor" }
|
||||||
}
|
}
|
||||||
@ -2959,16 +2991,17 @@ Module {
|
|||||||
defaultProperty: "data"
|
defaultProperty: "data"
|
||||||
Property { name: "logo"; type: "QUrl" }
|
Property { name: "logo"; type: "QUrl" }
|
||||||
Property { name: "title"; type: "string" }
|
Property { name: "title"; type: "string" }
|
||||||
Property { name: "items"; type: "FluObject_QMLTYPE_148"; isPointer: true }
|
Property { name: "items"; type: "FluObject_QMLTYPE_140"; isPointer: true }
|
||||||
Property { name: "footerItems"; type: "FluObject_QMLTYPE_148"; isPointer: true }
|
Property { name: "footerItems"; type: "FluObject_QMLTYPE_140"; isPointer: true }
|
||||||
Property { name: "displayMode"; type: "int" }
|
Property { name: "displayMode"; type: "int" }
|
||||||
Property { name: "autoSuggestBox"; type: "QQmlComponent"; isPointer: true }
|
Property { name: "autoSuggestBox"; type: "QQmlComponent"; isPointer: true }
|
||||||
Property { name: "actionItem"; type: "QQmlComponent"; isPointer: true }
|
Property { name: "actionItem"; type: "QQmlComponent"; isPointer: true }
|
||||||
Property { name: "topPadding"; type: "int" }
|
Property { name: "topPadding"; type: "int" }
|
||||||
Property { name: "navWidth"; type: "int" }
|
|
||||||
Property { name: "pageMode"; type: "int" }
|
Property { name: "pageMode"; type: "int" }
|
||||||
Property { name: "navItemRightMenu"; type: "FluMenu_QMLTYPE_52"; isPointer: true }
|
Property { name: "navItemRightMenu"; type: "FluMenu_QMLTYPE_52"; isPointer: true }
|
||||||
Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_52"; isPointer: true }
|
Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_52"; isPointer: true }
|
||||||
|
Property { name: "cellHeight"; type: "int" }
|
||||||
|
Property { name: "cellWidth"; type: "int" }
|
||||||
Signal { name: "logoClicked" }
|
Signal { name: "logoClicked" }
|
||||||
Method { name: "collapseAll"; type: "QVariant" }
|
Method { name: "collapseAll"; type: "QVariant" }
|
||||||
Method {
|
Method {
|
||||||
@ -3053,6 +3086,7 @@ Module {
|
|||||||
Property { name: "order"; type: "int" }
|
Property { name: "order"; type: "int" }
|
||||||
Property { name: "icon"; type: "int" }
|
Property { name: "icon"; type: "int" }
|
||||||
Property { name: "url"; type: "QVariant" }
|
Property { name: "url"; type: "QVariant" }
|
||||||
|
Property { name: "disabled"; type: "bool" }
|
||||||
Property { name: "cusIcon"; type: "QQmlComponent"; isPointer: true }
|
Property { name: "cusIcon"; type: "QQmlComponent"; isPointer: true }
|
||||||
Property { name: "infoBadge"; type: "QQmlComponent"; isPointer: true }
|
Property { name: "infoBadge"; type: "QQmlComponent"; isPointer: true }
|
||||||
Property { name: "recentlyAdded"; type: "bool" }
|
Property { name: "recentlyAdded"; type: "bool" }
|
||||||
@ -3093,6 +3127,7 @@ Module {
|
|||||||
Property { name: "_idx"; type: "int" }
|
Property { name: "_idx"; type: "int" }
|
||||||
Property { name: "title"; type: "string" }
|
Property { name: "title"; type: "string" }
|
||||||
Property { name: "icon"; type: "QVariant" }
|
Property { name: "icon"; type: "QVariant" }
|
||||||
|
Property { name: "disabled"; type: "bool" }
|
||||||
Property { name: "cusIcon"; type: "QQmlComponent"; isPointer: true }
|
Property { name: "cusIcon"; type: "QQmlComponent"; isPointer: true }
|
||||||
Property { name: "isExpand"; type: "bool" }
|
Property { name: "isExpand"; type: "bool" }
|
||||||
Property { name: "parent"; type: "QVariant" }
|
Property { name: "parent"; type: "QVariant" }
|
||||||
@ -3676,9 +3711,25 @@ Module {
|
|||||||
Property { name: "dataSource"; type: "QVariant" }
|
Property { name: "dataSource"; type: "QVariant" }
|
||||||
Property { name: "showLine"; type: "bool" }
|
Property { name: "showLine"; type: "bool" }
|
||||||
Property { name: "draggable"; type: "bool" }
|
Property { name: "draggable"; type: "bool" }
|
||||||
|
Property { name: "cellHeight"; type: "int" }
|
||||||
|
Property { name: "depthPadding"; type: "int" }
|
||||||
|
Property { name: "checkable"; type: "bool" }
|
||||||
Property { name: "lineColor"; type: "QColor" }
|
Property { name: "lineColor"; type: "QColor" }
|
||||||
|
Method { name: "selectionModel"; type: "QVariant" }
|
||||||
Method { name: "count"; type: "QVariant" }
|
Method { name: "count"; type: "QVariant" }
|
||||||
Method { name: "visibleCount"; type: "QVariant" }
|
Method { name: "visibleCount"; type: "QVariant" }
|
||||||
|
Method {
|
||||||
|
name: "collapse"
|
||||||
|
type: "QVariant"
|
||||||
|
Parameter { name: "rowIndex"; type: "QVariant" }
|
||||||
|
}
|
||||||
|
Method {
|
||||||
|
name: "expand"
|
||||||
|
type: "QVariant"
|
||||||
|
Parameter { name: "rowIndex"; type: "QVariant" }
|
||||||
|
}
|
||||||
|
Method { name: "allExpand"; type: "QVariant" }
|
||||||
|
Method { name: "allCollapse"; type: "QVariant" }
|
||||||
}
|
}
|
||||||
Component {
|
Component {
|
||||||
prototype: "QQuickWindowQmlImpl"
|
prototype: "QQuickWindowQmlImpl"
|
||||||
@ -3695,12 +3746,13 @@ Module {
|
|||||||
Property { name: "backgroundColor"; type: "QColor" }
|
Property { name: "backgroundColor"; type: "QColor" }
|
||||||
Property { name: "_pageRegister"; type: "QVariant" }
|
Property { name: "_pageRegister"; type: "QVariant" }
|
||||||
Property { name: "_route"; type: "string" }
|
Property { name: "_route"; type: "string" }
|
||||||
Property { name: "closeFunc"; type: "QVariant" }
|
Property { name: "closeListener"; type: "QVariant" }
|
||||||
Property { name: "content"; type: "QObject"; isList: true; isReadonly: true }
|
Property { name: "content"; type: "QObject"; isList: true; isReadonly: true }
|
||||||
Signal {
|
Signal {
|
||||||
name: "initArgument"
|
name: "initArgument"
|
||||||
Parameter { name: "argument"; type: "QVariant" }
|
Parameter { name: "argument"; type: "QVariant" }
|
||||||
}
|
}
|
||||||
|
Method { name: "destoryOnClose"; type: "QVariant" }
|
||||||
Method {
|
Method {
|
||||||
name: "showLoading"
|
name: "showLoading"
|
||||||
type: "QVariant"
|
type: "QVariant"
|
||||||
@ -3741,7 +3793,6 @@ Module {
|
|||||||
type: "QVariant"
|
type: "QVariant"
|
||||||
Parameter { name: "path"; type: "QVariant" }
|
Parameter { name: "path"; type: "QVariant" }
|
||||||
}
|
}
|
||||||
Method { name: "deleteWindow"; type: "QVariant" }
|
|
||||||
Method {
|
Method {
|
||||||
name: "onResult"
|
name: "onResult"
|
||||||
type: "QVariant"
|
type: "QVariant"
|
||||||
|
@ -202,7 +202,6 @@ Item {
|
|||||||
d.dropIndex = -1
|
d.dropIndex = -1
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
console.debug(index)
|
|
||||||
if(tree_model.hitHasChildrenExpanded(index) && y>index*control.cellHeight+control.cellHeight/2){
|
if(tree_model.hitHasChildrenExpanded(index) && y>index*control.cellHeight+control.cellHeight/2){
|
||||||
d.dropIndex = index + 1
|
d.dropIndex = index + 1
|
||||||
d.isDropTopArea = true
|
d.isDropTopArea = true
|
||||||
|
@ -18,9 +18,9 @@ Window {
|
|||||||
}
|
}
|
||||||
property var _pageRegister
|
property var _pageRegister
|
||||||
property string _route
|
property string _route
|
||||||
property var closeFunc: function(event){
|
property var closeListener: function(event){
|
||||||
if(closeDestory){
|
if(closeDestory){
|
||||||
deleteWindow()
|
destoryOnClose()
|
||||||
}else{
|
}else{
|
||||||
visible = false
|
visible = false
|
||||||
event.accepted = false
|
event.accepted = false
|
||||||
@ -30,12 +30,18 @@ Window {
|
|||||||
id:window
|
id:window
|
||||||
color:"transparent"
|
color:"transparent"
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
helper.initWindow(window)
|
lifecycle.onCompleted(window)
|
||||||
initArgument(argument)
|
initArgument(argument)
|
||||||
}
|
}
|
||||||
|
Component.onDestruction: {
|
||||||
|
lifecycle.onDestruction()
|
||||||
|
}
|
||||||
|
onVisibleChanged: {
|
||||||
|
lifecycle.onVisible(visible)
|
||||||
|
}
|
||||||
Connections{
|
Connections{
|
||||||
target: window
|
target: window
|
||||||
function onClosing(event){closeFunc(event)}
|
function onClosing(event){closeListener(event)}
|
||||||
}
|
}
|
||||||
Component{
|
Component{
|
||||||
id:com_background
|
id:com_background
|
||||||
@ -125,8 +131,11 @@ Window {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WindowHelper{
|
WindowLifecycle{
|
||||||
id:helper
|
id:lifecycle
|
||||||
|
}
|
||||||
|
function destoryOnClose(){
|
||||||
|
lifecycle.onDestoryOnClose()
|
||||||
}
|
}
|
||||||
function showLoading(text = "加载中...",cancel = true){
|
function showLoading(text = "加载中...",cancel = true){
|
||||||
loader_loading.loadingText = text
|
loader_loading.loadingText = text
|
||||||
@ -149,10 +158,7 @@ Window {
|
|||||||
infoBar.showError(text,duration,moremsg)
|
infoBar.showError(text,duration,moremsg)
|
||||||
}
|
}
|
||||||
function registerForWindowResult(path){
|
function registerForWindowResult(path){
|
||||||
return helper.createRegister(window,path)
|
return lifecycle.createRegister(window,path)
|
||||||
}
|
|
||||||
function deleteWindow(){
|
|
||||||
FluApp.deleteWindow(window)
|
|
||||||
}
|
}
|
||||||
function onResult(data){
|
function onResult(data){
|
||||||
if(_pageRegister){
|
if(_pageRegister){
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
#include "WindowHelper.h"
|
|
||||||
|
|
||||||
#include "FluRegister.h"
|
|
||||||
|
|
||||||
WindowHelper::WindowHelper(QObject *parent):QObject{parent}{
|
|
||||||
}
|
|
||||||
|
|
||||||
void WindowHelper::initWindow(QQuickWindow* window){
|
|
||||||
this->window = window;
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant WindowHelper::createRegister(QQuickWindow* window,const QString& path){
|
|
||||||
FluRegister *p = new FluRegister(window);
|
|
||||||
p->from(window);
|
|
||||||
p->path(path);
|
|
||||||
return QVariant::fromValue(p);
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
#ifndef WINDOWHELPER_H
|
|
||||||
#define WINDOWHELPER_H
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QQuickWindow>
|
|
||||||
#include <QtQml/qqml.h>
|
|
||||||
#include <QQuickItem>
|
|
||||||
#include <QWindow>
|
|
||||||
#include <QJsonObject>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The WindowHelper class
|
|
||||||
*/
|
|
||||||
class WindowHelper : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
QML_NAMED_ELEMENT(WindowHelper)
|
|
||||||
public:
|
|
||||||
explicit WindowHelper(QObject *parent = nullptr);
|
|
||||||
Q_INVOKABLE void initWindow(QQuickWindow* window);
|
|
||||||
Q_INVOKABLE QVariant createRegister(QQuickWindow* window,const QString& path);
|
|
||||||
private:
|
|
||||||
QQuickWindow* window;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // WINDOWHELPER_H
|
|
29
src/WindowLifecycle.cpp
Normal file
29
src/WindowLifecycle.cpp
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#include "WindowLifecycle.h"
|
||||||
|
|
||||||
|
#include "FluApp.h"
|
||||||
|
#include "FluRegister.h"
|
||||||
|
|
||||||
|
WindowLifecycle::WindowLifecycle(QObject *parent):QObject{parent}{
|
||||||
|
}
|
||||||
|
|
||||||
|
void WindowLifecycle::onCompleted(QQuickWindow* window){
|
||||||
|
this->_window = window;
|
||||||
|
FluApp::getInstance()->addWindow(this->_window);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WindowLifecycle::onDestoryOnClose(){
|
||||||
|
FluApp::getInstance()->removeWindow(this->_window);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WindowLifecycle::onDestruction(){
|
||||||
|
}
|
||||||
|
|
||||||
|
void WindowLifecycle::onVisible(bool visible){
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant WindowLifecycle::createRegister(QQuickWindow* window,const QString& path){
|
||||||
|
FluRegister *p = new FluRegister(window);
|
||||||
|
p->from(window);
|
||||||
|
p->path(path);
|
||||||
|
return QVariant::fromValue(p);
|
||||||
|
}
|
29
src/WindowLifecycle.h
Normal file
29
src/WindowLifecycle.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#ifndef WINDOWLIFECYCLE_H
|
||||||
|
#define WINDOWLIFECYCLE_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QQuickWindow>
|
||||||
|
#include <QtQml/qqml.h>
|
||||||
|
#include <QQuickItem>
|
||||||
|
#include <QWindow>
|
||||||
|
#include <QJsonObject>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The WindowLifecycle class
|
||||||
|
*/
|
||||||
|
class WindowLifecycle : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
QML_NAMED_ELEMENT(WindowLifecycle)
|
||||||
|
public:
|
||||||
|
explicit WindowLifecycle(QObject *parent = nullptr);
|
||||||
|
Q_INVOKABLE void onCompleted(QQuickWindow* window);
|
||||||
|
Q_INVOKABLE void onDestruction();
|
||||||
|
Q_INVOKABLE void onVisible(bool visible);
|
||||||
|
Q_INVOKABLE void onDestoryOnClose();
|
||||||
|
Q_INVOKABLE QVariant createRegister(QQuickWindow* window,const QString& path);
|
||||||
|
private:
|
||||||
|
QQuickWindow* _window;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // WINDOWLIFECYCLE_H
|
Loading…
Reference in New Issue
Block a user