Merge branch 'zhuzichu520:main' into main
@ -8,13 +8,11 @@ Window {
|
|||||||
id:app
|
id:app
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
FluApp.init(app)
|
FluApp.init(app)
|
||||||
FluTheme.frameless = ("windows" === Qt.platform.os)
|
|
||||||
FluTheme.darkMode = FluDarkMode.System
|
FluTheme.darkMode = FluDarkMode.System
|
||||||
FluApp.routes = {
|
FluApp.routes = {
|
||||||
"/":"qrc:/example/qml/window/MainWindow.qml",
|
"/":"qrc:/example/qml/window/MainWindow.qml",
|
||||||
"/about":"qrc:/example/qml/window/AboutWindow.qml",
|
"/about":"qrc:/example/qml/window/AboutWindow.qml",
|
||||||
"/login":"qrc:/example/qml/window/LoginWindow.qml",
|
"/login":"qrc:/example/qml/window/LoginWindow.qml",
|
||||||
"/chat":"qrc:/example/qml/window/ChatWindow.qml",
|
|
||||||
"/media":"qrc:/example/qml/window/MediaWindow.qml",
|
"/media":"qrc:/example/qml/window/MediaWindow.qml",
|
||||||
"/singleTaskWindow":"qrc:/example/qml/window/SingleTaskWindow.qml",
|
"/singleTaskWindow":"qrc:/example/qml/window/SingleTaskWindow.qml",
|
||||||
"/standardWindow":"qrc:/example/qml/window/StandardWindow.qml",
|
"/standardWindow":"qrc:/example/qml/window/StandardWindow.qml",
|
||||||
|
@ -120,7 +120,8 @@ FluExpander{
|
|||||||
"FluStatusView",
|
"FluStatusView",
|
||||||
"FluRatingControl",
|
"FluRatingControl",
|
||||||
"FluPasswordBox",
|
"FluPasswordBox",
|
||||||
"FluBreadcrumbBar"
|
"FluBreadcrumbBar",
|
||||||
|
"FluCopyableText"
|
||||||
];
|
];
|
||||||
code = code.replace(/\n/g, "<br>");
|
code = code.replace(/\n/g, "<br>");
|
||||||
code = code.replace(/ /g, " ");
|
code = code.replace(/ /g, " ");
|
||||||
|
@ -4,11 +4,13 @@ import QtQuick
|
|||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
FluObject{
|
FluObject{
|
||||||
id:footer_items
|
|
||||||
|
|
||||||
property var navigationView
|
property var navigationView
|
||||||
|
|
||||||
|
id:footer_items
|
||||||
|
|
||||||
FluPaneItemSeparator{}
|
FluPaneItemSeparator{}
|
||||||
|
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:lang.about
|
title:lang.about
|
||||||
icon:FluentIcons.Contact
|
icon:FluentIcons.Contact
|
||||||
@ -16,6 +18,7 @@ FluObject{
|
|||||||
FluApp.navigate("/about")
|
FluApp.navigate("/about")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:lang.settings
|
title:lang.settings
|
||||||
icon:FluentIcons.Settings
|
icon:FluentIcons.Settings
|
||||||
@ -23,4 +26,5 @@ FluObject{
|
|||||||
navigationView.push("qrc:/example/qml/page/T_Settings.qml")
|
navigationView.push("qrc:/example/qml/page/T_Settings.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,14 +9,14 @@ FluObject{
|
|||||||
|
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:lang.home
|
title:lang.home
|
||||||
// icon:FluentIcons.Home
|
icon:FluentIcons.Home
|
||||||
cusIcon: Image{
|
// cusIcon: Image{
|
||||||
anchors.centerIn: parent
|
// anchors.centerIn: parent
|
||||||
source: FluTheme.dark ? "qrc:/example/res/svg/home_dark.svg" : "qrc:/example/res/svg/home.svg"
|
// source: FluTheme.dark ? "qrc:/example/res/svg/home_dark.svg" : "qrc:/example/res/svg/home.svg"
|
||||||
sourceSize: Qt.size(30,30)
|
// sourceSize: Qt.size(30,30)
|
||||||
width: 18
|
// width: 18
|
||||||
height: 18
|
// height: 18
|
||||||
}
|
// }
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/example/qml/page/T_Home.qml")
|
navigationView.push("qrc:/example/qml/page/T_Home.qml")
|
||||||
}
|
}
|
||||||
@ -34,6 +34,12 @@ FluObject{
|
|||||||
navigationView.push("qrc:/example/qml/page/T_Buttons.qml")
|
navigationView.push("qrc:/example/qml/page/T_Buttons.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FluPaneItem{
|
||||||
|
title:"Text"
|
||||||
|
onTap:{
|
||||||
|
navigationView.push("qrc:/example/qml/page/T_Text.qml")
|
||||||
|
}
|
||||||
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Slider"
|
title:"Slider"
|
||||||
image:"qrc:/example/res/image/control/Slider.png"
|
image:"qrc:/example/res/image/control/Slider.png"
|
||||||
|
@ -8,10 +8,6 @@ FluContentPage {
|
|||||||
|
|
||||||
title:"Awesome"
|
title:"Awesome"
|
||||||
|
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
|
|
||||||
FluTextBox{
|
FluTextBox{
|
||||||
id:text_box
|
id:text_box
|
||||||
placeholderText: "请输入关键字"
|
placeholderText: "请输入关键字"
|
||||||
|
@ -9,11 +9,6 @@ FluScrollablePage{
|
|||||||
|
|
||||||
title:"Badge"
|
title:"Badge"
|
||||||
|
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"BreadcurmbBar"
|
title:"BreadcurmbBar"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
var items = []
|
var items = []
|
||||||
|
@ -7,12 +7,8 @@ import FluentUI
|
|||||||
import "../component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
title:"Buttons"
|
|
||||||
|
|
||||||
leftPadding:10
|
title:"Buttons"
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"CalendarPicker"
|
title:"CalendarPicker"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"Carousel"
|
title:"Carousel"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"CheckBox"
|
title:"CheckBox"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"ColorPicker"
|
title:"ColorPicker"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"TimePicker"
|
title:"TimePicker"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"Dialog"
|
title:"Dialog"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"Expander"
|
title:"Expander"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"FlipView"
|
title:"FlipView"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -7,11 +7,6 @@ import FluentUI
|
|||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
|
|
||||||
leftPadding:10
|
|
||||||
rightPadding:0
|
|
||||||
bottomPadding:20
|
|
||||||
|
|
||||||
ListModel{
|
ListModel{
|
||||||
id:model_header
|
id:model_header
|
||||||
ListElement{
|
ListElement{
|
||||||
@ -41,7 +36,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
FluText{
|
FluText{
|
||||||
text:"FluentUI Gallery"
|
text:"FluentUI Gallery"
|
||||||
fontStyle: FluText.TitleLarge
|
font: FluTextStyle.TitleLarge
|
||||||
anchors{
|
anchors{
|
||||||
top: parent.top
|
top: parent.top
|
||||||
left: parent.left
|
left: parent.left
|
||||||
@ -101,7 +96,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
FluText{
|
FluText{
|
||||||
text: model.title
|
text: model.title
|
||||||
fontStyle: FluText.Body
|
font: FluTextStyle.Body
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
Layout.leftMargin: 20
|
Layout.leftMargin: 20
|
||||||
}
|
}
|
||||||
@ -184,7 +179,7 @@ FluScrollablePage{
|
|||||||
FluText{
|
FluText{
|
||||||
id:item_title
|
id:item_title
|
||||||
text:modelData.title
|
text:modelData.title
|
||||||
fontStyle: FluText.BodyStrong
|
font: FluTextStyle.BodyStrong
|
||||||
anchors{
|
anchors{
|
||||||
left: item_icon.right
|
left: item_icon.right
|
||||||
leftMargin: 20
|
leftMargin: 20
|
||||||
@ -198,7 +193,7 @@ FluScrollablePage{
|
|||||||
color:FluColors.Grey120
|
color:FluColors.Grey120
|
||||||
wrapMode: Text.WrapAnywhere
|
wrapMode: Text.WrapAnywhere
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
fontStyle: FluText.Caption
|
font: FluTextStyle.Caption
|
||||||
maximumLineCount: 2
|
maximumLineCount: 2
|
||||||
anchors{
|
anchors{
|
||||||
left: item_title.left
|
left: item_title.left
|
||||||
@ -236,7 +231,7 @@ FluScrollablePage{
|
|||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
text: "Recently added samples"
|
text: "Recently added samples"
|
||||||
fontStyle: FluText.Title
|
font: FluTextStyle.Title
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
Layout.leftMargin: 20
|
Layout.leftMargin: 20
|
||||||
}
|
}
|
||||||
@ -253,7 +248,7 @@ FluScrollablePage{
|
|||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
text: "Recently updated samples"
|
text: "Recently updated samples"
|
||||||
fontStyle: FluText.Title
|
font: FluTextStyle.Title
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
Layout.leftMargin: 20
|
Layout.leftMargin: 20
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"InfoBar"
|
title:"InfoBar"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"MediaPlayer"
|
title:"MediaPlayer"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
if(visible){
|
if(visible){
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"Menu"
|
title:"Menu"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -11,10 +11,6 @@ FluScrollablePage{
|
|||||||
property var loginPageRegister: registerForWindowResult("/login")
|
property var loginPageRegister: registerForWindowResult("/login")
|
||||||
|
|
||||||
title:"MultiWindow"
|
title:"MultiWindow"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
Connections{
|
Connections{
|
||||||
target: loginPageRegister
|
target: loginPageRegister
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"Pivot"
|
title:"Pivot"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"Progress"
|
title:"Progress"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"RatingControl"
|
title:"RatingControl"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"Rectangle"
|
title:"Rectangle"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -67,7 +63,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
FluText{
|
FluText{
|
||||||
text:"配合图片使用"
|
text:"配合图片使用"
|
||||||
fontStyle: FluText.SubTitle
|
font: FluTextStyle.Subtitle
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
}
|
}
|
||||||
RowLayout{
|
RowLayout{
|
||||||
|
@ -9,10 +9,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"Settings"
|
title:"Settings"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -28,7 +24,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
FluText{
|
FluText{
|
||||||
text:lang.dark_mode
|
text:lang.dark_mode
|
||||||
fontStyle: FluText.BodyStrong
|
font: FluTextStyle.BodyStrong
|
||||||
Layout.bottomMargin: 4
|
Layout.bottomMargin: 4
|
||||||
}
|
}
|
||||||
Repeater{
|
Repeater{
|
||||||
@ -62,7 +58,7 @@ FluScrollablePage{
|
|||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
text:lang.navigation_view_display_mode
|
text:lang.navigation_view_display_mode
|
||||||
fontStyle: FluText.BodyStrong
|
font: FluTextStyle.BodyStrong
|
||||||
Layout.bottomMargin: 4
|
Layout.bottomMargin: 4
|
||||||
}
|
}
|
||||||
Repeater{
|
Repeater{
|
||||||
@ -93,7 +89,7 @@ FluScrollablePage{
|
|||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
text:lang.locale
|
text:lang.locale
|
||||||
fontStyle: FluText.BodyStrong
|
font: FluTextStyle.BodyStrong
|
||||||
Layout.bottomMargin: 4
|
Layout.bottomMargin: 4
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,10 +8,6 @@ import FluentUI
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"Slider"
|
title:"Slider"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"StatusView"
|
title:"StatusView"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
id:layout_actions
|
id:layout_actions
|
||||||
|
@ -7,14 +7,10 @@ import "../component"
|
|||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"TabView"
|
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
property var colors : [FluColors.Yellow,FluColors.Orange,FluColors.Red,FluColors.Magenta,FluColors.Purple,FluColors.Blue,FluColors.Teal,FluColors.Green]
|
property var colors : [FluColors.Yellow,FluColors.Orange,FluColors.Red,FluColors.Magenta,FluColors.Purple,FluColors.Blue,FluColors.Teal,FluColors.Green]
|
||||||
|
|
||||||
|
title:"TabView"
|
||||||
|
|
||||||
Component{
|
Component{
|
||||||
id:com_page
|
id:com_page
|
||||||
Rectangle{
|
Rectangle{
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"TableView"
|
title:"TableView"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
const columns = [
|
const columns = [
|
||||||
@ -71,7 +67,6 @@ FluScrollablePage{
|
|||||||
leftPadding:6
|
leftPadding:6
|
||||||
rightPadding:6
|
rightPadding:6
|
||||||
onClicked:{
|
onClicked:{
|
||||||
console.debug(dataModel.index)
|
|
||||||
showSuccess(JSON.stringify(dataObject))
|
showSuccess(JSON.stringify(dataObject))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
32
example/qml/page/T_Text.qml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Window
|
||||||
|
import FluentUI
|
||||||
|
import "../component"
|
||||||
|
|
||||||
|
FluScrollablePage{
|
||||||
|
|
||||||
|
title:"Text"
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: 20
|
||||||
|
height: 60
|
||||||
|
paddings: 10
|
||||||
|
|
||||||
|
FluCopyableText{
|
||||||
|
text: "这是一个可以支持复制的Text"
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluCopyableText{
|
||||||
|
text:"这是一个可以支持复制的Text"
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"TextBox"
|
title:"TextBox"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"Theme"
|
title:"Theme"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"TimePicker"
|
title:"TimePicker"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"ToggleSwitch"
|
title:"ToggleSwitch"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"Tooltip"
|
title:"Tooltip"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
|
@ -8,10 +8,6 @@ import "../component"
|
|||||||
FluScrollablePage {
|
FluScrollablePage {
|
||||||
|
|
||||||
title:"TreeView"
|
title:"TreeView"
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
function randomName() {
|
function randomName() {
|
||||||
var names = ["张三", "李四", "王五", "赵六", "钱七", "孙八", "周九", "吴十"]
|
var names = ["张三", "李四", "王五", "赵六", "钱七", "孙八", "周九", "吴十"]
|
||||||
|
@ -5,11 +5,9 @@ import FluentUI
|
|||||||
|
|
||||||
FluContentPage {
|
FluContentPage {
|
||||||
|
|
||||||
|
property real textScale: 1
|
||||||
|
|
||||||
title: "Typography"
|
title: "Typography"
|
||||||
property int textSize: FluTheme.textSize
|
|
||||||
leftPadding:10
|
|
||||||
rightPadding:10
|
|
||||||
bottomPadding:20
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
slider.seek(0)
|
slider.seek(0)
|
||||||
@ -26,47 +24,49 @@ FluContentPage {
|
|||||||
paddings: 10
|
paddings: 10
|
||||||
ColumnLayout{
|
ColumnLayout{
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
scale: textScale
|
||||||
|
transformOrigin: Item.TopLeft
|
||||||
FluText{
|
FluText{
|
||||||
|
id:text_Display
|
||||||
text:"Display"
|
text:"Display"
|
||||||
padding: 0
|
padding: 0
|
||||||
pixelSize: textSize
|
font: FluTextStyle.Display
|
||||||
fontStyle: FluText.Display
|
|
||||||
}
|
}
|
||||||
FluText{
|
FluText{
|
||||||
|
id:text_TitleLarge
|
||||||
text:"Title Large"
|
text:"Title Large"
|
||||||
padding: 0
|
padding: 0
|
||||||
pixelSize: textSize
|
font: FluTextStyle.TitleLarge
|
||||||
fontStyle: FluText.TitleLarge
|
|
||||||
}
|
}
|
||||||
FluText{
|
FluText{
|
||||||
|
id:text_Title
|
||||||
text:"Title"
|
text:"Title"
|
||||||
padding: 0
|
padding: 0
|
||||||
pixelSize: textSize
|
font: FluTextStyle.Title
|
||||||
fontStyle: FluText.Title
|
|
||||||
}
|
}
|
||||||
FluText{
|
FluText{
|
||||||
|
id:text_Subtitle
|
||||||
text:"Subtitle"
|
text:"Subtitle"
|
||||||
padding: 0
|
padding: 0
|
||||||
pixelSize: textSize
|
font: FluTextStyle.Subtitle
|
||||||
fontStyle: FluText.SubTitle
|
|
||||||
}
|
}
|
||||||
FluText{
|
FluText{
|
||||||
|
id:text_BodyStrong
|
||||||
text:"Body Strong"
|
text:"Body Strong"
|
||||||
padding: 0
|
padding: 0
|
||||||
pixelSize: textSize
|
font: FluTextStyle.BodyStrong
|
||||||
fontStyle: FluText.BodyStrong
|
|
||||||
}
|
}
|
||||||
FluText{
|
FluText{
|
||||||
|
id:text_Body
|
||||||
text:"Body"
|
text:"Body"
|
||||||
padding: 0
|
padding: 0
|
||||||
pixelSize: textSize
|
font: FluTextStyle.Body
|
||||||
fontStyle: FluText.Body
|
|
||||||
}
|
}
|
||||||
FluText{
|
FluText{
|
||||||
|
id:text_Caption
|
||||||
text:"Caption"
|
text:"Caption"
|
||||||
padding: 0
|
padding: 0
|
||||||
pixelSize: textSize
|
font: FluTextStyle.Caption
|
||||||
fontStyle: FluText.Caption
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ FluContentPage {
|
|||||||
topMargin: 30
|
topMargin: 30
|
||||||
}
|
}
|
||||||
onValueChanged:{
|
onValueChanged:{
|
||||||
textSize = value/100*6+FluTheme.textSize
|
textScale = 1+value/100
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,11 +34,17 @@ FluWindow {
|
|||||||
spacing: 14
|
spacing: 14
|
||||||
FluText{
|
FluText{
|
||||||
text:"FluentUI"
|
text:"FluentUI"
|
||||||
fontStyle: FluText.Title
|
font: FluTextStyle.Title
|
||||||
|
MouseArea{
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: {
|
||||||
|
FluApp.navigate("/")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
FluText{
|
FluText{
|
||||||
text:"v%1".arg(appInfo.version)
|
text:"v%1".arg(appInfo.version)
|
||||||
fontStyle: FluText.Body
|
font: FluTextStyle.Body
|
||||||
Layout.alignment: Qt.AlignBottom
|
Layout.alignment: Qt.AlignBottom
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -113,6 +119,7 @@ FluWindow {
|
|||||||
|
|
||||||
RowLayout{
|
RowLayout{
|
||||||
spacing: 14
|
spacing: 14
|
||||||
|
Layout.topMargin: 20
|
||||||
Layout.leftMargin: 15
|
Layout.leftMargin: 15
|
||||||
FluText{
|
FluText{
|
||||||
text:"捐赠:"
|
text:"捐赠:"
|
||||||
@ -124,15 +131,15 @@ FluWindow {
|
|||||||
Layout.preferredHeight: 252
|
Layout.preferredHeight: 252
|
||||||
Row{
|
Row{
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
spacing: 60
|
spacing: 30
|
||||||
Image{
|
Image{
|
||||||
width: 164.55
|
width: 250
|
||||||
height: 224.25
|
height: 250
|
||||||
source: "qrc:/example/res/image/qrcode_wx.jpg"
|
source: "qrc:/example/res/image/qrcode_wx.jpg"
|
||||||
}
|
}
|
||||||
Image{
|
Image{
|
||||||
width: 162
|
width: 250
|
||||||
height: 252
|
height: 250
|
||||||
source: "qrc:/example/res/image/qrcode_zfb.jpg"
|
source: "qrc:/example/res/image/qrcode_zfb.jpg"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -141,12 +148,11 @@ FluWindow {
|
|||||||
RowLayout{
|
RowLayout{
|
||||||
spacing: 14
|
spacing: 14
|
||||||
Layout.leftMargin: 15
|
Layout.leftMargin: 15
|
||||||
|
Layout.topMargin: 20
|
||||||
FluText{
|
FluText{
|
||||||
id:text_desc
|
id:text_desc
|
||||||
text:"个人开发,维护不易,你们的捐赠就是我继续更新的动力!\n有什么问题提Issues,只要时间充足我就会解决的!!"
|
text:"个人开发,维护不易,你们的捐赠就是我继续更新的动力!\n有什么问题提Issues,只要时间充足我就会解决的!!"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,261 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import QtQuick.Controls
|
|
||||||
import FluentUI
|
|
||||||
import Controller
|
|
||||||
import QtQuick.Dialogs
|
|
||||||
|
|
||||||
FluWindow {
|
|
||||||
|
|
||||||
title:"ChatGPT"
|
|
||||||
width: 680
|
|
||||||
height: 600
|
|
||||||
minimumWidth: 500
|
|
||||||
minimumHeight: 600
|
|
||||||
|
|
||||||
onInitArgument:
|
|
||||||
(argument)=>{
|
|
||||||
scrollview.focus = true
|
|
||||||
}
|
|
||||||
|
|
||||||
ChatController{
|
|
||||||
id:controller
|
|
||||||
|
|
||||||
onResponseDataChanged: {
|
|
||||||
appendMessage(false,responseData)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ListModel{
|
|
||||||
id:model_message
|
|
||||||
ListElement{
|
|
||||||
isMy:false
|
|
||||||
text:"欢迎使用ChatGPT"
|
|
||||||
}
|
|
||||||
ListElement{
|
|
||||||
isMy:true
|
|
||||||
text:"好的,3Q"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FluAppBar{
|
|
||||||
id:appbar
|
|
||||||
title:"ChatGPT"
|
|
||||||
width:parent.width
|
|
||||||
}
|
|
||||||
|
|
||||||
Component{
|
|
||||||
id:com_text
|
|
||||||
TextEdit {
|
|
||||||
id:item_text
|
|
||||||
text: message
|
|
||||||
wrapMode: Text.WrapAnywhere
|
|
||||||
readOnly: true
|
|
||||||
selectByMouse: true
|
|
||||||
selectByKeyboard: true
|
|
||||||
selectedTextColor: Qt.rgba(51,153,255,1)
|
|
||||||
color:FluColors.Black
|
|
||||||
selectionColor: {
|
|
||||||
if(FluTheme.dark){
|
|
||||||
return FluTheme.primaryColor.lighter
|
|
||||||
}else{
|
|
||||||
return FluTheme.primaryColor.dark
|
|
||||||
}
|
|
||||||
}
|
|
||||||
width: Math.min(list_message.width-200,600,implicitWidth)
|
|
||||||
TapHandler{
|
|
||||||
acceptedButtons: Qt.RightButton
|
|
||||||
onTapped: {
|
|
||||||
menu_item.showMenu(item_text.selectedText)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FluArea{
|
|
||||||
id:layout_content
|
|
||||||
anchors{
|
|
||||||
top: appbar.bottom
|
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
bottom: layout_bottom.top
|
|
||||||
margins: 10
|
|
||||||
}
|
|
||||||
color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(245/255,245/255,245/255,1)
|
|
||||||
ListView{
|
|
||||||
id:list_message
|
|
||||||
anchors.fill: parent
|
|
||||||
model:model_message
|
|
||||||
clip: true
|
|
||||||
ScrollBar.vertical: FluScrollBar {}
|
|
||||||
preferredHighlightBegin: 0
|
|
||||||
preferredHighlightEnd: 0
|
|
||||||
highlightMoveDuration: 0
|
|
||||||
header:Item{
|
|
||||||
width: list_message.width
|
|
||||||
height:20
|
|
||||||
}
|
|
||||||
footer:Item{
|
|
||||||
width: list_message.width
|
|
||||||
height:20
|
|
||||||
}
|
|
||||||
delegate: Item{
|
|
||||||
width: ListView.view.width
|
|
||||||
height: childrenRect.height
|
|
||||||
|
|
||||||
FluRectangle{
|
|
||||||
id:item_avatar
|
|
||||||
width: 30
|
|
||||||
height: 30
|
|
||||||
radius:[15,15,15,15]
|
|
||||||
anchors{
|
|
||||||
right: isMy ? parent.right : undefined
|
|
||||||
rightMargin: isMy ? 20 : undefined
|
|
||||||
left: isMy ? undefined : parent.left
|
|
||||||
leftMargin: isMy ? undefined : 20
|
|
||||||
top:parent.top
|
|
||||||
}
|
|
||||||
Image {
|
|
||||||
asynchronous: true
|
|
||||||
anchors.fill: parent
|
|
||||||
sourceSize: Qt.size(100,100)
|
|
||||||
source: isMy ? "qrc:/example/res/svg/avatar_2.svg" : "qrc:/example/res/image/logo_openai.png"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle{
|
|
||||||
id:item_layout_content
|
|
||||||
color: isMy ? "#FF95EC69" : "#FFFFFF"
|
|
||||||
width: item_msg_loader.width+10
|
|
||||||
height: item_msg_loader.height+10
|
|
||||||
radius: 3
|
|
||||||
anchors{
|
|
||||||
top: item_avatar.top
|
|
||||||
right: isMy ? item_avatar.left : undefined
|
|
||||||
rightMargin: isMy ? 10 : undefined
|
|
||||||
left: isMy ? undefined : item_avatar.right
|
|
||||||
leftMargin: isMy ? undefined : 10
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Loader{
|
|
||||||
id:item_msg_loader
|
|
||||||
property var message: model.text
|
|
||||||
anchors.centerIn: parent
|
|
||||||
sourceComponent: com_text
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Item{
|
|
||||||
id:item_layout_bottom
|
|
||||||
width: parent.width
|
|
||||||
anchors.top: item_layout_content.bottom
|
|
||||||
height: 20
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FluArea{
|
|
||||||
id:layout_bottom
|
|
||||||
height: 90
|
|
||||||
anchors{
|
|
||||||
bottom: parent.bottom
|
|
||||||
bottomMargin: 10
|
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
leftMargin: 10
|
|
||||||
rightMargin: 10
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ScrollView{
|
|
||||||
id:scrollview
|
|
||||||
anchors{
|
|
||||||
bottom: parent.bottom
|
|
||||||
left: parent.left
|
|
||||||
right: button_send.left
|
|
||||||
bottomMargin: 10
|
|
||||||
leftMargin: 10
|
|
||||||
rightMargin: 10
|
|
||||||
}
|
|
||||||
height: Math.min(textbox.implicitHeight,64)
|
|
||||||
FluMultilineTextBox{
|
|
||||||
id:textbox
|
|
||||||
focus:true
|
|
||||||
placeholderText: "请输入消息"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FluFilledButton{
|
|
||||||
id:button_send
|
|
||||||
text:controller.isLoading ? timer_loading.loadingText :"发送"
|
|
||||||
anchors{
|
|
||||||
bottom: parent.bottom
|
|
||||||
right: parent.right
|
|
||||||
bottomMargin: 10
|
|
||||||
rightMargin: 10
|
|
||||||
}
|
|
||||||
width: 60
|
|
||||||
disabled: controller.isLoading
|
|
||||||
onClicked:{
|
|
||||||
var text = textbox.text
|
|
||||||
appendMessage(true,text)
|
|
||||||
controller.sendMessage(text)
|
|
||||||
textbox.clear()
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer{
|
|
||||||
id:timer_loading
|
|
||||||
property int count : 0
|
|
||||||
property string loadingText : ""
|
|
||||||
interval: 500
|
|
||||||
running: controller.isLoading
|
|
||||||
repeat: true
|
|
||||||
onTriggered: {
|
|
||||||
switch(count%3){
|
|
||||||
case 0:
|
|
||||||
loadingText = "."
|
|
||||||
break
|
|
||||||
case 1:
|
|
||||||
loadingText = ".."
|
|
||||||
break
|
|
||||||
case 2:
|
|
||||||
loadingText = "..."
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
loadingText = ""
|
|
||||||
break
|
|
||||||
}
|
|
||||||
count++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FluMenu{
|
|
||||||
id:menu_item
|
|
||||||
focus: false
|
|
||||||
property string selectedText: ""
|
|
||||||
FluMenuItem{
|
|
||||||
text:"复制"
|
|
||||||
onClicked: {
|
|
||||||
controller.clipText(menu_item.selectedText)
|
|
||||||
showSuccess("复制成功")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function showMenu(text){
|
|
||||||
menu_item.selectedText = text
|
|
||||||
menu_item.popup()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function appendMessage(isMy,text){
|
|
||||||
model_message.append({isMy:isMy,text:text})
|
|
||||||
list_message.positionViewAtEnd()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -15,6 +15,7 @@ FluWindow {
|
|||||||
closeDestory:false
|
closeDestory:false
|
||||||
minimumWidth: 520
|
minimumWidth: 520
|
||||||
minimumHeight: 460
|
minimumHeight: 460
|
||||||
|
launchMode: FluWindow.SingleTask
|
||||||
|
|
||||||
closeFunc:function(event){
|
closeFunc:function(event){
|
||||||
close_app.open()
|
close_app.open()
|
||||||
@ -47,7 +48,7 @@ FluWindow {
|
|||||||
MenuItem {
|
MenuItem {
|
||||||
text: "退出"
|
text: "退出"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
window.destoryWindow()
|
window.deleteWindow()
|
||||||
FluApp.closeApp()
|
FluApp.closeApp()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -75,7 +76,7 @@ FluWindow {
|
|||||||
positiveText:"退出"
|
positiveText:"退出"
|
||||||
neutralText:"取消"
|
neutralText:"取消"
|
||||||
onPositiveClicked:{
|
onPositiveClicked:{
|
||||||
window.destoryWindow()
|
window.deleteWindow()
|
||||||
FluApp.closeApp()
|
FluApp.closeApp()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,6 +102,27 @@ FluWindow {
|
|||||||
ItemsOriginal.startPageByItem(data)
|
ItemsOriginal.startPageByItem(data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
actionItem:Item{
|
||||||
|
height: 40
|
||||||
|
width: 148
|
||||||
|
RowLayout{
|
||||||
|
anchors.centerIn: parent
|
||||||
|
spacing: 5
|
||||||
|
FluText{
|
||||||
|
text:lang.dark_mode
|
||||||
|
}
|
||||||
|
FluToggleSwitch{
|
||||||
|
selected: FluTheme.dark
|
||||||
|
clickFunc:function(){
|
||||||
|
if(FluTheme.dark){
|
||||||
|
FluTheme.darkMode = FluDarkMode.Light
|
||||||
|
}else{
|
||||||
|
FluTheme.darkMode = FluDarkMode.Dark
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
ItemsOriginal.navigationView = nav_view
|
ItemsOriginal.navigationView = nav_view
|
||||||
ItemsFooter.navigationView = nav_view
|
ItemsFooter.navigationView = nav_view
|
||||||
|
14
example/qml/window/main.qml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import QtQuick
|
||||||
|
import FluentUI
|
||||||
|
|
||||||
|
Window {
|
||||||
|
id:window
|
||||||
|
width: 400
|
||||||
|
height: 400
|
||||||
|
visible: true
|
||||||
|
|
||||||
|
FluButton{
|
||||||
|
text:"123"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Before Width: | Height: | Size: 119 KiB After Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 145 KiB After Width: | Height: | Size: 68 KiB |
@ -1,56 +0,0 @@
|
|||||||
#include "ChatController.h"
|
|
||||||
|
|
||||||
ChatController::ChatController(QObject *parent)
|
|
||||||
: QObject{parent}
|
|
||||||
{
|
|
||||||
isLoading(false);
|
|
||||||
networkManager = new QNetworkAccessManager(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ChatController::sendMessage(const QString& text){
|
|
||||||
isLoading(true);
|
|
||||||
QUrl apiUrl("https://api.openai.com/v1/chat/completions");
|
|
||||||
QNetworkRequest request(apiUrl);
|
|
||||||
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
|
||||||
request.setRawHeader("Authorization", QString::fromStdString("Bearer %1").arg(QString::fromUtf8(QByteArray::fromBase64(baseKey.toUtf8()))).toUtf8());
|
|
||||||
QJsonObject requestData;
|
|
||||||
requestData.insert("model", "gpt-3.5-turbo");
|
|
||||||
messages.append(createMessage("user",text));
|
|
||||||
requestData.insert("messages", messages);
|
|
||||||
QJsonDocument requestDoc(requestData);
|
|
||||||
QByteArray requestDataBytes = requestDoc.toJson();
|
|
||||||
QNetworkReply* reply = networkManager->post(request, requestDataBytes);
|
|
||||||
connect(reply, &QNetworkReply::finished,this, [=]() {
|
|
||||||
if (reply->error() == QNetworkReply::NoError) {
|
|
||||||
QString responseString = QString::fromUtf8(reply->readAll());
|
|
||||||
qDebug() << responseString;
|
|
||||||
QJsonDocument doc = QJsonDocument::fromJson(responseString.toUtf8());
|
|
||||||
QJsonObject jsonObj = doc.object();
|
|
||||||
QString text = jsonObj.value("choices").toArray().at(0).toObject().value("message").toObject().value("content").toString();
|
|
||||||
if(text.isEmpty()){
|
|
||||||
text = "响应错误:content为空数据";
|
|
||||||
}else{
|
|
||||||
messages.append(createMessage("assistant",text));
|
|
||||||
}
|
|
||||||
responseData(text.trimmed());
|
|
||||||
} else {
|
|
||||||
responseData("网络错误:"+reply->errorString());
|
|
||||||
}
|
|
||||||
isLoading(false);
|
|
||||||
reply->deleteLater();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
QJsonObject ChatController::createMessage(const QString& role,const QString& content){
|
|
||||||
QJsonObject message;
|
|
||||||
message.insert("role",role);
|
|
||||||
message.insert("content",content);
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ChatController::clipText(const QString& text){
|
|
||||||
qDebug()<<text;
|
|
||||||
QClipboard *clipboard = QGuiApplication::clipboard();
|
|
||||||
clipboard->setText(text);
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
#ifndef CHATCONTROLLER_H
|
|
||||||
#define CHATCONTROLLER_H
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QNetworkAccessManager>
|
|
||||||
#include <QNetworkReply>
|
|
||||||
#include <QJsonObject>
|
|
||||||
#include <QJsonDocument>
|
|
||||||
#include <QJsonArray>
|
|
||||||
#include <QGuiApplication>
|
|
||||||
#include <QClipboard>
|
|
||||||
#include <QByteArray>
|
|
||||||
#include <QFile>
|
|
||||||
#include "../stdafx.h"
|
|
||||||
|
|
||||||
class ChatController : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
Q_PROPERTY_AUTO(bool,isLoading)
|
|
||||||
Q_PROPERTY_AUTO(QString,responseData);
|
|
||||||
public:
|
|
||||||
explicit ChatController(QObject *parent = nullptr);
|
|
||||||
|
|
||||||
Q_INVOKABLE void sendMessage(const QString& text);
|
|
||||||
Q_INVOKABLE void clipText(const QString& text);
|
|
||||||
private:
|
|
||||||
QJsonObject createMessage(const QString& role,const QString& content);
|
|
||||||
|
|
||||||
private:
|
|
||||||
QNetworkAccessManager* networkManager;
|
|
||||||
QJsonArray messages;
|
|
||||||
QString baseKey = "c2stbXgxWm5MQkZ5TzhNYzNmRWl6eDZUM0JsYmtGSnNBWjNiakJjSXB6WGN3QW9KSk11";
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // CHATCONTROLLER_H
|
|
@ -6,11 +6,7 @@
|
|||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include "lang/Lang.h"
|
#include "lang/Lang.h"
|
||||||
#include "AppInfo.h"
|
#include "AppInfo.h"
|
||||||
#include "controller/ChatController.h"
|
|
||||||
#include "tool/IPC.h"
|
#include "tool/IPC.h"
|
||||||
#if defined(STATICLIB)
|
|
||||||
#include <FluentUI.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@ -41,10 +37,6 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
app.setQuitOnLastWindowClosed(false);
|
app.setQuitOnLastWindowClosed(false);
|
||||||
QQmlApplicationEngine engine;
|
QQmlApplicationEngine engine;
|
||||||
#if defined(STATICLIB)
|
|
||||||
FluentUI::initialize(&engine);
|
|
||||||
#endif
|
|
||||||
qmlRegisterType<ChatController>("Controller",1,0,"ChatController");
|
|
||||||
QQmlContext * context = engine.rootContext();
|
QQmlContext * context = engine.rootContext();
|
||||||
Lang* lang = appInfo->lang();
|
Lang* lang = appInfo->lang();
|
||||||
context->setContextProperty("lang",lang);
|
context->setContextProperty("lang",lang);
|
||||||
@ -53,6 +45,7 @@ int main(int argc, char *argv[])
|
|||||||
});
|
});
|
||||||
context->setContextProperty("appInfo",appInfo);
|
context->setContextProperty("appInfo",appInfo);
|
||||||
const QUrl url(QStringLiteral("qrc:/example/qml/App.qml"));
|
const QUrl url(QStringLiteral("qrc:/example/qml/App.qml"));
|
||||||
|
// const QUrl url(QStringLiteral("qrc:/example/qml/window/main.qml"));
|
||||||
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
|
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
|
||||||
&app, [url](QObject *obj, const QUrl &objUrl) {
|
&app, [url](QObject *obj, const QUrl &objUrl) {
|
||||||
if (!obj && url == objUrl)
|
if (!obj && url == objUrl)
|
||||||
|
@ -9,12 +9,11 @@ if(APPLE)
|
|||||||
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE)
|
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#设置可执行文件输出目录
|
##设置动态库输出目录
|
||||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_PREFIX_PATH}/bin)
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/debug)
|
|
||||||
else()
|
##设置库文件输出目录
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/release)
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_PREFIX_PATH}/lib)
|
||||||
endif()
|
|
||||||
|
|
||||||
#设置版本号
|
#设置版本号
|
||||||
add_definitions(-DVERSION=1,2,9,0)
|
add_definitions(-DVERSION=1,2,9,0)
|
||||||
@ -36,7 +35,7 @@ foreach(filepath ${QML_PATHS})
|
|||||||
endforeach(filepath)
|
endforeach(filepath)
|
||||||
|
|
||||||
#遍历所有资源文件
|
#遍历所有资源文件
|
||||||
file(GLOB_RECURSE RES_PATHS *.png *.jpg *.svg *.ico *.ttf *.webp)
|
file(GLOB_RECURSE RES_PATHS *.png *.jpg *.svg *.ico *.ttf *.webp *.metainfo)
|
||||||
foreach(filepath ${RES_PATHS})
|
foreach(filepath ${RES_PATHS})
|
||||||
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
||||||
list(APPEND resource_files ${filename})
|
list(APPEND resource_files ${filename})
|
||||||
@ -49,6 +48,7 @@ foreach(filepath IN LISTS qml_files resource_files)
|
|||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
#添加qml模块
|
#添加qml模块
|
||||||
|
qt_add_library(fluentui SHARED)
|
||||||
qt_add_qml_module(fluentui
|
qt_add_qml_module(fluentui
|
||||||
OUTPUT_DIRECTORY ${CMAKE_PREFIX_PATH}/qml/FluentUI
|
OUTPUT_DIRECTORY ${CMAKE_PREFIX_PATH}/qml/FluentUI
|
||||||
VERSION 1.0
|
VERSION 1.0
|
||||||
@ -69,3 +69,7 @@ target_link_libraries(fluentui PUBLIC
|
|||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_link_libraries(fluentui PRIVATE dwmapi user32)
|
target_link_libraries(fluentui PRIVATE dwmapi user32)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
#如果是debug,则生成的库文件名后面拼接d
|
||||||
|
set_target_properties(fluentui PROPERTIES DEBUG_POSTFIX "d")
|
||||||
|
set_target_properties(fluentuiplugin PROPERTIES DEBUG_POSTFIX "d")
|
||||||
|
12
src/Def.h
@ -6,13 +6,13 @@
|
|||||||
|
|
||||||
namespace Fluent_DarkMode {
|
namespace Fluent_DarkMode {
|
||||||
Q_NAMESPACE
|
Q_NAMESPACE
|
||||||
enum Fluent_DarkModeType {
|
enum Fluent_DarkModeType {
|
||||||
System = 0x0,
|
System = 0x0,
|
||||||
Light = 0x1,
|
Light = 0x1,
|
||||||
Dark = 0x2,
|
Dark = 0x2,
|
||||||
};
|
};
|
||||||
QML_NAMED_ELEMENT(FluDarkMode)
|
Q_ENUM_NS(Fluent_DarkModeType)
|
||||||
Q_ENUMS(Fluent_DarkModeType);
|
QML_NAMED_ELEMENT(FluDarkMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Fluent_Awesome {
|
namespace Fluent_Awesome {
|
||||||
@ -1422,8 +1422,8 @@ enum class Fluent_AwesomeType {
|
|||||||
SpeechSolidBold=0xf8b2,
|
SpeechSolidBold=0xf8b2,
|
||||||
ClickedOutLoudSolidBold=0xf8b3,
|
ClickedOutLoudSolidBold=0xf8b3,
|
||||||
};
|
};
|
||||||
QML_NAMED_ELEMENT(FluentIcons)
|
Q_ENUM_NS(Fluent_AwesomeType)
|
||||||
Q_ENUMS(Fluent_AwesomeType)
|
QML_NAMED_ELEMENT(FluentIcons)
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // DEF_H
|
#endif // DEF_H
|
||||||
|
@ -9,27 +9,16 @@
|
|||||||
#include <QFontDatabase>
|
#include <QFontDatabase>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include "Def.h"
|
#include "Def.h"
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
#pragma comment(lib, "Dwmapi.lib")
|
FluApp* FluApp::m_instance = nullptr;
|
||||||
#pragma comment(lib, "User32.lib")
|
|
||||||
#include <dwmapi.h>
|
FluApp *FluApp::getInstance()
|
||||||
#include <Windows.h>
|
|
||||||
#include <windowsx.h>
|
|
||||||
static bool isCompositionEnabled()
|
|
||||||
{
|
{
|
||||||
BOOL composition_enabled = FALSE;
|
if(FluApp::m_instance == nullptr){
|
||||||
bool success = ::DwmIsCompositionEnabled(&composition_enabled) == S_OK;
|
FluApp::m_instance = new FluApp;
|
||||||
return composition_enabled && success;
|
}
|
||||||
|
return FluApp::m_instance;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
FluApp* FluApp::fluApp = nullptr;
|
|
||||||
|
|
||||||
FluTheme* FluApp::fluTheme = nullptr;
|
|
||||||
|
|
||||||
FluColors* FluApp::fluColors = nullptr;
|
|
||||||
|
|
||||||
FluTools* FluApp::fluTools = nullptr;
|
|
||||||
|
|
||||||
FluApp::FluApp(QObject *parent)
|
FluApp::FluApp(QObject *parent)
|
||||||
: QObject{parent}
|
: QObject{parent}
|
||||||
@ -38,43 +27,14 @@ FluApp::FluApp(QObject *parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
FluApp::~FluApp(){
|
FluApp::~FluApp(){
|
||||||
if (nativeEvent != Q_NULLPTR) {
|
|
||||||
delete nativeEvent;
|
|
||||||
nativeEvent = Q_NULLPTR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void FluApp::setFluApp(FluApp* val){
|
|
||||||
FluApp::fluApp = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FluApp::setFluTheme(FluTheme* val){
|
|
||||||
FluApp::fluTheme = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FluApp::setFluColors(FluColors* val){
|
|
||||||
FluApp::fluColors = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FluApp::setFluTools(FluTools* val){
|
|
||||||
FluApp::fluTools = val;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluApp::init(QQuickWindow *window){
|
void FluApp::init(QQuickWindow *window){
|
||||||
this->appWindow = window;
|
this->appWindow = window;
|
||||||
QQmlEngine *engine = qmlEngine(appWindow);
|
|
||||||
QQmlComponent component(engine, ":/FluentUI/Controls/FluSingleton.qml");
|
|
||||||
component.create();
|
|
||||||
nativeEvent = new NativeEventFilter();
|
|
||||||
qApp->installNativeEventFilter(nativeEvent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluApp::run(){
|
void FluApp::run(){
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
if(!isCompositionEnabled()){
|
|
||||||
fluTheme->frameless(false);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
navigate(initialRoute());
|
navigate(initialRoute());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,31 +51,28 @@ 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 = qobject_cast<QQuickWindow*>(component.createWithInitialProperties(properties));
|
QQuickWindow *view=nullptr;
|
||||||
int launchMode = view->property("launchMode").toInt();
|
|
||||||
if(launchMode==1){
|
|
||||||
for (auto& pair : wnds) {
|
for (auto& pair : wnds) {
|
||||||
QString r = pair->property("route").toString();
|
QString r = pair->property("route").toString();
|
||||||
if(r == route){
|
if(r == route){
|
||||||
pair->setProperty("argument",argument);
|
view = pair;
|
||||||
pair->raise();
|
|
||||||
pair->requestActivate();
|
|
||||||
view->deleteLater();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else if(launchMode==2){
|
|
||||||
for (auto& pair : wnds) {
|
|
||||||
QString r = pair->property("route").toString();
|
|
||||||
if(r == route){
|
|
||||||
pair->close();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(view){
|
||||||
|
//如果窗口存在,则判断启动模式
|
||||||
|
int launchMode = view->property("launchMode").toInt();
|
||||||
|
if(launchMode == 1){
|
||||||
|
view->setProperty("argument",argument);
|
||||||
|
view->show();
|
||||||
|
view->raise();
|
||||||
|
view->requestActivate();
|
||||||
|
return;
|
||||||
|
}else if(launchMode == 2){
|
||||||
|
view->close();
|
||||||
}
|
}
|
||||||
if(fluTheme->frameless()){
|
|
||||||
view->setFlag(Qt::FramelessWindowHint,true);
|
|
||||||
}
|
}
|
||||||
|
view = qobject_cast<QQuickWindow*>(component.createWithInitialProperties(properties));
|
||||||
wnds.insert(view->winId(),view);
|
wnds.insert(view->winId(),view);
|
||||||
if(fluRegister){
|
if(fluRegister){
|
||||||
fluRegister->to(view);
|
fluRegister->to(view);
|
||||||
|
65
src/FluApp.h
@ -11,7 +11,6 @@
|
|||||||
#include "FluTheme.h"
|
#include "FluTheme.h"
|
||||||
#include "FluTools.h"
|
#include "FluTools.h"
|
||||||
#include "FluColors.h"
|
#include "FluColors.h"
|
||||||
#include "NativeEventFilter.h"
|
|
||||||
#include "FluRegister.h"
|
#include "FluRegister.h"
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
@ -33,11 +32,19 @@ class FluApp : public QObject
|
|||||||
|
|
||||||
QML_NAMED_ELEMENT(FluApp)
|
QML_NAMED_ELEMENT(FluApp)
|
||||||
QML_SINGLETON
|
QML_SINGLETON
|
||||||
|
private:
|
||||||
public:
|
/**
|
||||||
|
* @brief FluApp 将默认构造函数设置为私有,则qml创建单例就会走create工厂方法创建单例
|
||||||
|
* @param parent
|
||||||
|
*/
|
||||||
explicit FluApp(QObject *parent = nullptr);
|
explicit FluApp(QObject *parent = nullptr);
|
||||||
|
public:
|
||||||
~FluApp();
|
~FluApp();
|
||||||
|
static FluApp *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine)
|
||||||
|
{
|
||||||
|
return getInstance();
|
||||||
|
}
|
||||||
|
static FluApp *getInstance();
|
||||||
/**
|
/**
|
||||||
* @brief run
|
* @brief run
|
||||||
*/
|
*/
|
||||||
@ -69,62 +76,14 @@ public:
|
|||||||
*/
|
*/
|
||||||
Q_INVOKABLE void closeApp();
|
Q_INVOKABLE void closeApp();
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief setFluApp 在FluSingleton.qml调用,拿到QML中FluApp的单例
|
|
||||||
* @param val
|
|
||||||
*/
|
|
||||||
Q_INVOKABLE void setFluApp(FluApp* val);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief setFluTheme 在FluSingleton.qml调用,拿到QML中FluTheme的单例
|
|
||||||
* @param val
|
|
||||||
*/
|
|
||||||
Q_INVOKABLE void setFluTheme(FluTheme* val);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief setFluColors 在FluSingleton.qml调用,拿到QML中FluColors的单例
|
|
||||||
* @param val
|
|
||||||
*/
|
|
||||||
Q_INVOKABLE void setFluColors(FluColors* val);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief setFluColors 在FluSingleton.qml调用,拿到QML中FluTools的单例
|
|
||||||
* @param val
|
|
||||||
*/
|
|
||||||
Q_INVOKABLE void setFluTools(FluTools* val);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief wnds
|
* @brief wnds
|
||||||
*/
|
*/
|
||||||
QMap<quint64, QQuickWindow*> wnds;
|
QMap<quint64, QQuickWindow*> wnds;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief fluApp
|
|
||||||
*/
|
|
||||||
static FluApp* fluApp;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief fluTheme
|
|
||||||
*/
|
|
||||||
static FluTheme* fluTheme;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief fluColors
|
|
||||||
*/
|
|
||||||
static FluColors* fluColors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief fluTools
|
|
||||||
*/
|
|
||||||
static FluTools* fluTools;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
static FluApp* m_instance;
|
||||||
* @brief nativeEvent
|
|
||||||
*/
|
|
||||||
NativeEventFilter *nativeEvent = Q_NULLPTR;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief appWindow
|
* @brief appWindow
|
||||||
*/
|
*/
|
||||||
|
@ -19,7 +19,6 @@ class FluColorSet : public QObject
|
|||||||
Q_PROPERTY_AUTO(QString,lightest)
|
Q_PROPERTY_AUTO(QString,lightest)
|
||||||
public:
|
public:
|
||||||
explicit FluColorSet(QObject *parent = nullptr);
|
explicit FluColorSet(QObject *parent = nullptr);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FLUCOLORSET_H
|
#endif // FLUCOLORSET_H
|
||||||
|
@ -1,5 +1,15 @@
|
|||||||
#include "FluColors.h"
|
#include "FluColors.h"
|
||||||
|
|
||||||
|
FluColors* FluColors::m_instance = nullptr;
|
||||||
|
|
||||||
|
FluColors *FluColors::getInstance()
|
||||||
|
{
|
||||||
|
if(FluColors::m_instance == nullptr){
|
||||||
|
FluColors::m_instance = new FluColors;
|
||||||
|
}
|
||||||
|
return FluColors::m_instance;
|
||||||
|
}
|
||||||
|
|
||||||
FluColors::FluColors(QObject *parent)
|
FluColors::FluColors(QObject *parent)
|
||||||
: QObject{parent}
|
: QObject{parent}
|
||||||
{
|
{
|
||||||
|
@ -46,8 +46,15 @@ class FluColors : public QObject
|
|||||||
Q_PROPERTY_AUTO(FluColorSet*,Green);
|
Q_PROPERTY_AUTO(FluColorSet*,Green);
|
||||||
QML_NAMED_ELEMENT(FluColors)
|
QML_NAMED_ELEMENT(FluColors)
|
||||||
QML_SINGLETON
|
QML_SINGLETON
|
||||||
public:
|
private:
|
||||||
explicit FluColors(QObject *parent = nullptr);
|
explicit FluColors(QObject *parent = nullptr);
|
||||||
|
static FluColors* m_instance;
|
||||||
|
public:
|
||||||
|
static FluColors *getInstance();
|
||||||
|
static FluColors *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine)
|
||||||
|
{
|
||||||
|
return getInstance();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FLUCOLORS_H
|
#endif // FLUCOLORS_H
|
||||||
|
@ -12,7 +12,7 @@ FluRegister::FluRegister(QObject *parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FluRegister::launch(const QJsonObject& argument){
|
void FluRegister::launch(const QJsonObject& argument){
|
||||||
FluApp::fluApp->navigate(path(),argument,this);
|
FluApp::getInstance()->navigate(path(),argument,this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluRegister::onResult(const QJsonObject& data){
|
void FluRegister::onResult(const QJsonObject& data){
|
||||||
|
38
src/FluTextStyle.cpp
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#include "FluTextStyle.h"
|
||||||
|
|
||||||
|
FluTextStyle::FluTextStyle(QObject *parent)
|
||||||
|
: QObject{parent}
|
||||||
|
{
|
||||||
|
QFont caption;
|
||||||
|
caption.setPixelSize(12);
|
||||||
|
Caption(caption);
|
||||||
|
|
||||||
|
QFont body;
|
||||||
|
body.setPixelSize(14);
|
||||||
|
Body(body);
|
||||||
|
|
||||||
|
QFont bodyStrong;
|
||||||
|
bodyStrong.setPixelSize(14);
|
||||||
|
bodyStrong.setBold(true);
|
||||||
|
BodyStrong(bodyStrong);
|
||||||
|
|
||||||
|
QFont subtitle;
|
||||||
|
subtitle.setPixelSize(20);
|
||||||
|
subtitle.setBold(true);
|
||||||
|
Subtitle(subtitle);
|
||||||
|
|
||||||
|
QFont title;
|
||||||
|
title.setPixelSize(28);
|
||||||
|
title.setBold(true);
|
||||||
|
Title(title);
|
||||||
|
|
||||||
|
QFont titleLarge;
|
||||||
|
titleLarge.setPixelSize(40);
|
||||||
|
titleLarge.setBold(true);
|
||||||
|
TitleLarge(titleLarge);
|
||||||
|
|
||||||
|
QFont display;
|
||||||
|
display.setPixelSize(68);
|
||||||
|
display.setBold(true);
|
||||||
|
Display(display);
|
||||||
|
}
|
27
src/FluTextStyle.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#ifndef FLUTEXTSTYLE_H
|
||||||
|
#define FLUTEXTSTYLE_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QtQml/qqml.h>
|
||||||
|
#include <QFont>
|
||||||
|
#include "stdafx.h"
|
||||||
|
|
||||||
|
class FluTextStyle : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit FluTextStyle(QObject *parent = nullptr);
|
||||||
|
Q_PROPERTY_AUTO(QFont,Caption);
|
||||||
|
Q_PROPERTY_AUTO(QFont,Body);
|
||||||
|
Q_PROPERTY_AUTO(QFont,BodyStrong);
|
||||||
|
Q_PROPERTY_AUTO(QFont,Subtitle);
|
||||||
|
Q_PROPERTY_AUTO(QFont,Title);
|
||||||
|
Q_PROPERTY_AUTO(QFont,TitleLarge);
|
||||||
|
Q_PROPERTY_AUTO(QFont,Display);
|
||||||
|
QML_NAMED_ELEMENT(FluTextStyle)
|
||||||
|
QML_SINGLETON
|
||||||
|
signals:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FLUTEXTSTYLE_H
|
@ -5,16 +5,24 @@
|
|||||||
#include "FluApp.h"
|
#include "FluApp.h"
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
|
|
||||||
|
FluTheme* FluTheme::m_instance = nullptr;
|
||||||
|
|
||||||
|
FluTheme *FluTheme::getInstance()
|
||||||
|
{
|
||||||
|
if(FluTheme::m_instance == nullptr){
|
||||||
|
FluTheme::m_instance = new FluTheme;
|
||||||
|
}
|
||||||
|
return FluTheme::m_instance;
|
||||||
|
}
|
||||||
|
|
||||||
FluTheme::FluTheme(QObject *parent)
|
FluTheme::FluTheme(QObject *parent)
|
||||||
: QObject{parent}
|
: QObject{parent}
|
||||||
{
|
{
|
||||||
connect(this,&FluTheme::darkModeChanged,this,[=]{
|
connect(this,&FluTheme::darkModeChanged,this,[=]{
|
||||||
Q_EMIT darkChanged();
|
Q_EMIT darkChanged();
|
||||||
});
|
});
|
||||||
primaryColor(FluApp::fluColors->Blue());
|
primaryColor(FluColors::getInstance()->Blue());
|
||||||
textSize(13);
|
|
||||||
nativeText(false);
|
nativeText(false);
|
||||||
frameless(true);
|
|
||||||
darkMode(Fluent_DarkMode::Fluent_DarkModeType::Light);
|
darkMode(Fluent_DarkMode::Fluent_DarkModeType::Light);
|
||||||
qApp->installEventFilter(this);
|
qApp->installEventFilter(this);
|
||||||
}
|
}
|
||||||
|
@ -22,11 +22,6 @@ class FluTheme : public QObject
|
|||||||
*/
|
*/
|
||||||
Q_PROPERTY_AUTO(FluColorSet*,primaryColor)
|
Q_PROPERTY_AUTO(FluColorSet*,primaryColor)
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief frameless 是否是无边框窗口,只支持windows部分电脑
|
|
||||||
*/
|
|
||||||
Q_PROPERTY_AUTO(bool,frameless);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief darkMode 夜间模式,支持System=0、Light=1、Dark=2
|
* @brief darkMode 夜间模式,支持System=0、Light=1、Dark=2
|
||||||
*/
|
*/
|
||||||
@ -37,15 +32,17 @@ class FluTheme : public QObject
|
|||||||
*/
|
*/
|
||||||
Q_PROPERTY_AUTO(bool,nativeText);
|
Q_PROPERTY_AUTO(bool,nativeText);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief textSize 文字大小
|
|
||||||
*/
|
|
||||||
Q_PROPERTY_AUTO(int,textSize);
|
|
||||||
|
|
||||||
QML_NAMED_ELEMENT(FluTheme)
|
QML_NAMED_ELEMENT(FluTheme)
|
||||||
QML_SINGLETON
|
QML_SINGLETON
|
||||||
public:
|
private:
|
||||||
|
static FluTheme* m_instance;
|
||||||
explicit FluTheme(QObject *parent = nullptr);
|
explicit FluTheme(QObject *parent = nullptr);
|
||||||
|
public:
|
||||||
|
static FluTheme *getInstance();
|
||||||
|
static FluTheme *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine)
|
||||||
|
{
|
||||||
|
return getInstance();
|
||||||
|
}
|
||||||
bool dark();
|
bool dark();
|
||||||
Q_SIGNAL void darkChanged();
|
Q_SIGNAL void darkChanged();
|
||||||
private:
|
private:
|
||||||
|
@ -3,6 +3,17 @@
|
|||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
|
|
||||||
|
FluTools* FluTools::m_instance = nullptr;
|
||||||
|
|
||||||
|
FluTools *FluTools::getInstance()
|
||||||
|
{
|
||||||
|
if(FluTools::m_instance == nullptr){
|
||||||
|
FluTools::m_instance = new FluTools;
|
||||||
|
}
|
||||||
|
return FluTools::m_instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
FluTools::FluTools(QObject *parent)
|
FluTools::FluTools(QObject *parent)
|
||||||
: QObject{parent}
|
: QObject{parent}
|
||||||
{
|
{
|
||||||
|
@ -13,10 +13,15 @@ class FluTools : public QObject
|
|||||||
|
|
||||||
QML_NAMED_ELEMENT(FluTools)
|
QML_NAMED_ELEMENT(FluTools)
|
||||||
QML_SINGLETON
|
QML_SINGLETON
|
||||||
|
private:
|
||||||
public:
|
|
||||||
explicit FluTools(QObject *parent = nullptr);
|
explicit FluTools(QObject *parent = nullptr);
|
||||||
|
static FluTools* m_instance;
|
||||||
|
public:
|
||||||
|
static FluTools *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine)
|
||||||
|
{
|
||||||
|
return getInstance();
|
||||||
|
}
|
||||||
|
static FluTools *getInstance();
|
||||||
/**
|
/**
|
||||||
* @brief clipText 将字符串添加到剪切板
|
* @brief clipText 将字符串添加到剪切板
|
||||||
* @param text
|
* @param text
|
||||||
|
@ -1,81 +0,0 @@
|
|||||||
#include "NativeEventFilter.h"
|
|
||||||
#include "FluTheme.h"
|
|
||||||
#include "FluApp.h"
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
#pragma comment(lib, "Dwmapi.lib")
|
|
||||||
#pragma comment(lib, "User32.lib")
|
|
||||||
#include <Windows.h>
|
|
||||||
#include <windowsx.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool NativeEventFilter::nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result)
|
|
||||||
{
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
if (eventType == "windows_generic_MSG" && FluApp::fluTheme->frameless()) {
|
|
||||||
MSG* msg = static_cast<MSG *>(message);
|
|
||||||
if (msg == Q_NULLPTR)
|
|
||||||
return false;
|
|
||||||
if(!FluApp::fluApp->wnds.contains((WId)msg->hwnd)){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
switch(msg->message) {
|
|
||||||
case WM_NCCALCSIZE:{
|
|
||||||
NCCALCSIZE_PARAMS& params = *reinterpret_cast<NCCALCSIZE_PARAMS*>(msg->lParam);
|
|
||||||
if (params.rgrc[0].top != 0)
|
|
||||||
params.rgrc[0].top -= 1;
|
|
||||||
*result = WVR_REDRAW;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
case WM_NCHITTEST: {
|
|
||||||
auto view = FluApp::fluApp->wnds[(WId)msg->hwnd];
|
|
||||||
bool isResize = !(view->maximumWidth()==view->minimumWidth()&&view->maximumHeight()==view->minimumHeight());
|
|
||||||
const LONG borderWidth = 8;
|
|
||||||
RECT winrect;
|
|
||||||
GetWindowRect(msg->hwnd, &winrect);
|
|
||||||
long x = GET_X_LPARAM(msg->lParam);
|
|
||||||
long y = GET_Y_LPARAM(msg->lParam);
|
|
||||||
if (x >= winrect.left && x < winrect.left + borderWidth &&
|
|
||||||
y < winrect.bottom && y >= winrect.bottom - borderWidth && isResize) {
|
|
||||||
*result = HTBOTTOMLEFT;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (x < winrect.right && x >= winrect.right - borderWidth &&
|
|
||||||
y < winrect.bottom && y >= winrect.bottom - borderWidth && isResize) {
|
|
||||||
*result = HTBOTTOMRIGHT;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (x >= winrect.left && x < winrect.left + borderWidth &&
|
|
||||||
y >= winrect.top && y < winrect.top + borderWidth && isResize) {
|
|
||||||
*result = HTTOPLEFT;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (x < winrect.right && x >= winrect.right - borderWidth &&
|
|
||||||
y >= winrect.top && y < winrect.top + borderWidth && isResize) {
|
|
||||||
*result = HTTOPRIGHT;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (x >= winrect.left && x < winrect.left + borderWidth && isResize) {
|
|
||||||
*result = HTLEFT;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (x < winrect.right && x >= winrect.right - borderWidth && isResize) {
|
|
||||||
*result = HTRIGHT;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (y < winrect.bottom && y >= winrect.bottom - borderWidth && isResize) {
|
|
||||||
*result = HTBOTTOM;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (y >= winrect.top && y < winrect.top + borderWidth && isResize) {
|
|
||||||
*result = HTTOP;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return false;
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
#ifndef NATIVEEVENTFILTER_H
|
|
||||||
#define NATIVEEVENTFILTER_H
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QAbstractNativeEventFilter>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The NativeEventFilter class
|
|
||||||
*/
|
|
||||||
class NativeEventFilter : public QAbstractNativeEventFilter
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result) override;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // NATIVEEVENTFILTER_H
|
|
@ -2,20 +2,6 @@
|
|||||||
|
|
||||||
#include "FluRegister.h"
|
#include "FluRegister.h"
|
||||||
#include "FluApp.h"
|
#include "FluApp.h"
|
||||||
#include "FluTheme.h"
|
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
#pragma comment(lib, "Dwmapi.lib")
|
|
||||||
#pragma comment(lib, "User32.lib")
|
|
||||||
#include <dwmapi.h>
|
|
||||||
#include <Windows.h>
|
|
||||||
#include <windowsx.h>
|
|
||||||
enum class Style : DWORD
|
|
||||||
{
|
|
||||||
windowed = (WS_OVERLAPPEDWINDOW | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_THICKFRAME | WS_CLIPCHILDREN),
|
|
||||||
aero_borderless = (WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_THICKFRAME | WS_CLIPCHILDREN)
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
WindowHelper::WindowHelper(QObject *parent)
|
WindowHelper::WindowHelper(QObject *parent)
|
||||||
: QObject{parent}
|
: QObject{parent}
|
||||||
@ -27,20 +13,6 @@ void WindowHelper::initWindow(QQuickWindow* window){
|
|||||||
this->window = window;
|
this->window = window;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowHelper::firstUpdate(){
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
if(FluApp::fluTheme->frameless()){
|
|
||||||
HWND wnd = (HWND)window->winId();
|
|
||||||
SetWindowLongPtr(wnd, GWL_STYLE, static_cast<LONG>(Style::aero_borderless));
|
|
||||||
const MARGINS shadow_on = { 1, 1, 1, 1 };
|
|
||||||
DwmExtendFrameIntoClientArea(wnd, &shadow_on);
|
|
||||||
SetWindowPos(wnd, Q_NULLPTR, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE);
|
|
||||||
ShowWindow(wnd, SW_SHOW);
|
|
||||||
window->setFlag(Qt::FramelessWindowHint,false);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant WindowHelper::createRegister(QQuickWindow* window,const QString& path){
|
QVariant WindowHelper::createRegister(QQuickWindow* window,const QString& path){
|
||||||
FluRegister *p = new FluRegister(window);
|
FluRegister *p = new FluRegister(window);
|
||||||
p->from(window);
|
p->from(window);
|
||||||
@ -48,9 +20,9 @@ QVariant WindowHelper::createRegister(QQuickWindow* window,const QString& path){
|
|||||||
return QVariant::fromValue(p);
|
return QVariant::fromValue(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowHelper::destoryWindow(){
|
void WindowHelper::deleteWindow(){
|
||||||
if(this->window){
|
if(this->window){
|
||||||
FluApp::fluApp->wnds.remove(this->window->winId());
|
FluApp::getInstance()->wnds.remove(this->window->winId());
|
||||||
this->window->deleteLater();
|
this->window->deleteLater();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,9 +25,9 @@ public:
|
|||||||
Q_INVOKABLE void initWindow(QQuickWindow* window);
|
Q_INVOKABLE void initWindow(QQuickWindow* window);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief destoryWindow 销毁窗口,释放资源,QML中的Window close并不会销毁窗口,只是把窗口隐藏了
|
* @brief deleteWindow 销毁窗口,释放资源,QML中的Window close并不会销毁窗口,只是把窗口隐藏了
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE void destoryWindow();
|
Q_INVOKABLE void deleteWindow();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief createRegister 创建一个FluRegsiter对象,在FluWindow中registerForWindowResult方法调用
|
* @brief createRegister 创建一个FluRegsiter对象,在FluWindow中registerForWindowResult方法调用
|
||||||
@ -37,11 +37,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
Q_INVOKABLE QVariant createRegister(QQuickWindow* window,const QString& path);
|
Q_INVOKABLE QVariant createRegister(QQuickWindow* window,const QString& path);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief firstUpdate 窗口创建成功后调用,只调用一次
|
|
||||||
*/
|
|
||||||
Q_INVOKABLE void firstUpdate();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QQuickWindow* window;
|
QQuickWindow* window;
|
||||||
};
|
};
|
||||||
|
@ -31,7 +31,7 @@ Rectangle{
|
|||||||
|
|
||||||
id:root
|
id:root
|
||||||
color: Qt.rgba(0,0,0,0)
|
color: Qt.rgba(0,0,0,0)
|
||||||
visible: FluTheme.frameless
|
visible: false
|
||||||
height: visible ? 30 : 0
|
height: visible ? 30 : 0
|
||||||
opacity: visible
|
opacity: visible
|
||||||
z: 65535
|
z: 65535
|
||||||
@ -55,9 +55,6 @@ Rectangle{
|
|||||||
leftMargin: 10
|
leftMargin: 10
|
||||||
}
|
}
|
||||||
color:root.textColor
|
color:root.textColor
|
||||||
fontStyle: FluText.Title
|
|
||||||
font.pixelSize: 14
|
|
||||||
font.bold: true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout{
|
RowLayout{
|
||||||
|
@ -18,6 +18,7 @@ Button {
|
|||||||
enabled: !disabled
|
enabled: !disabled
|
||||||
focusPolicy:Qt.TabFocus
|
focusPolicy:Qt.TabFocus
|
||||||
Keys.onSpacePressed: control.visualFocus&&clicked()
|
Keys.onSpacePressed: control.visualFocus&&clicked()
|
||||||
|
font:FluTextStyle.Body
|
||||||
|
|
||||||
background: Rectangle{
|
background: Rectangle{
|
||||||
border.color: FluTheme.dark ? "#505050" : "#DFDFDF"
|
border.color: FluTheme.dark ? "#505050" : "#DFDFDF"
|
||||||
@ -38,6 +39,7 @@ Button {
|
|||||||
text: control.text
|
text: control.text
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
font: control.font
|
||||||
color: {
|
color: {
|
||||||
if(FluTheme.dark){
|
if(FluTheme.dark){
|
||||||
if(disabled){
|
if(disabled){
|
||||||
|
@ -65,7 +65,7 @@ Popup {
|
|||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
id:text_title
|
id:text_title
|
||||||
fontStyle: FluText.TitleLarge
|
font: FluTextStyle.TitleLarge
|
||||||
text:title
|
text:title
|
||||||
topPadding: 20
|
topPadding: 20
|
||||||
leftPadding: 20
|
leftPadding: 20
|
||||||
@ -80,7 +80,7 @@ Popup {
|
|||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
id:text_message
|
id:text_message
|
||||||
fontStyle: FluText.Body
|
font: FluTextStyle.Body
|
||||||
wrapMode: Text.WrapAnywhere
|
wrapMode: Text.WrapAnywhere
|
||||||
text:message
|
text:message
|
||||||
topPadding: 14
|
topPadding: 14
|
||||||
|
@ -17,7 +17,7 @@ Item {
|
|||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
id:text_title
|
id:text_title
|
||||||
fontStyle: FluText.TitleLarge
|
font: FluTextStyle.TitleLarge
|
||||||
anchors{
|
anchors{
|
||||||
top: parent.top
|
top: parent.top
|
||||||
topMargin: control.topPadding
|
topMargin: control.topPadding
|
||||||
|
38
src/imports/FluentUI/Controls/FluCopyableText.qml
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import FluentUI
|
||||||
|
|
||||||
|
TextField {
|
||||||
|
|
||||||
|
property color textColor: FluTheme.dark ? FluColors.White : FluColors.Grey220
|
||||||
|
|
||||||
|
id:control
|
||||||
|
color: textColor
|
||||||
|
readOnly: true
|
||||||
|
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
||||||
|
padding: 0
|
||||||
|
leftPadding: 0
|
||||||
|
rightPadding: 0
|
||||||
|
topPadding: 0
|
||||||
|
bottomPadding: 0
|
||||||
|
selectionColor: FluTheme.primaryColor.lightest
|
||||||
|
TextMetrics {
|
||||||
|
id: text_metrics
|
||||||
|
font:control.font
|
||||||
|
text: control.text
|
||||||
|
}
|
||||||
|
background: Item{
|
||||||
|
implicitWidth: text_metrics.width+10
|
||||||
|
implicitHeight: text_metrics.height
|
||||||
|
}
|
||||||
|
font:FluTextStyle.Body
|
||||||
|
TapHandler {
|
||||||
|
acceptedButtons: Qt.RightButton
|
||||||
|
onTapped: control.echoMode !== TextInput.Password && menu.popup()
|
||||||
|
}
|
||||||
|
FluTextBoxMenu{
|
||||||
|
id:menu
|
||||||
|
inputItem: control
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -19,6 +19,7 @@ Button {
|
|||||||
rightPadding:15
|
rightPadding:15
|
||||||
Keys.onSpacePressed: control.visualFocus&&clicked()
|
Keys.onSpacePressed: control.visualFocus&&clicked()
|
||||||
focusPolicy:Qt.TabFocus
|
focusPolicy:Qt.TabFocus
|
||||||
|
font:FluTextStyle.Body
|
||||||
background: Rectangle{
|
background: Rectangle{
|
||||||
radius: 4
|
radius: 4
|
||||||
FluFocusRectangle{
|
FluFocusRectangle{
|
||||||
@ -37,6 +38,7 @@ Button {
|
|||||||
}
|
}
|
||||||
contentItem: FluText {
|
contentItem: FluText {
|
||||||
text: control.text
|
text: control.text
|
||||||
|
font: control.font
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
color: {
|
color: {
|
||||||
|
@ -5,8 +5,6 @@ import FluentUI
|
|||||||
|
|
||||||
TextArea{
|
TextArea{
|
||||||
|
|
||||||
property int fontStyle: FluText.Body
|
|
||||||
property int pixelSize : FluTheme.textSize
|
|
||||||
property bool disabled: false
|
property bool disabled: false
|
||||||
property color normalColor: FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1)
|
property color normalColor: FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1)
|
||||||
property color disableColor: FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)
|
property color disableColor: FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)
|
||||||
@ -23,6 +21,7 @@ TextArea{
|
|||||||
}
|
}
|
||||||
return normalColor
|
return normalColor
|
||||||
}
|
}
|
||||||
|
font:FluTextStyle.Body
|
||||||
wrapMode: Text.WrapAnywhere
|
wrapMode: Text.WrapAnywhere
|
||||||
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
||||||
selectionColor: FluTheme.primaryColor.lightest
|
selectionColor: FluTheme.primaryColor.lightest
|
||||||
@ -35,46 +34,6 @@ TextArea{
|
|||||||
}
|
}
|
||||||
return placeholderNormalColor
|
return placeholderNormalColor
|
||||||
}
|
}
|
||||||
font.bold: {
|
|
||||||
switch (fontStyle) {
|
|
||||||
case FluText.Display:
|
|
||||||
return true
|
|
||||||
case FluText.TitleLarge:
|
|
||||||
return true
|
|
||||||
case FluText.Title:
|
|
||||||
return true
|
|
||||||
case FluText.SubTitle:
|
|
||||||
return true
|
|
||||||
case FluText.BodyStrong:
|
|
||||||
return true
|
|
||||||
case FluText.Body:
|
|
||||||
return false
|
|
||||||
case FluText.Caption:
|
|
||||||
return false
|
|
||||||
default:
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
font.pixelSize: {
|
|
||||||
switch (fontStyle) {
|
|
||||||
case FluText.Display:
|
|
||||||
return text.pixelSize * 4.857
|
|
||||||
case FluText.TitleLarge:
|
|
||||||
return text.pixelSize * 2.857
|
|
||||||
case FluText.Title:
|
|
||||||
return text.pixelSize * 2
|
|
||||||
case FluText.SubTitle:
|
|
||||||
return text.pixelSize * 1.428
|
|
||||||
case FluText.Body:
|
|
||||||
return text.pixelSize * 1.0
|
|
||||||
case FluText.BodyStrong:
|
|
||||||
return text.pixelSize * 1.0
|
|
||||||
case FluText.Caption:
|
|
||||||
return text.pixelSize * 0.857
|
|
||||||
default:
|
|
||||||
return text.pixelSize * 1.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
background: FluTextBoxBackground{ inputItem: control }
|
background: FluTextBoxBackground{ inputItem: control }
|
||||||
TapHandler {
|
TapHandler {
|
||||||
|
@ -20,11 +20,7 @@ Item {
|
|||||||
property FluObject footerItems
|
property FluObject footerItems
|
||||||
property int displayMode: FluNavigationView.Auto
|
property int displayMode: FluNavigationView.Auto
|
||||||
property Component autoSuggestBox
|
property Component autoSuggestBox
|
||||||
property var window : {
|
property Component actionItem
|
||||||
if(Window.window == null)
|
|
||||||
return null
|
|
||||||
return Window.window
|
|
||||||
}
|
|
||||||
|
|
||||||
id:control
|
id:control
|
||||||
|
|
||||||
@ -148,7 +144,7 @@ Item {
|
|||||||
width: layout_list.width
|
width: layout_list.width
|
||||||
FluText{
|
FluText{
|
||||||
text:model.title
|
text:model.title
|
||||||
fontStyle: FluText.BodyStrong
|
font: FluTextStyle.BodyStrong
|
||||||
anchors{
|
anchors{
|
||||||
bottom: parent.bottom
|
bottom: parent.bottom
|
||||||
left:parent.left
|
left:parent.left
|
||||||
@ -471,7 +467,7 @@ Item {
|
|||||||
Item {
|
Item {
|
||||||
id:nav_app_bar
|
id:nav_app_bar
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: 50
|
height: 40
|
||||||
z:999
|
z:999
|
||||||
RowLayout{
|
RowLayout{
|
||||||
height:parent.height
|
height:parent.height
|
||||||
@ -479,8 +475,8 @@ Item {
|
|||||||
FluIconButton{
|
FluIconButton{
|
||||||
iconSource: FluentIcons.ChromeBack
|
iconSource: FluentIcons.ChromeBack
|
||||||
Layout.leftMargin: 5
|
Layout.leftMargin: 5
|
||||||
Layout.preferredWidth: 40
|
Layout.preferredWidth: 30
|
||||||
Layout.preferredHeight: 40
|
Layout.preferredHeight: 30
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
disabled: nav_swipe.depth === 1
|
disabled: nav_swipe.depth === 1
|
||||||
iconSize: 13
|
iconSize: 13
|
||||||
@ -503,13 +499,13 @@ Item {
|
|||||||
id:btn_nav
|
id:btn_nav
|
||||||
iconSource: FluentIcons.GlobalNavButton
|
iconSource: FluentIcons.GlobalNavButton
|
||||||
iconSize: 15
|
iconSize: 15
|
||||||
Layout.preferredWidth: d.isMinimal ? 40 : 0
|
Layout.preferredWidth: d.isMinimal ? 30 : 0
|
||||||
Layout.preferredHeight: 40
|
Layout.preferredHeight: 30
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
onClicked: {
|
onClicked: {
|
||||||
d.enableNavigationPanel = !d.enableNavigationPanel
|
d.enableNavigationPanel = !d.enableNavigationPanel
|
||||||
}
|
}
|
||||||
visible: Layout.preferredWidth !== 0
|
visible: d.isMinimal
|
||||||
Behavior on Layout.preferredWidth{
|
Behavior on Layout.preferredWidth{
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 167
|
duration: 167
|
||||||
@ -529,13 +525,30 @@ Item {
|
|||||||
}
|
}
|
||||||
return 5
|
return 5
|
||||||
}
|
}
|
||||||
|
sourceSize: Qt.size(40,40)
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
}
|
}
|
||||||
FluText{
|
FluText{
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
text:control.title
|
text:control.title
|
||||||
Layout.leftMargin: 12
|
Layout.leftMargin: 12
|
||||||
fontStyle: FluText.Body
|
font: FluTextStyle.Body
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item{
|
||||||
|
anchors.right: parent.right
|
||||||
|
height: parent.height
|
||||||
|
width: {
|
||||||
|
if(loader_action.item){
|
||||||
|
return loader_action.item.width
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
Loader{
|
||||||
|
id:loader_action
|
||||||
|
anchors.centerIn: parent
|
||||||
|
sourceComponent: actionItem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -620,7 +633,7 @@ Item {
|
|||||||
if(d.isMinimal || d.isCompactAndPanel){
|
if(d.isMinimal || d.isCompactAndPanel){
|
||||||
return FluTheme.dark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(243/255,243/255,243/255,1)
|
return FluTheme.dark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(243/255,243/255,243/255,1)
|
||||||
}
|
}
|
||||||
if(window && window.active){
|
if(Window.window.active){
|
||||||
return FluTheme.dark ? Qt.rgba(26/255,34/255,41/255,1) : Qt.rgba(238/255,244/255,249/255,1)
|
return FluTheme.dark ? Qt.rgba(26/255,34/255,41/255,1) : Qt.rgba(238/255,244/255,249/255,1)
|
||||||
}
|
}
|
||||||
return FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1)
|
return FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1)
|
||||||
|
@ -5,8 +5,6 @@ import FluentUI
|
|||||||
|
|
||||||
TextField{
|
TextField{
|
||||||
|
|
||||||
property int fontStyle: FluText.Body
|
|
||||||
property int pixelSize : FluTheme.textSize
|
|
||||||
property bool disabled: false
|
property bool disabled: false
|
||||||
property int iconSource: 0
|
property int iconSource: 0
|
||||||
property color normalColor: FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1)
|
property color normalColor: FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1)
|
||||||
@ -24,6 +22,7 @@ TextField{
|
|||||||
}
|
}
|
||||||
return normalColor
|
return normalColor
|
||||||
}
|
}
|
||||||
|
font:FluTextStyle.Body
|
||||||
echoMode:btn_reveal.pressed ? TextField.Normal : TextField.Password
|
echoMode:btn_reveal.pressed ? TextField.Normal : TextField.Password
|
||||||
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
||||||
selectionColor: FluTheme.primaryColor.lightest
|
selectionColor: FluTheme.primaryColor.lightest
|
||||||
@ -36,46 +35,6 @@ TextField{
|
|||||||
}
|
}
|
||||||
return placeholderNormalColor
|
return placeholderNormalColor
|
||||||
}
|
}
|
||||||
font.bold: {
|
|
||||||
switch (fontStyle) {
|
|
||||||
case FluText.Display:
|
|
||||||
return true
|
|
||||||
case FluText.TitleLarge:
|
|
||||||
return true
|
|
||||||
case FluText.Title:
|
|
||||||
return true
|
|
||||||
case FluText.SubTitle:
|
|
||||||
return true
|
|
||||||
case FluText.BodyStrong:
|
|
||||||
return true
|
|
||||||
case FluText.Body:
|
|
||||||
return false
|
|
||||||
case FluText.Caption:
|
|
||||||
return false
|
|
||||||
default:
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
font.pixelSize: {
|
|
||||||
switch (fontStyle) {
|
|
||||||
case FluText.Display:
|
|
||||||
return text.pixelSize * 4.857
|
|
||||||
case FluText.TitleLarge:
|
|
||||||
return text.pixelSize * 2.857
|
|
||||||
case FluText.Title:
|
|
||||||
return text.pixelSize * 2
|
|
||||||
case FluText.SubTitle:
|
|
||||||
return text.pixelSize * 1.428
|
|
||||||
case FluText.Body:
|
|
||||||
return text.pixelSize * 1.0
|
|
||||||
case FluText.BodyStrong:
|
|
||||||
return text.pixelSize * 1.0
|
|
||||||
case FluText.Caption:
|
|
||||||
return text.pixelSize * 0.857
|
|
||||||
default:
|
|
||||||
return text.pixelSize * 1.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
rightPadding: icon_end.visible ? 50 : 30
|
rightPadding: icon_end.visible ? 50 : 30
|
||||||
background: FluTextBoxBackground{
|
background: FluTextBoxBackground{
|
||||||
|
@ -57,8 +57,7 @@ Item {
|
|||||||
contentItem: Item{
|
contentItem: Item{
|
||||||
FluText {
|
FluText {
|
||||||
id:item_title
|
id:item_title
|
||||||
fontStyle: FluText.Title
|
font: FluTextStyle.Title
|
||||||
font.bold: false
|
|
||||||
text: modelData.title
|
text: modelData.title
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
color: {
|
color: {
|
||||||
|
@ -18,6 +18,7 @@ Button {
|
|||||||
visible: control.visualFocus
|
visible: control.visualFocus
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
font:FluTextStyle.Body
|
||||||
Keys.onSpacePressed: control.visualFocus&&clicked()
|
Keys.onSpacePressed: control.visualFocus&&clicked()
|
||||||
contentItem: RowLayout{
|
contentItem: RowLayout{
|
||||||
Rectangle{
|
Rectangle{
|
||||||
@ -97,6 +98,7 @@ Button {
|
|||||||
FluText{
|
FluText{
|
||||||
text: control.text
|
text: control.text
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
font: control.font
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,19 +8,20 @@ Item {
|
|||||||
|
|
||||||
property alias title: text_title.text
|
property alias title: text_title.text
|
||||||
default property alias content: container.data
|
default property alias content: container.data
|
||||||
property int spacing : 5
|
property int spacing : 0
|
||||||
property int leftPadding: 0
|
property int leftPadding: 10
|
||||||
property int topPadding: 0
|
property int topPadding: 0
|
||||||
property int rightPadding: 0
|
property int rightPadding: 10
|
||||||
property int bottomPadding: 0
|
property int bottomPadding: 10
|
||||||
|
|
||||||
id:control
|
id:control
|
||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
id:text_title
|
id:text_title
|
||||||
fontStyle: FluText.TitleLarge
|
font: FluTextStyle.Title
|
||||||
visible: text !== ""
|
visible: text !== ""
|
||||||
height: visible?implicitHeight:0
|
height: visible ? implicitHeight : 0
|
||||||
|
padding: 0
|
||||||
anchors{
|
anchors{
|
||||||
top: parent.top
|
top: parent.top
|
||||||
topMargin: control.topPadding
|
topMargin: control.topPadding
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Controls
|
|
||||||
import FluentUI
|
|
||||||
|
|
||||||
QtObject {
|
|
||||||
|
|
||||||
id:control
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
FluApp.setFluApp(FluApp)
|
|
||||||
FluApp.setFluColors(FluColors)
|
|
||||||
FluApp.setFluTheme(FluTheme)
|
|
||||||
FluApp.setFluTools(FluTools)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -58,7 +58,7 @@ Item{
|
|||||||
visible: statusMode === FluStatusView.Empty
|
visible: statusMode === FluStatusView.Empty
|
||||||
FluText{
|
FluText{
|
||||||
text:"空空如也"
|
text:"空空如也"
|
||||||
fontStyle: FluText.BodyStrong
|
font: FluTextStyle.BodyStrong
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -77,7 +77,7 @@ Item{
|
|||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
FluText{
|
FluText{
|
||||||
text:"页面出错了..."
|
text:"页面出错了..."
|
||||||
fontStyle: FluText.BodyStrong
|
font: FluTextStyle.BodyStrong
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
}
|
}
|
||||||
FluFilledButton{
|
FluFilledButton{
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Controls.Basic
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
@ -11,6 +12,7 @@ Item {
|
|||||||
property int itemCount: 1000
|
property int itemCount: 1000
|
||||||
property int pageCount: 10
|
property int pageCount: 10
|
||||||
property int itemHeight: 56
|
property int itemHeight: 56
|
||||||
|
property bool pageVisible: true
|
||||||
signal requestPage(int page,int count)
|
signal requestPage(int page,int count)
|
||||||
|
|
||||||
id:control
|
id:control
|
||||||
@ -59,6 +61,7 @@ Item {
|
|||||||
right: parent.right
|
right: parent.right
|
||||||
}
|
}
|
||||||
contentWidth: layout_table.width
|
contentWidth: layout_table.width
|
||||||
|
clip:true
|
||||||
ScrollBar.horizontal: FluScrollBar {
|
ScrollBar.horizontal: FluScrollBar {
|
||||||
}
|
}
|
||||||
Rectangle{
|
Rectangle{
|
||||||
@ -97,14 +100,14 @@ Item {
|
|||||||
left: parent.left
|
left: parent.left
|
||||||
leftMargin: 14
|
leftMargin: 14
|
||||||
}
|
}
|
||||||
fontStyle: FluText.BodyStrong
|
font: FluTextStyle.BodyStrong
|
||||||
}
|
}
|
||||||
FluDivider{
|
FluDivider{
|
||||||
width: 1
|
width: 1
|
||||||
height: 40
|
height: 40
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
visible: index !== list_coumns.count-1
|
visible: index !== model_coumns.count-1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -112,12 +115,14 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
footer: Item{
|
footer: Item{
|
||||||
height: 50
|
height: pageVisible ? 50 : 0
|
||||||
|
clip: true
|
||||||
width: layout_table.width
|
width: layout_table.width
|
||||||
FluPagination{
|
FluPagination{
|
||||||
id:pagination
|
id:pagination
|
||||||
height: 40
|
height: 40
|
||||||
pageCurrent: control.pageCurrent
|
pageCurrent: control.pageCurrent
|
||||||
|
onPageCurrentChanged: control.pageCurrent = pageCurrent
|
||||||
itemCount: control.itemCount
|
itemCount: control.itemCount
|
||||||
pageCount: control.pageCount
|
pageCount: control.pageCount
|
||||||
onRequestPage:
|
onRequestPage:
|
||||||
@ -128,15 +133,34 @@ Item {
|
|||||||
top: parent.top
|
top: parent.top
|
||||||
right: parent.right
|
right: parent.right
|
||||||
}
|
}
|
||||||
|
Connections{
|
||||||
|
target: control
|
||||||
|
function onPageCurrentChanged(){
|
||||||
|
if (control.pageCurrent!==pagination.pageCurrent)
|
||||||
|
{
|
||||||
|
pagination.calcNewPage(control.pageCurrent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
model:model_data_source
|
model:model_data_source
|
||||||
delegate: Item{
|
delegate: Control{
|
||||||
|
id:item_control
|
||||||
height: table_row.maxHeight
|
height: table_row.maxHeight
|
||||||
width: layout_table.width
|
width: layout_table.width
|
||||||
property var model_values : getObjectValues(index)
|
property var model_values : getObjectValues(index)
|
||||||
property var itemObject: getObject(index)
|
property var itemObject: getObject(index)
|
||||||
property var listModel: model
|
property var listModel: model
|
||||||
|
Rectangle{
|
||||||
|
anchors.fill: parent
|
||||||
|
color: {
|
||||||
|
if(item_control.hovered){
|
||||||
|
return FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
|
||||||
|
}
|
||||||
|
return FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(1,1,1,1)
|
||||||
|
}
|
||||||
|
}
|
||||||
Row{
|
Row{
|
||||||
id: table_row
|
id: table_row
|
||||||
spacing: 0
|
spacing: 0
|
||||||
@ -176,23 +200,16 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Component{
|
Component{
|
||||||
id:com_text
|
id:com_text
|
||||||
Item{
|
Item{
|
||||||
MouseArea{
|
FluCopyableText{
|
||||||
id:item_mouse
|
|
||||||
hoverEnabled: true
|
|
||||||
anchors.fill: parent
|
|
||||||
}
|
|
||||||
FluText{
|
|
||||||
id:table_value
|
id:table_value
|
||||||
text:String(model.itemData)
|
text:String(model.itemData)
|
||||||
width: parent.width - 14
|
width: Math.min(parent.width - 14,implicitWidth)
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
onImplicitHeightChanged: parent.parent.parent.height = Math.max(implicitHeight + 20,itemHeight)
|
onImplicitHeightChanged: parent.parent.parent.height = Math.max(implicitHeight + 20,itemHeight)
|
||||||
anchors{
|
anchors{
|
||||||
@ -200,6 +217,13 @@ Item {
|
|||||||
left: parent.left
|
left: parent.left
|
||||||
leftMargin: 14
|
leftMargin: 14
|
||||||
}
|
}
|
||||||
|
MouseArea{
|
||||||
|
id:item_mouse
|
||||||
|
hoverEnabled: true
|
||||||
|
anchors.fill: parent
|
||||||
|
cursorShape: Qt.IBeamCursor
|
||||||
|
acceptedButtons: Qt.NoButton
|
||||||
|
}
|
||||||
FluTooltip{
|
FluTooltip{
|
||||||
visible: item_mouse.containsMouse
|
visible: item_mouse.containsMouse
|
||||||
text:parent.text
|
text:parent.text
|
||||||
|
@ -4,62 +4,11 @@ import FluentUI
|
|||||||
|
|
||||||
Text {
|
Text {
|
||||||
|
|
||||||
enum FontStyle {
|
|
||||||
Display,
|
|
||||||
TitleLarge,
|
|
||||||
Title,
|
|
||||||
SubTitle,
|
|
||||||
BodyStrong,
|
|
||||||
Body,
|
|
||||||
Caption
|
|
||||||
}
|
|
||||||
|
|
||||||
property int fontStyle: FluText.Body
|
|
||||||
property color textColor: FluTheme.dark ? FluColors.White : FluColors.Grey220
|
property color textColor: FluTheme.dark ? FluColors.White : FluColors.Grey220
|
||||||
property int pixelSize : FluTheme.textSize
|
|
||||||
|
|
||||||
id:text
|
id:text
|
||||||
color: textColor
|
color: textColor
|
||||||
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
||||||
font.bold: {
|
font: FluTextStyle.Body
|
||||||
switch (fontStyle) {
|
|
||||||
case FluText.Display:
|
|
||||||
return true
|
|
||||||
case FluText.TitleLarge:
|
|
||||||
return true
|
|
||||||
case FluText.Title:
|
|
||||||
return true
|
|
||||||
case FluText.SubTitle:
|
|
||||||
return true
|
|
||||||
case FluText.BodyStrong:
|
|
||||||
return true
|
|
||||||
case FluText.Body:
|
|
||||||
return false
|
|
||||||
case FluText.Caption:
|
|
||||||
return false
|
|
||||||
default:
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
font.pixelSize: {
|
|
||||||
switch (fontStyle) {
|
|
||||||
case FluText.Display:
|
|
||||||
return text.pixelSize * 4.857
|
|
||||||
case FluText.TitleLarge:
|
|
||||||
return text.pixelSize * 2.857
|
|
||||||
case FluText.Title:
|
|
||||||
return text.pixelSize * 2
|
|
||||||
case FluText.SubTitle:
|
|
||||||
return text.pixelSize * 1.428
|
|
||||||
case FluText.Body:
|
|
||||||
return text.pixelSize * 1.0
|
|
||||||
case FluText.BodyStrong:
|
|
||||||
return text.pixelSize * 1.0
|
|
||||||
case FluText.Caption:
|
|
||||||
return text.pixelSize * 0.857
|
|
||||||
default:
|
|
||||||
return text.pixelSize * 1.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,6 @@ import FluentUI
|
|||||||
|
|
||||||
TextField{
|
TextField{
|
||||||
|
|
||||||
property int fontStyle: FluText.Body
|
|
||||||
property int pixelSize : FluTheme.textSize
|
|
||||||
property bool disabled: false
|
property bool disabled: false
|
||||||
property int iconSource: 0
|
property int iconSource: 0
|
||||||
property color normalColor: FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1)
|
property color normalColor: FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1)
|
||||||
@ -24,6 +22,7 @@ TextField{
|
|||||||
}
|
}
|
||||||
return normalColor
|
return normalColor
|
||||||
}
|
}
|
||||||
|
font:FluTextStyle.Body
|
||||||
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
||||||
selectionColor: FluTheme.primaryColor.lightest
|
selectionColor: FluTheme.primaryColor.lightest
|
||||||
placeholderTextColor: {
|
placeholderTextColor: {
|
||||||
@ -35,46 +34,6 @@ TextField{
|
|||||||
}
|
}
|
||||||
return placeholderNormalColor
|
return placeholderNormalColor
|
||||||
}
|
}
|
||||||
font.bold: {
|
|
||||||
switch (fontStyle) {
|
|
||||||
case FluText.Display:
|
|
||||||
return true
|
|
||||||
case FluText.TitleLarge:
|
|
||||||
return true
|
|
||||||
case FluText.Title:
|
|
||||||
return true
|
|
||||||
case FluText.SubTitle:
|
|
||||||
return true
|
|
||||||
case FluText.BodyStrong:
|
|
||||||
return true
|
|
||||||
case FluText.Body:
|
|
||||||
return false
|
|
||||||
case FluText.Caption:
|
|
||||||
return false
|
|
||||||
default:
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
font.pixelSize: {
|
|
||||||
switch (fontStyle) {
|
|
||||||
case FluText.Display:
|
|
||||||
return text.pixelSize * 4.857
|
|
||||||
case FluText.TitleLarge:
|
|
||||||
return text.pixelSize * 2.857
|
|
||||||
case FluText.Title:
|
|
||||||
return text.pixelSize * 2
|
|
||||||
case FluText.SubTitle:
|
|
||||||
return text.pixelSize * 1.428
|
|
||||||
case FluText.Body:
|
|
||||||
return text.pixelSize * 1.0
|
|
||||||
case FluText.BodyStrong:
|
|
||||||
return text.pixelSize * 1.0
|
|
||||||
case FluText.Caption:
|
|
||||||
return text.pixelSize * 0.857
|
|
||||||
default:
|
|
||||||
return text.pixelSize * 1.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
rightPadding: icon_end.visible ? 50 : 30
|
rightPadding: icon_end.visible ? 50 : 30
|
||||||
background: FluTextBoxBackground{
|
background: FluTextBoxBackground{
|
||||||
|
@ -14,6 +14,12 @@ FluMenu{
|
|||||||
focus:false
|
focus:false
|
||||||
enableAnimation:false
|
enableAnimation:false
|
||||||
|
|
||||||
|
onVisibleChanged: {
|
||||||
|
if(visible){
|
||||||
|
inputItem.forceActiveFocus()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Connections{
|
Connections{
|
||||||
target: inputItem
|
target: inputItem
|
||||||
function onTextChanged() {
|
function onTextChanged() {
|
||||||
|
@ -6,10 +6,11 @@ ToolTip {
|
|||||||
|
|
||||||
id:tool_tip
|
id:tool_tip
|
||||||
|
|
||||||
|
// property var font: FluTextStyle.Body
|
||||||
|
|
||||||
contentItem: FluText {
|
contentItem: FluText {
|
||||||
text: tool_tip.text
|
text: tool_tip.text
|
||||||
font: tool_tip.font
|
// font: tool_tip.font
|
||||||
fontStyle: FluText.Body
|
|
||||||
padding: 4
|
padding: 4
|
||||||
wrapMode: Text.WrapAnywhere
|
wrapMode: Text.WrapAnywhere
|
||||||
}
|
}
|
||||||
|
@ -141,6 +141,7 @@ Item {
|
|||||||
currentParentElement = item_layout.parent.itemModel
|
currentParentElement = item_layout.parent.itemModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
itemClicked(model)
|
||||||
}
|
}
|
||||||
if(selectionMode === FluTreeView.Multiple){
|
if(selectionMode === FluTreeView.Multiple){
|
||||||
|
|
||||||
@ -300,8 +301,8 @@ Item {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
function createItem(text="Title",expanded=true,items=[]){
|
function createItem(text="",expanded=true,items=[],data={}){
|
||||||
return {text:text,expanded:expanded,items:items,key:uniqueRandom(),multipSelected:false,multipIndex:0,multipParentKey:""};
|
return {text:text,expanded:expanded,items:items,key:uniqueRandom(),multipSelected:false,multipIndex:0,multipParentKey:"",data:data};
|
||||||
}
|
}
|
||||||
|
|
||||||
function uniqueRandom() {
|
function uniqueRandom() {
|
||||||
|
@ -4,7 +4,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
ApplicationWindow {
|
Window {
|
||||||
|
|
||||||
enum LaunchMode {
|
enum LaunchMode {
|
||||||
Standard,
|
Standard,
|
||||||
@ -20,7 +20,7 @@ ApplicationWindow {
|
|||||||
property var pageRegister
|
property var pageRegister
|
||||||
property var closeFunc: function(event){
|
property var closeFunc: function(event){
|
||||||
if(closeDestory){
|
if(closeDestory){
|
||||||
destoryWindow()
|
deleteWindow()
|
||||||
}else{
|
}else{
|
||||||
visible = false
|
visible = false
|
||||||
event.accepted = false
|
event.accepted = false
|
||||||
@ -28,13 +28,9 @@ ApplicationWindow {
|
|||||||
}
|
}
|
||||||
signal initArgument(var argument)
|
signal initArgument(var argument)
|
||||||
|
|
||||||
QtObject{
|
|
||||||
id:d
|
|
||||||
property bool firstFlag: true
|
|
||||||
}
|
|
||||||
|
|
||||||
id:window
|
id:window
|
||||||
background: Rectangle{
|
Rectangle{
|
||||||
|
anchors.fill: parent
|
||||||
color: {
|
color: {
|
||||||
if(active){
|
if(active){
|
||||||
return FluTheme.dark ? Qt.rgba(26/255,34/255,40/255,1) : Qt.rgba(238/255,244/255,249/255,1)
|
return FluTheme.dark ? Qt.rgba(26/255,34/255,40/255,1) : Qt.rgba(238/255,244/255,249/255,1)
|
||||||
@ -51,17 +47,9 @@ ApplicationWindow {
|
|||||||
Item{
|
Item{
|
||||||
id:container
|
id:container
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: window.visibility === Window.Maximized && FluTheme.frameless ? 8/Screen.devicePixelRatio : 0
|
|
||||||
clip: true
|
clip: true
|
||||||
}
|
}
|
||||||
|
|
||||||
onActiveChanged: {
|
|
||||||
if(d.firstFlag){
|
|
||||||
helper.firstUpdate()
|
|
||||||
d.firstFlag = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onClosing:(event)=>closeFunc(event)
|
onClosing:(event)=>closeFunc(event)
|
||||||
|
|
||||||
FluInfoBar{
|
FluInfoBar{
|
||||||
@ -76,8 +64,6 @@ ApplicationWindow {
|
|||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
helper.initWindow(window)
|
helper.initWindow(window)
|
||||||
initArgument(argument)
|
initArgument(argument)
|
||||||
window.x = (Screen.width - window.width)/2
|
|
||||||
window.y = (Screen.desktopAvailableHeight - window.height)/2
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function showSuccess(text,duration,moremsg){
|
function showSuccess(text,duration,moremsg){
|
||||||
@ -100,8 +86,8 @@ ApplicationWindow {
|
|||||||
return helper.createRegister(window,path)
|
return helper.createRegister(window,path)
|
||||||
}
|
}
|
||||||
|
|
||||||
function destoryWindow(){
|
function deleteWindow(){
|
||||||
helper.destoryWindow()
|
helper.deleteWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
function onResult(data){
|
function onResult(data){
|
||||||
|
33
src/imports/FluentUI/designer/fluentui.metainfo
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
MetaInfo {
|
||||||
|
Type {
|
||||||
|
name: "FluentUI.Controls.FluButton"
|
||||||
|
icon: "images/button-icon16.png"
|
||||||
|
|
||||||
|
ItemLibraryEntry {
|
||||||
|
name: "FluButton"
|
||||||
|
category: "FluentUI - Controls"
|
||||||
|
libraryIcon: "images/button-icon.png"
|
||||||
|
version: "1.0"
|
||||||
|
requiredImport: "FluentUI"
|
||||||
|
toolTip: qsTr("A button with text.")
|
||||||
|
|
||||||
|
Property { name: "text"; type: "binding"; value: "qsTr(\"Button\")" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Type {
|
||||||
|
name: "FluentUI.Controls.FluText"
|
||||||
|
icon: "images/label-icon16.png"
|
||||||
|
|
||||||
|
ItemLibraryEntry {
|
||||||
|
name: "FluText"
|
||||||
|
category: "FluentUI - Controls"
|
||||||
|
libraryIcon: "images/label-icon.png"
|
||||||
|
version: "1.0"
|
||||||
|
requiredImport: "FluentUI"
|
||||||
|
toolTip: qsTr("A text.")
|
||||||
|
|
||||||
|
Property { name: "text"; type: "binding"; value: "qsTr(\"Text\")" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
BIN
src/imports/FluentUI/designer/images/busyindicator-icon.png
Normal file
After Width: | Height: | Size: 320 B |
BIN
src/imports/FluentUI/designer/images/busyindicator-icon16.png
Normal file
After Width: | Height: | Size: 229 B |
BIN
src/imports/FluentUI/designer/images/busyindicator-icon@2x.png
Normal file
After Width: | Height: | Size: 643 B |
BIN
src/imports/FluentUI/designer/images/button-icon.png
Normal file
After Width: | Height: | Size: 162 B |
BIN
src/imports/FluentUI/designer/images/button-icon16.png
Normal file
After Width: | Height: | Size: 145 B |
BIN
src/imports/FluentUI/designer/images/button-icon@2x.png
Normal file
After Width: | Height: | Size: 259 B |
BIN
src/imports/FluentUI/designer/images/checkbox-icon.png
Normal file
After Width: | Height: | Size: 258 B |
BIN
src/imports/FluentUI/designer/images/checkbox-icon16.png
Normal file
After Width: | Height: | Size: 230 B |
BIN
src/imports/FluentUI/designer/images/checkbox-icon@2x.png
Normal file
After Width: | Height: | Size: 336 B |
BIN
src/imports/FluentUI/designer/images/combobox-icon.png
Normal file
After Width: | Height: | Size: 156 B |
BIN
src/imports/FluentUI/designer/images/combobox-icon16.png
Normal file
After Width: | Height: | Size: 155 B |
BIN
src/imports/FluentUI/designer/images/combobox-icon@2x.png
Normal file
After Width: | Height: | Size: 185 B |
BIN
src/imports/FluentUI/designer/images/control-icon.png
Normal file
After Width: | Height: | Size: 293 B |