Compare commits
30 Commits
Author | SHA1 | Date | |
---|---|---|---|
f2a66221e6 | |||
2de9d78f41 | |||
96355b0a97 | |||
47597471dd | |||
184f52c896 | |||
31b2b0b004 | |||
1e4f939de7 | |||
926132a285 | |||
9e245fb533 | |||
8bfbfd63fb | |||
51a206e583 | |||
ee3ddf7732 | |||
6d238871ee | |||
9d3de073c0 | |||
7282a6f8d1 | |||
2b9e9b2159 | |||
23bc5cdf68 | |||
f75da5e3ce | |||
8cc828a56b | |||
f36914fdee | |||
0cf3f2aa22 | |||
5bb8f27968 | |||
e6d2513482 | |||
5917d23286 | |||
eb1744d5f8 | |||
b1b727030c | |||
a71831cd9d | |||
bcc5d433a9 | |||
d835b7c23d | |||
0867043d7a |
19
README.md
@ -57,12 +57,17 @@
|
||||
|FluTooltip|tooltip提示框||
|
||||
|FluTreeView|树控件||
|
||||
|FluTheme|主题设置|支持主题颜色切换,夜间模式|
|
||||
|FluCarousel|轮播图组件|支持无限轮播|
|
||||
|FluTimePicker|时间选择器||
|
||||
|FluDatePicker|日期选择器||
|
||||
|FluMenu|菜单Popup||
|
||||
|FluNavigationView|响应式导航布局||
|
||||
|
||||
# 部分效果预览
|
||||
|
||||
## 主页
|
||||
## 各种Button按钮
|
||||
|
||||

|
||||

|
||||
|
||||
## 主题颜色切换、夜间模式
|
||||
|
||||
@ -72,10 +77,14 @@
|
||||
|
||||

|
||||
|
||||
## Toast组件
|
||||
## 轮播图组件
|
||||
|
||||

|
||||
|
||||
## InfoBar提示框组件
|
||||
|
||||

|
||||
|
||||
## Rectangle组件
|
||||
## 多窗口路由跳转
|
||||
|
||||

|
||||

|
BIN
doc/preview/buttons.png
Normal file
After Width: | Height: | Size: 103 KiB |
BIN
doc/preview/carousel.png
Normal file
After Width: | Height: | Size: 383 KiB |
Before Width: | Height: | Size: 128 KiB After Width: | Height: | Size: 89 KiB |
Before Width: | Height: | Size: 119 KiB |
BIN
doc/preview/multiwindow.png
Normal file
After Width: | Height: | Size: 103 KiB |
Before Width: | Height: | Size: 703 KiB |
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 73 KiB |
Before Width: | Height: | Size: 134 KiB After Width: | Height: | Size: 101 KiB |
@ -12,11 +12,9 @@ Window {
|
||||
FluApp.init(app,properties)
|
||||
FluTheme.isDark = false
|
||||
FluApp.routes = {
|
||||
"/":"qrc:/MainPage.qml",
|
||||
"/Setting":"qrc:/SettingPage.qml",
|
||||
"/About":"qrc:/AboutPage.qml",
|
||||
"/Installer":"qrc:/Installer.qml",
|
||||
"/Uninstall":"qrc:/Uninstall.qml"
|
||||
"/":"qrc:/page/MainPage.qml",
|
||||
"/about":"qrc:/page/AboutPage.qml",
|
||||
"/login":"qrc:/page/LoginPage.qml",
|
||||
}
|
||||
FluApp.initialRoute = "/"
|
||||
FluApp.run()
|
||||
|
@ -1,202 +0,0 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Window 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtGraphicalEffects 1.15
|
||||
|
||||
import FluentUI 1.0
|
||||
|
||||
FluWindow {
|
||||
id:rootwindow
|
||||
width: 800
|
||||
height: 600
|
||||
title: "FluentUI"
|
||||
minimumWidth: 600
|
||||
minimumHeight: 400
|
||||
|
||||
FluAppBar{
|
||||
id:appbar
|
||||
title: "FluentUI"
|
||||
showDark: true
|
||||
}
|
||||
|
||||
ListModel{
|
||||
id:nav_items
|
||||
ListElement{
|
||||
text:"Buttons"
|
||||
page:"qrc:/T_Buttons.qml"
|
||||
}
|
||||
ListElement{
|
||||
text:"TextBox"
|
||||
page:"qrc:/T_TextBox.qml"
|
||||
}
|
||||
ListElement{
|
||||
text:"ToggleSwitch"
|
||||
page:"qrc:/T_ToggleSwitch.qml"
|
||||
}
|
||||
ListElement{
|
||||
text:"Slider"
|
||||
page:"qrc:/T_Slider.qml"
|
||||
}
|
||||
ListElement{
|
||||
text:"InfoBar"
|
||||
page:"qrc:/T_InfoBar.qml"
|
||||
}
|
||||
ListElement{
|
||||
text:"Dialog"
|
||||
page:"qrc:/T_Dialog.qml"
|
||||
}
|
||||
ListElement{
|
||||
text:"Progress"
|
||||
page:"qrc:/T_Progress.qml"
|
||||
}
|
||||
ListElement{
|
||||
text:"Rectangle"
|
||||
page:"qrc:/T_Rectangle.qml"
|
||||
}
|
||||
ListElement{
|
||||
text:"Expander"
|
||||
page:"qrc:/T_Expander.qml"
|
||||
}
|
||||
ListElement{
|
||||
text:"TreeView"
|
||||
page:"qrc:/T_TreeView.qml"
|
||||
}
|
||||
ListElement{
|
||||
text:"Theme"
|
||||
page:"qrc:/T_Theme.qml"
|
||||
}
|
||||
ListElement{
|
||||
text:"Awesome"
|
||||
page:"qrc:/T_Awesome.qml"
|
||||
}
|
||||
ListElement{
|
||||
text:"Typography"
|
||||
page:"qrc:/T_Typography.qml"
|
||||
}
|
||||
}
|
||||
|
||||
FluIconButton{
|
||||
icon:FluentIcons.FA_navicon
|
||||
anchors{
|
||||
left: parent.left
|
||||
bottom: parent.bottom
|
||||
leftMargin: 12
|
||||
bottomMargin: 12
|
||||
}
|
||||
FluMenu{
|
||||
id:menu
|
||||
x:40
|
||||
margins:4
|
||||
FluMenuItem{
|
||||
text:"意见反馈"
|
||||
onClicked:{
|
||||
Qt.openUrlExternally("https://github.com/zhuzichu520/FluentUI/issues/new")
|
||||
}
|
||||
}
|
||||
FluMenuItem{
|
||||
text:"关于"
|
||||
onClicked:{
|
||||
FluApp.navigate("/About")
|
||||
}
|
||||
}
|
||||
}
|
||||
onClicked:{
|
||||
menu.open()
|
||||
}
|
||||
}
|
||||
|
||||
ListView{
|
||||
id:nav_list
|
||||
anchors{
|
||||
top: appbar.bottom
|
||||
bottom: parent.bottom
|
||||
topMargin: 20
|
||||
bottomMargin: 52
|
||||
}
|
||||
ScrollBar.vertical: ScrollBar { }
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
clip: true
|
||||
width: 160
|
||||
model: nav_items
|
||||
delegate: Item{
|
||||
height: 38
|
||||
width: nav_list.width
|
||||
|
||||
|
||||
Rectangle{
|
||||
radius: 4
|
||||
anchors{
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
topMargin: 2
|
||||
bottomMargin: 2
|
||||
leftMargin: 6
|
||||
rightMargin: 6
|
||||
}
|
||||
MouseArea{
|
||||
id:item_mouse
|
||||
hoverEnabled: true
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
nav_list.currentIndex = index
|
||||
}
|
||||
}
|
||||
color: {
|
||||
if(FluTheme.isDark){
|
||||
if(nav_list.currentIndex === index){
|
||||
return "#2D2D2D"
|
||||
}
|
||||
if(item_mouse.containsMouse){
|
||||
return "#292929"
|
||||
}
|
||||
return "#202020"
|
||||
}else{
|
||||
if(nav_list.currentIndex === index){
|
||||
return "#EAEAEA"
|
||||
}
|
||||
if(item_mouse.containsMouse){
|
||||
return "#EDEDED"
|
||||
}
|
||||
return "#F3f3f3"
|
||||
}
|
||||
}
|
||||
|
||||
FluText{
|
||||
text:model.text
|
||||
anchors.centerIn: parent
|
||||
fontStyle: FluText.Caption
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
color: FluTheme.isDark ? "#323232" : "#FFFFFF"
|
||||
radius: 10
|
||||
clip: true
|
||||
anchors{
|
||||
left: nav_list.right
|
||||
leftMargin: 2
|
||||
top: appbar.bottom
|
||||
topMargin: 20
|
||||
right: parent.right
|
||||
rightMargin: 10
|
||||
bottom: parent.bottom
|
||||
bottomMargin: 20
|
||||
}
|
||||
border.width: 1
|
||||
border.color: FluTheme.isDark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(238/255,238/255,238/255,1)
|
||||
|
||||
Loader{
|
||||
anchors.fill: parent
|
||||
anchors.margins:20
|
||||
source: nav_items.get(nav_list.currentIndex).page
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
import QtQuick 2.15
|
||||
import FluentUI 1.0
|
||||
|
||||
FluWindow {
|
||||
|
||||
width: 500
|
||||
height: 600
|
||||
title:"设置"
|
||||
|
||||
FluAppBar{
|
||||
id:appbar
|
||||
title:"设置"
|
||||
}
|
||||
|
||||
FluText{
|
||||
text:"设置"
|
||||
fontStyle: FluText.Display
|
||||
anchors.centerIn: parent
|
||||
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
FluApp.navigate("/About")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -4,20 +4,19 @@ import QtQuick.Layouts 1.15
|
||||
import QtQuick.Window 2.15
|
||||
import FluentUI 1.0
|
||||
|
||||
Item {
|
||||
FluText{
|
||||
id:title
|
||||
text:"Awesome"
|
||||
fontStyle: FluText.TitleLarge
|
||||
}
|
||||
FluContentPage {
|
||||
|
||||
title:"Awesome"
|
||||
|
||||
FluTextBox{
|
||||
id:text_box
|
||||
placeholderText: "请输入关键字"
|
||||
anchors{
|
||||
topMargin: 20
|
||||
top:title.bottom
|
||||
top:parent.top
|
||||
}
|
||||
}
|
||||
|
||||
FluFilledButton{
|
||||
text:"搜索"
|
||||
anchors{
|
||||
@ -31,8 +30,8 @@ Item {
|
||||
}
|
||||
GridView{
|
||||
id:grid_view
|
||||
cellWidth: 120
|
||||
cellHeight: 60
|
||||
cellWidth: 80
|
||||
cellHeight: 80
|
||||
clip: true
|
||||
model:FluApp.awesomelist()
|
||||
ScrollBar.vertical: FluScrollBar {}
|
||||
@ -44,11 +43,11 @@ Item {
|
||||
bottom: parent.bottom
|
||||
}
|
||||
delegate: Item {
|
||||
width: 120
|
||||
height: 60
|
||||
width: 68
|
||||
height: 80
|
||||
FluIconButton{
|
||||
id:item_icon
|
||||
icon:modelData.icon
|
||||
iconSource:modelData.icon
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
onClicked: {
|
||||
var text ="FluentIcons."+modelData.name;
|
||||
@ -58,10 +57,14 @@ Item {
|
||||
}
|
||||
FluText {
|
||||
id:item_name
|
||||
font.pixelSize: 10;
|
||||
font.pixelSize: 10
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: item_icon.bottom
|
||||
width:parent.width
|
||||
wrapMode: Text.WrapAnywhere
|
||||
text: modelData.name
|
||||
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,155 +2,236 @@
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtQuick.Window 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtGraphicalEffects 1.15
|
||||
import FluentUI 1.0
|
||||
|
||||
Item {
|
||||
width: parent.width
|
||||
FluScrollablePage{
|
||||
title:"Buttons"
|
||||
|
||||
spacing: 20
|
||||
|
||||
FluText{
|
||||
id:title
|
||||
text:"Buttons"
|
||||
fontStyle: FluText.TitleLarge
|
||||
Layout.topMargin: 20
|
||||
text:"支持Tab键切换焦点,空格键执行点击事件"
|
||||
}
|
||||
ScrollView{
|
||||
clip: true
|
||||
|
||||
FluArea{
|
||||
width: parent.width
|
||||
contentWidth: parent.width
|
||||
anchors{
|
||||
top: title.bottom
|
||||
bottom: parent.bottom
|
||||
height: 68
|
||||
paddings: 10
|
||||
|
||||
FluButton{
|
||||
disabled:button_switch.selected
|
||||
text:"Standard Button"
|
||||
onClicked: {
|
||||
showInfo("点击StandardButton")
|
||||
}
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
}
|
||||
}
|
||||
ColumnLayout{
|
||||
|
||||
Row{
|
||||
spacing: 5
|
||||
width: parent.width
|
||||
RowLayout{
|
||||
Layout.topMargin: 20
|
||||
width: parent.width
|
||||
FluButton{
|
||||
disabled:button_switch.checked
|
||||
onClicked: {
|
||||
showInfo("点击StandardButton")
|
||||
}
|
||||
}
|
||||
Item{
|
||||
height: 1
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
FluToggleSwitch{
|
||||
id:button_switch
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
FluText{
|
||||
text:"Disabled"
|
||||
}
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
right: parent.right
|
||||
}
|
||||
FluDivider{
|
||||
Layout.fillWidth: true ; height:1;
|
||||
FluToggleSwitch{
|
||||
id:button_switch
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
RowLayout{
|
||||
Layout.topMargin: 20
|
||||
width: parent.width
|
||||
FluFilledButton{
|
||||
disabled:filled_button_switch.checked
|
||||
onClicked:{
|
||||
showWarning("点击FilledButton")
|
||||
}
|
||||
}
|
||||
Item{
|
||||
height: 1
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
FluToggleSwitch{
|
||||
id:filled_button_switch
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
FluText{
|
||||
text:"Disabled"
|
||||
}
|
||||
}
|
||||
FluDivider{
|
||||
Layout.fillWidth: true ; height:1
|
||||
}
|
||||
RowLayout{
|
||||
Layout.topMargin: 20
|
||||
width: parent.width
|
||||
FluIconButton{
|
||||
icon:FluentIcons.FA_close
|
||||
disabled:icon_button_switch.checked
|
||||
onClicked:{
|
||||
showSuccess("点击IconButton")
|
||||
}
|
||||
}
|
||||
Item{
|
||||
height: 1
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
FluToggleSwitch{
|
||||
id:icon_button_switch
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
FluText{
|
||||
text:"Disabled"
|
||||
}
|
||||
}
|
||||
FluDivider{
|
||||
Layout.fillWidth: true ; height:1
|
||||
}
|
||||
RowLayout{
|
||||
Layout.topMargin: 20
|
||||
width: parent.width
|
||||
ColumnLayout{
|
||||
spacing: 8
|
||||
Repeater{
|
||||
id:repeater
|
||||
property int selecIndex : 0
|
||||
model: 3
|
||||
delegate: FluRadioButton{
|
||||
checked : repeater.selecIndex===index
|
||||
disabled:radio_button_switch.checked
|
||||
text:"RodioButton_"+index
|
||||
onClicked:{
|
||||
repeater.selecIndex = index
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Item{
|
||||
height: 1
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
FluToggleSwitch{
|
||||
id:radio_button_switch
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
FluText{
|
||||
text:"Disabled"
|
||||
}
|
||||
}
|
||||
FluDivider{
|
||||
Layout.fillWidth: true ; height:1
|
||||
}
|
||||
RowLayout{
|
||||
Layout.topMargin: 20
|
||||
width: parent.width
|
||||
FluCheckBox{
|
||||
disabled:icon_button_check.checked
|
||||
}
|
||||
Item{
|
||||
height: 1
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
FluToggleSwitch{
|
||||
id:icon_button_check
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
FluText{
|
||||
text:"Disabled"
|
||||
}
|
||||
}
|
||||
FluDivider{
|
||||
Layout.fillWidth: true ; height:1
|
||||
FluText{
|
||||
text:"Disabled"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FluArea{
|
||||
width: parent.width
|
||||
height: 68
|
||||
paddings: 10
|
||||
|
||||
FluFilledButton{
|
||||
disabled:filled_button_switch.selected
|
||||
text:"Filled Button"
|
||||
onClicked: {
|
||||
showWarning("点击FilledButton")
|
||||
}
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
}
|
||||
}
|
||||
|
||||
Row{
|
||||
spacing: 5
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
right: parent.right
|
||||
}
|
||||
FluToggleSwitch{
|
||||
id:filled_button_switch
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
FluText{
|
||||
text:"Disabled"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FluArea{
|
||||
width: parent.width
|
||||
height: 68
|
||||
paddings: 10
|
||||
|
||||
FluIconButton{
|
||||
iconSource:FluentIcons.ChromeCloseContrast
|
||||
disabled:icon_button_switch.selected
|
||||
iconSize: 15
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
}
|
||||
onClicked:{
|
||||
showSuccess("点击IconButton")
|
||||
}
|
||||
}
|
||||
|
||||
Row{
|
||||
spacing: 5
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
right: parent.right
|
||||
}
|
||||
FluToggleSwitch{
|
||||
id:icon_button_switch
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
FluText{
|
||||
text:"Disabled"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FluArea{
|
||||
width: parent.width
|
||||
height: 68
|
||||
paddings: 10
|
||||
|
||||
FluDropDownButton{
|
||||
disabled:drop_down_button_switch.selected
|
||||
text:"DropDownButton"
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
}
|
||||
items:[
|
||||
FluMenuItem{
|
||||
text:"Menu_1"
|
||||
},
|
||||
FluMenuItem{
|
||||
text:"Menu_2"
|
||||
},
|
||||
FluMenuItem{
|
||||
text:"Menu_3"
|
||||
},
|
||||
FluMenuItem{
|
||||
text:"Menu_4"
|
||||
}
|
||||
]
|
||||
}
|
||||
Row{
|
||||
spacing: 5
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
right: parent.right
|
||||
}
|
||||
FluToggleSwitch{
|
||||
id:drop_down_button_switch
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
FluText{
|
||||
text:"Disabled"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FluArea{
|
||||
width: parent.width
|
||||
height: 100
|
||||
paddings: 10
|
||||
|
||||
ColumnLayout{
|
||||
spacing: 8
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
}
|
||||
Repeater{
|
||||
id:repeater
|
||||
property int selecIndex : 0
|
||||
model: 3
|
||||
delegate: FluRadioButton{
|
||||
selected : repeater.selecIndex===index
|
||||
disabled:radio_button_switch.selected
|
||||
text:"Radio Button_"+index
|
||||
onClicked:{
|
||||
repeater.selecIndex = index
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Row{
|
||||
spacing: 5
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
right: parent.right
|
||||
}
|
||||
FluToggleSwitch{
|
||||
id:radio_button_switch
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
FluText{
|
||||
text:"Disabled"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FluArea{
|
||||
width: parent.width
|
||||
height: 68
|
||||
paddings: 10
|
||||
|
||||
FluCheckBox{
|
||||
disabled:check_box_switch.selected
|
||||
text:"Check Box"
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Row{
|
||||
spacing: 5
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
right: parent.right
|
||||
}
|
||||
FluToggleSwitch{
|
||||
id:check_box_switch
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
FluText{
|
||||
text:"Disabled"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
36
example/T_Carousel.qml
Normal file
@ -0,0 +1,36 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtQuick.Window 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtGraphicalEffects 1.15
|
||||
import FluentUI 1.0
|
||||
|
||||
FluScrollablePage{
|
||||
|
||||
title:"Carousel"
|
||||
|
||||
FluArea{
|
||||
width: parent.width
|
||||
height: 370
|
||||
paddings: 10
|
||||
Layout.topMargin: 20
|
||||
Column{
|
||||
spacing: 15
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left:parent.left
|
||||
}
|
||||
FluText{
|
||||
text:"轮播图,支持无限轮播,无限滑动,用ListView实现的组件"
|
||||
}
|
||||
FluCarousel{
|
||||
id:carousel
|
||||
Layout.topMargin: 20
|
||||
Layout.leftMargin: 5
|
||||
Component.onCompleted: {
|
||||
carousel.setData([{url:"qrc:/res/image/banner_1.jpg"},{url:"qrc:/res/image/banner_2.jpg"},{url:"qrc:/res/image/banner_3.jpg"}])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
61
example/T_DatePicker.qml
Normal file
@ -0,0 +1,61 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtQuick.Window 2.15
|
||||
import FluentUI 1.0
|
||||
|
||||
FluScrollablePage{
|
||||
|
||||
title:"TimePicker"
|
||||
|
||||
|
||||
FluArea{
|
||||
width: parent.width
|
||||
Layout.topMargin: 20
|
||||
height: 80
|
||||
paddings: 10
|
||||
|
||||
ColumnLayout{
|
||||
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
}
|
||||
|
||||
FluText{
|
||||
text:"showYear=true"
|
||||
}
|
||||
|
||||
FluDatePicker{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FluArea{
|
||||
width: parent.width
|
||||
Layout.topMargin: 20
|
||||
height: 80
|
||||
paddings: 10
|
||||
|
||||
ColumnLayout{
|
||||
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
}
|
||||
|
||||
FluText{
|
||||
text:"showYear=false"
|
||||
}
|
||||
|
||||
FluDatePicker{
|
||||
showYear:false
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -5,13 +5,8 @@ import QtQuick.Controls 2.15
|
||||
import QtGraphicalEffects 1.15
|
||||
import FluentUI 1.0
|
||||
|
||||
Item {
|
||||
|
||||
FluText{
|
||||
id:title
|
||||
text:"Dialog"
|
||||
fontStyle: FluText.TitleLarge
|
||||
}
|
||||
FluScrollablePage{
|
||||
title:"Dialog"
|
||||
|
||||
FluContentDialog{
|
||||
id:dialog
|
||||
@ -27,25 +22,11 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
ScrollView{
|
||||
clip: true
|
||||
width: parent.width
|
||||
contentWidth: parent.width
|
||||
anchors{
|
||||
top: title.bottom
|
||||
bottom: parent.bottom
|
||||
}
|
||||
ColumnLayout{
|
||||
spacing: 5
|
||||
FluButton{
|
||||
Layout.topMargin: 20
|
||||
text:"Show Dialog"
|
||||
onClicked: {
|
||||
dialog.open()
|
||||
}
|
||||
}
|
||||
FluButton{
|
||||
Layout.topMargin: 20
|
||||
text:"Show Dialog"
|
||||
onClicked: {
|
||||
dialog.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,72 +5,54 @@ import QtQuick.Window 2.15
|
||||
import QtGraphicalEffects 1.15
|
||||
import FluentUI 1.0
|
||||
|
||||
Item {
|
||||
FluText{
|
||||
id:title
|
||||
text:"Expander"
|
||||
fontStyle: FluText.TitleLarge
|
||||
}
|
||||
ScrollView{
|
||||
clip: true
|
||||
width: parent.width
|
||||
contentWidth: parent.width
|
||||
anchors{
|
||||
top: title.bottom
|
||||
bottom: parent.bottom
|
||||
}
|
||||
Column{
|
||||
spacing: 5
|
||||
Item{
|
||||
width: 1
|
||||
height: 20
|
||||
}
|
||||
FluExpander{
|
||||
headerText:"打开一个单选框"
|
||||
Item{
|
||||
anchors.fill: parent
|
||||
ColumnLayout{
|
||||
spacing: 8
|
||||
anchors{
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
topMargin: 15
|
||||
leftMargin: 15
|
||||
}
|
||||
Repeater{
|
||||
id:repeater
|
||||
property int selecIndex : 0
|
||||
model: 3
|
||||
delegate: FluRadioButton{
|
||||
checked : repeater.selecIndex===index
|
||||
text:"RodioButton_"+index
|
||||
onClicked:{
|
||||
repeater.selecIndex = index
|
||||
}
|
||||
}
|
||||
FluScrollablePage{
|
||||
title:"Expander"
|
||||
|
||||
FluExpander{
|
||||
headerText:"打开一个单选框"
|
||||
Layout.topMargin: 20
|
||||
Item{
|
||||
anchors.fill: parent
|
||||
ColumnLayout{
|
||||
spacing: 8
|
||||
anchors{
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
topMargin: 15
|
||||
leftMargin: 15
|
||||
}
|
||||
Repeater{
|
||||
id:repeater
|
||||
property int selecIndex : 0
|
||||
model: 3
|
||||
delegate: FluRadioButton{
|
||||
selected : repeater.selecIndex===index
|
||||
text:"Radio Button_"+index
|
||||
onClicked:{
|
||||
repeater.selecIndex = index
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FluExpander{
|
||||
Layout.topMargin: 20
|
||||
headerText:"打开一个滑动文本框"
|
||||
Item{
|
||||
anchors.fill: parent
|
||||
ScrollView{
|
||||
id:scrollview
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
contentWidth: parent.width
|
||||
FluText{
|
||||
id:test
|
||||
width: scrollview.width
|
||||
wrapMode: Text.WrapAnywhere
|
||||
padding: 14
|
||||
text:"先帝创业未半而中道崩殂,今天下三分,益州疲弊,此诚危急存亡之秋也。然侍卫之臣不懈于内,忠志之士忘身于外者,盖追先帝之殊遇,欲报之于陛下也。诚宜开张圣听,以光先帝遗德,恢弘志士之气,不宜妄自菲薄,引喻失义,以塞忠谏之路也。宫中府中,俱为一体;陟罚臧否,不宜异同。若有作奸犯科及为忠善者,宜付有司论其刑赏,以昭陛下平明之理,不宜偏私,使内外异法也。侍中、侍郎郭攸之、费祎、董允等,此皆良实,志虑忠纯,是以先帝简拔以遗陛下。愚以为宫中之事,事无大小,悉以咨之,然后施行,必能裨补阙漏,有所广益。将军向宠,性行淑均,晓畅军事,试用于昔日,先帝称之曰能,是以众议举宠为督。愚以为营中之事,悉以咨之,必能使行阵和睦,优劣得所。亲贤臣,远小人,此先汉所以兴隆也;亲小人,远贤臣,此后汉所以倾颓也。先帝在时,每与臣论此事,未尝不叹息痛恨于桓、灵也。侍中、尚书、长史、参军,此悉贞良死节之臣,愿陛下亲之信之,则汉室之隆,可计日而待也。臣本布衣,躬耕于南阳,苟全性命于乱世,不求闻达于诸侯。先帝不以臣卑鄙,猥自枉屈,三顾臣于草庐之中,咨臣以当世之事,由是感激,遂许先帝以驱驰。后值倾覆,受任于败军之际,奉命于危难之间,尔来二十有一年矣。先帝知臣谨慎,故临崩寄臣以大事也。受命以来,夙夜忧叹,恐托付不效,以伤先帝之明;故五月渡泸,深入不毛。今南方已定,兵甲已足,当奖率三军,北定中原,庶竭驽钝,攘除奸凶,兴复汉室,还于旧都。此臣所以报先帝而忠陛下之职分也。至于斟酌损益,进尽忠言,则攸之、祎、允之任也。愿陛下托臣以讨贼兴复之效,不效,则治臣之罪,以告先帝之灵。若无兴德之言,则责攸之、祎、允等之慢,以彰其咎;陛下亦宜自谋,以咨诹善道,察纳雅言,深追先帝遗诏。臣不胜受恩感激。今当远离,临表涕零,不知所言。"
|
||||
}
|
||||
}
|
||||
FluExpander{
|
||||
Layout.topMargin: 20
|
||||
headerText:"打开一个滑动文本框"
|
||||
Item{
|
||||
anchors.fill: parent
|
||||
ScrollView{
|
||||
id:scrollview
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
contentWidth: parent.width
|
||||
FluText{
|
||||
id:test
|
||||
width: scrollview.width
|
||||
wrapMode: Text.WrapAnywhere
|
||||
padding: 14
|
||||
text:"先帝创业未半而中道崩殂,今天下三分,益州疲弊,此诚危急存亡之秋也。然侍卫之臣不懈于内,忠志之士忘身于外者,盖追先帝之殊遇,欲报之于陛下也。诚宜开张圣听,以光先帝遗德,恢弘志士之气,不宜妄自菲薄,引喻失义,以塞忠谏之路也。宫中府中,俱为一体;陟罚臧否,不宜异同。若有作奸犯科及为忠善者,宜付有司论其刑赏,以昭陛下平明之理,不宜偏私,使内外异法也。侍中、侍郎郭攸之、费祎、董允等,此皆良实,志虑忠纯,是以先帝简拔以遗陛下。愚以为宫中之事,事无大小,悉以咨之,然后施行,必能裨补阙漏,有所广益。将军向宠,性行淑均,晓畅军事,试用于昔日,先帝称之曰能,是以众议举宠为督。愚以为营中之事,悉以咨之,必能使行阵和睦,优劣得所。亲贤臣,远小人,此先汉所以兴隆也;亲小人,远贤臣,此后汉所以倾颓也。先帝在时,每与臣论此事,未尝不叹息痛恨于桓、灵也。侍中、尚书、长史、参军,此悉贞良死节之臣,愿陛下亲之信之,则汉室之隆,可计日而待也。臣本布衣,躬耕于南阳,苟全性命于乱世,不求闻达于诸侯。先帝不以臣卑鄙,猥自枉屈,三顾臣于草庐之中,咨臣以当世之事,由是感激,遂许先帝以驱驰。后值倾覆,受任于败军之际,奉命于危难之间,尔来二十有一年矣。先帝知臣谨慎,故临崩寄臣以大事也。受命以来,夙夜忧叹,恐托付不效,以伤先帝之明;故五月渡泸,深入不毛。今南方已定,兵甲已足,当奖率三军,北定中原,庶竭驽钝,攘除奸凶,兴复汉室,还于旧都。此臣所以报先帝而忠陛下之职分也。至于斟酌损益,进尽忠言,则攸之、祎、允之任也。愿陛下托臣以讨贼兴复之效,不效,则治臣之罪,以告先帝之灵。若无兴德之言,则责攸之、祎、允等之慢,以彰其咎;陛下亦宜自谋,以咨诹善道,察纳雅言,深追先帝遗诏。臣不胜受恩感激。今当远离,临表涕零,不知所言。"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,51 +5,35 @@ import QtQuick.Controls 2.15
|
||||
import QtGraphicalEffects 1.15
|
||||
import FluentUI 1.0
|
||||
|
||||
Item {
|
||||
FluText{
|
||||
id:title
|
||||
text:"InfoBar"
|
||||
fontStyle: FluText.TitleLarge
|
||||
}
|
||||
ScrollView{
|
||||
clip: true
|
||||
width: parent.width
|
||||
contentWidth: parent.width
|
||||
anchors{
|
||||
top: title.bottom
|
||||
bottom: parent.bottom
|
||||
}
|
||||
ColumnLayout{
|
||||
spacing: 5
|
||||
FluScrollablePage{
|
||||
title:"InfoBar"
|
||||
|
||||
FluButton{
|
||||
text:"Info"
|
||||
Layout.topMargin: 20
|
||||
onClicked: {
|
||||
showInfo("这是一个Info样式的InfoBar")
|
||||
}
|
||||
}
|
||||
FluButton{
|
||||
text:"Warning"
|
||||
Layout.topMargin: 20
|
||||
onClicked: {
|
||||
showWarning("这是一个Warning样式的InfoBar")
|
||||
}
|
||||
}
|
||||
FluButton{
|
||||
text:"Error"
|
||||
Layout.topMargin: 20
|
||||
onClicked: {
|
||||
showError("这是一个Error样式的InfoBar")
|
||||
}
|
||||
}
|
||||
FluButton{
|
||||
text:"Success"
|
||||
Layout.topMargin: 20
|
||||
onClicked: {
|
||||
showSuccess("这是一个Success样式的InfoBar这是一个Success样式的InfoBar")
|
||||
}
|
||||
}
|
||||
FluButton{
|
||||
text:"Info"
|
||||
Layout.topMargin: 20
|
||||
onClicked: {
|
||||
showInfo("这是一个Info样式的InfoBar")
|
||||
}
|
||||
}
|
||||
FluButton{
|
||||
text:"Warning"
|
||||
Layout.topMargin: 20
|
||||
onClicked: {
|
||||
showWarning("这是一个Warning样式的InfoBar")
|
||||
}
|
||||
}
|
||||
FluButton{
|
||||
text:"Error"
|
||||
Layout.topMargin: 20
|
||||
onClicked: {
|
||||
showError("这是一个Error样式的InfoBar")
|
||||
}
|
||||
}
|
||||
FluButton{
|
||||
text:"Success"
|
||||
Layout.topMargin: 20
|
||||
onClicked: {
|
||||
showSuccess("这是一个Success样式的InfoBar这是一个Success样式的InfoBar")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
54
example/T_Menu.qml
Normal file
@ -0,0 +1,54 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtQuick.Window 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtGraphicalEffects 1.15
|
||||
import FluentUI 1.0
|
||||
|
||||
FluScrollablePage{
|
||||
|
||||
title:"Menu"
|
||||
|
||||
FluButton{
|
||||
text:"左击菜单"
|
||||
Layout.topMargin: 20
|
||||
Layout.leftMargin: 15
|
||||
onClicked:{
|
||||
menu.popup()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FluButton{
|
||||
text:"右击菜单"
|
||||
Layout.topMargin: 20
|
||||
Layout.leftMargin: 15
|
||||
onClicked: {
|
||||
showSuccess("请按鼠标右击")
|
||||
}
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.RightButton
|
||||
onClicked: {
|
||||
menu.popup()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FluMenu{
|
||||
id:menu
|
||||
FluMenuItem{
|
||||
text:"删除"
|
||||
onClicked: {
|
||||
showError("删除")
|
||||
}
|
||||
}
|
||||
FluMenuItem{
|
||||
text:"修改"
|
||||
onClicked: {
|
||||
showError("修改")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
77
example/T_MultiWindow.qml
Normal file
@ -0,0 +1,77 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtQuick.Window 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import FluentUI 1.0
|
||||
|
||||
FluScrollablePage{
|
||||
|
||||
title:"MultiWindow"
|
||||
|
||||
property string password: ""
|
||||
|
||||
property var loginPageRegister: registerForPageResult("/login")
|
||||
|
||||
Connections{
|
||||
target: loginPageRegister
|
||||
function onResult(data)
|
||||
{
|
||||
password = data.password
|
||||
}
|
||||
}
|
||||
|
||||
FluArea{
|
||||
width: parent.width
|
||||
height: 100
|
||||
paddings: 10
|
||||
Layout.topMargin: 20
|
||||
|
||||
Column{
|
||||
spacing: 15
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
}
|
||||
FluText{
|
||||
text:"页面跳转,不携带任何参数"
|
||||
}
|
||||
FluButton{
|
||||
text:"点击跳转"
|
||||
onClicked: {
|
||||
FluApp.navigate("/about")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FluArea{
|
||||
width: parent.width
|
||||
height: 130
|
||||
paddings: 10
|
||||
Layout.topMargin: 20
|
||||
|
||||
Column{
|
||||
spacing: 15
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
}
|
||||
FluText{
|
||||
text:"页面跳转,并携带参数用户名:zhuzichu"
|
||||
}
|
||||
FluButton{
|
||||
text:"点击跳转到登录"
|
||||
onClicked: {
|
||||
loginPageRegister.launch({username:"zhuzichu"})
|
||||
}
|
||||
}
|
||||
|
||||
FluText{
|
||||
text:"登录窗口返回过来的密码->"+password
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -5,47 +5,32 @@ import QtQuick.Controls 2.15
|
||||
import QtGraphicalEffects 1.15
|
||||
import FluentUI 1.0
|
||||
|
||||
Item {
|
||||
FluText{
|
||||
id:title
|
||||
text:"Progress"
|
||||
fontStyle: FluText.TitleLarge
|
||||
FluScrollablePage{
|
||||
title:"Progress"
|
||||
|
||||
FluProgressBar{
|
||||
Layout.topMargin: 20
|
||||
}
|
||||
ScrollView{
|
||||
clip: true
|
||||
width: parent.width
|
||||
contentWidth: parent.width
|
||||
anchors{
|
||||
top: title.bottom
|
||||
bottom: parent.bottom
|
||||
}
|
||||
ColumnLayout{
|
||||
spacing: 5
|
||||
FluProgressBar{
|
||||
Layout.topMargin: 20
|
||||
}
|
||||
FluProgressRing{
|
||||
Layout.topMargin: 10
|
||||
}
|
||||
FluProgressBar{
|
||||
id:progress_bar
|
||||
Layout.topMargin: 20
|
||||
indeterminate: false
|
||||
}
|
||||
FluProgressRing{
|
||||
id:progress_ring
|
||||
Layout.topMargin: 10
|
||||
indeterminate: false
|
||||
}
|
||||
FluSlider{
|
||||
Layout.topMargin: 30
|
||||
value:50
|
||||
onValueChanged:{
|
||||
progress_bar.progress = value/100
|
||||
progress_ring.progress = value/100
|
||||
}
|
||||
Layout.bottomMargin: 30
|
||||
}
|
||||
FluProgressRing{
|
||||
Layout.topMargin: 10
|
||||
}
|
||||
FluProgressBar{
|
||||
id:progress_bar
|
||||
Layout.topMargin: 20
|
||||
indeterminate: false
|
||||
}
|
||||
FluProgressRing{
|
||||
id:progress_ring
|
||||
Layout.topMargin: 10
|
||||
indeterminate: false
|
||||
}
|
||||
FluSlider{
|
||||
Layout.topMargin: 30
|
||||
value:50
|
||||
onValueChanged:{
|
||||
progress_bar.progress = value/100
|
||||
progress_ring.progress = value/100
|
||||
}
|
||||
Layout.bottomMargin: 30
|
||||
}
|
||||
}
|
||||
|
@ -5,127 +5,110 @@ import QtQuick.Window 2.15
|
||||
import QtGraphicalEffects 1.15
|
||||
import FluentUI 1.0
|
||||
|
||||
Item {
|
||||
FluText{
|
||||
id:title
|
||||
text:"Rectangle"
|
||||
fontStyle: FluText.TitleLarge
|
||||
FluScrollablePage{
|
||||
title:"Rectangle"
|
||||
|
||||
RowLayout{
|
||||
Layout.topMargin: 20
|
||||
FluRectangle{
|
||||
width: 50
|
||||
height: 50
|
||||
color:"#0078d4"
|
||||
radius:[0,0,0,0]
|
||||
}
|
||||
FluRectangle{
|
||||
width: 50
|
||||
height: 50
|
||||
color:"#744da9"
|
||||
radius:[15,15,15,15]
|
||||
}
|
||||
FluRectangle{
|
||||
width: 50
|
||||
height: 50
|
||||
color:"#ffeb3b"
|
||||
radius:[15,0,0,0]
|
||||
}
|
||||
FluRectangle{
|
||||
width: 50
|
||||
height: 50
|
||||
color:"#f7630c"
|
||||
radius:[0,15,0,0]
|
||||
}
|
||||
FluRectangle{
|
||||
width: 50
|
||||
height: 50
|
||||
color:"#e71123"
|
||||
radius:[0,0,15,0]
|
||||
}
|
||||
FluRectangle{
|
||||
width: 50
|
||||
height: 50
|
||||
color:"#b4009e"
|
||||
radius:[0,0,0,15]
|
||||
}
|
||||
}
|
||||
ScrollView{
|
||||
clip: true
|
||||
width: parent.width
|
||||
contentWidth: parent.width
|
||||
anchors{
|
||||
top: title.bottom
|
||||
bottom: parent.bottom
|
||||
}
|
||||
ColumnLayout{
|
||||
spacing: 5
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
RowLayout{
|
||||
Layout.topMargin: 20
|
||||
FluRectangle{
|
||||
width: 50
|
||||
height: 50
|
||||
color:"#0078d4"
|
||||
radius:[0,0,0,0]
|
||||
}
|
||||
FluRectangle{
|
||||
width: 50
|
||||
height: 50
|
||||
color:"#744da9"
|
||||
radius:[15,15,15,15]
|
||||
}
|
||||
FluRectangle{
|
||||
width: 50
|
||||
height: 50
|
||||
color:"#ffeb3b"
|
||||
radius:[15,0,0,0]
|
||||
}
|
||||
FluRectangle{
|
||||
width: 50
|
||||
height: 50
|
||||
color:"#f7630c"
|
||||
radius:[0,15,0,0]
|
||||
}
|
||||
FluRectangle{
|
||||
width: 50
|
||||
height: 50
|
||||
color:"#e71123"
|
||||
radius:[0,0,15,0]
|
||||
}
|
||||
FluRectangle{
|
||||
width: 50
|
||||
height: 50
|
||||
color:"#b4009e"
|
||||
radius:[0,0,0,15]
|
||||
}
|
||||
}
|
||||
FluText{
|
||||
text:"配合图片使用"
|
||||
fontStyle: FluText.Subtitle
|
||||
Layout.topMargin: 20
|
||||
}
|
||||
RowLayout{
|
||||
spacing: 14
|
||||
FluRectangle{
|
||||
width: 50
|
||||
height: 50
|
||||
radius:[25,0,25,25]
|
||||
Image {
|
||||
asynchronous: true
|
||||
anchors.fill: parent
|
||||
source: "qrc:/res/svg/avatar_1.svg"
|
||||
sourceSize: Qt.size(width,height)
|
||||
}
|
||||
}
|
||||
FluRectangle{
|
||||
width: 50
|
||||
height: 50
|
||||
radius:[10,10,10,10]
|
||||
Image {
|
||||
asynchronous: true
|
||||
anchors.fill: parent
|
||||
sourceSize: Qt.size(width,height)
|
||||
source: "qrc:/res/svg/avatar_2.svg"
|
||||
}
|
||||
}
|
||||
FluRectangle{
|
||||
width: 50
|
||||
height: 50
|
||||
radius:[25,25,25,25]
|
||||
Image {
|
||||
asynchronous: true
|
||||
anchors.fill: parent
|
||||
sourceSize: Qt.size(width,height)
|
||||
source: "qrc:/res/svg/avatar_3.svg"
|
||||
}
|
||||
}
|
||||
FluRectangle{
|
||||
width: 50
|
||||
height: 50
|
||||
radius:[0,25,25,25]
|
||||
Image {
|
||||
asynchronous: true
|
||||
anchors.fill: parent
|
||||
sourceSize: Qt.size(width,height)
|
||||
source: "qrc:/res/svg/avatar_4.svg"
|
||||
}
|
||||
}
|
||||
}
|
||||
FluRectangle{
|
||||
width: 1080/5
|
||||
height: 1439/5
|
||||
radius:[25,25,25,25]
|
||||
Image {
|
||||
asynchronous: true
|
||||
source: "qrc:/res/image/image_huoyin.webp"
|
||||
anchors.fill: parent
|
||||
sourceSize: Qt.size(width,height)
|
||||
}
|
||||
Layout.topMargin: 10
|
||||
FluText{
|
||||
text:"配合图片使用"
|
||||
fontStyle: FluText.Subtitle
|
||||
Layout.topMargin: 20
|
||||
}
|
||||
RowLayout{
|
||||
spacing: 14
|
||||
FluRectangle{
|
||||
width: 50
|
||||
height: 50
|
||||
radius:[25,0,25,25]
|
||||
Image {
|
||||
asynchronous: true
|
||||
anchors.fill: parent
|
||||
source: "qrc:/res/svg/avatar_1.svg"
|
||||
sourceSize: Qt.size(width,height)
|
||||
}
|
||||
}
|
||||
FluRectangle{
|
||||
width: 50
|
||||
height: 50
|
||||
radius:[10,10,10,10]
|
||||
Image {
|
||||
asynchronous: true
|
||||
anchors.fill: parent
|
||||
sourceSize: Qt.size(width,height)
|
||||
source: "qrc:/res/svg/avatar_2.svg"
|
||||
}
|
||||
}
|
||||
FluRectangle{
|
||||
width: 50
|
||||
height: 50
|
||||
radius:[25,25,25,25]
|
||||
Image {
|
||||
asynchronous: true
|
||||
anchors.fill: parent
|
||||
sourceSize: Qt.size(width,height)
|
||||
source: "qrc:/res/svg/avatar_3.svg"
|
||||
}
|
||||
}
|
||||
FluRectangle{
|
||||
width: 50
|
||||
height: 50
|
||||
radius:[0,25,25,25]
|
||||
Image {
|
||||
asynchronous: true
|
||||
anchors.fill: parent
|
||||
sourceSize: Qt.size(width,height)
|
||||
source: "qrc:/res/svg/avatar_4.svg"
|
||||
}
|
||||
}
|
||||
}
|
||||
FluRectangle{
|
||||
width: 1080/5
|
||||
height: 1439/5
|
||||
radius:[25,25,25,25]
|
||||
Image {
|
||||
asynchronous: true
|
||||
source: "qrc:/res/image/image_huoyin.webp"
|
||||
anchors.fill: parent
|
||||
sourceSize: Qt.size(width,height)
|
||||
}
|
||||
Layout.topMargin: 10
|
||||
}
|
||||
}
|
||||
|
@ -5,33 +5,19 @@ import QtQuick.Controls 2.15
|
||||
import QtGraphicalEffects 1.15
|
||||
import FluentUI 1.0
|
||||
|
||||
Item {
|
||||
FluText{
|
||||
id:title
|
||||
text:"Slider"
|
||||
fontStyle: FluText.TitleLarge
|
||||
FluScrollablePage{
|
||||
|
||||
title:"Slider"
|
||||
|
||||
FluSlider{
|
||||
Layout.topMargin: 20
|
||||
Layout.leftMargin: 15
|
||||
value: 50
|
||||
}
|
||||
ScrollView{
|
||||
clip: true
|
||||
width: parent.width
|
||||
contentWidth: parent.width
|
||||
anchors{
|
||||
top: title.bottom
|
||||
bottom: parent.bottom
|
||||
}
|
||||
ColumnLayout{
|
||||
spacing: 5
|
||||
FluSlider{
|
||||
Layout.topMargin: 20
|
||||
Layout.leftMargin: 15
|
||||
value: 50
|
||||
}
|
||||
FluSlider{
|
||||
orientation:FluSlider.Vertical
|
||||
Layout.topMargin: 20
|
||||
Layout.leftMargin: 15
|
||||
value: 50
|
||||
}
|
||||
}
|
||||
FluSlider{
|
||||
orientation:FluSlider.Vertical
|
||||
Layout.topMargin: 20
|
||||
Layout.leftMargin: 15
|
||||
value: 50
|
||||
}
|
||||
}
|
||||
|
@ -5,58 +5,44 @@ import QtQuick.Window 2.15
|
||||
import QtGraphicalEffects 1.15
|
||||
import FluentUI 1.0
|
||||
|
||||
Item {
|
||||
FluText{
|
||||
id:title
|
||||
text:"TextBox"
|
||||
fontStyle: FluText.TitleLarge
|
||||
FluScrollablePage{
|
||||
|
||||
title:"TextBox"
|
||||
|
||||
FluTextBox{
|
||||
Layout.topMargin: 20
|
||||
placeholderText: "单行输入框"
|
||||
Layout.preferredWidth: 300
|
||||
}
|
||||
ScrollView{
|
||||
clip: true
|
||||
width: parent.width
|
||||
contentWidth: parent.width
|
||||
anchors{
|
||||
top: title.bottom
|
||||
bottom: parent.bottom
|
||||
}
|
||||
ColumnLayout{
|
||||
spacing: 5
|
||||
FluTextBox{
|
||||
Layout.topMargin: 20
|
||||
placeholderText: "单行输入框"
|
||||
Layout.preferredWidth: 300
|
||||
}
|
||||
FluMultiLineTextBox{
|
||||
Layout.topMargin: 20
|
||||
Layout.preferredWidth: 300
|
||||
placeholderText: "多行输入框"
|
||||
}
|
||||
FluAutoSuggestBox{
|
||||
Layout.topMargin: 20
|
||||
values:generateRandomNames(100)
|
||||
placeholderText: "AutoSuggestBox"
|
||||
Layout.preferredWidth: 300
|
||||
}
|
||||
}
|
||||
FluMultiLineTextBox{
|
||||
Layout.topMargin: 20
|
||||
Layout.preferredWidth: 300
|
||||
placeholderText: "多行输入框"
|
||||
}
|
||||
FluAutoSuggestBox{
|
||||
Layout.topMargin: 20
|
||||
values:generateRandomNames(100)
|
||||
placeholderText: "AutoSuggestBox"
|
||||
Layout.preferredWidth: 300
|
||||
}
|
||||
|
||||
function generateRandomNames(numNames) {
|
||||
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
const names = [];
|
||||
function generateRandomName() {
|
||||
const nameLength = Math.floor(Math.random() * 5) + 4;
|
||||
let name = '';
|
||||
for (let i = 0; i < nameLength; i++) {
|
||||
const letterIndex = Math.floor(Math.random() * 26);
|
||||
name += alphabet.charAt(letterIndex);
|
||||
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
const names = [];
|
||||
function generateRandomName() {
|
||||
const nameLength = Math.floor(Math.random() * 5) + 4;
|
||||
let name = '';
|
||||
for (let i = 0; i < nameLength; i++) {
|
||||
const letterIndex = Math.floor(Math.random() * 26);
|
||||
name += alphabet.charAt(letterIndex);
|
||||
}
|
||||
return name;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
for (let i = 0; i < numNames; i++) {
|
||||
const name = generateRandomName();
|
||||
names.push(name);
|
||||
}
|
||||
return names;
|
||||
for (let i = 0; i < numNames; i++) {
|
||||
const name = generateRandomName();
|
||||
names.push(name);
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
|
||||
|
@ -5,71 +5,65 @@ import QtQuick.Controls 2.15
|
||||
import QtGraphicalEffects 1.15
|
||||
import FluentUI 1.0
|
||||
|
||||
Item {
|
||||
FluText{
|
||||
id:title
|
||||
text:"Theme"
|
||||
fontStyle: FluText.TitleLarge
|
||||
}
|
||||
ScrollView{
|
||||
clip: true
|
||||
width: parent.width
|
||||
contentWidth: parent.width
|
||||
anchors{
|
||||
top: title.bottom
|
||||
bottom: parent.bottom
|
||||
}
|
||||
ColumnLayout{
|
||||
spacing: 5
|
||||
RowLayout{
|
||||
Layout.topMargin: 20
|
||||
Repeater{
|
||||
model: [FluColors.Yellow,FluColors.Orange,FluColors.Red,FluColors.Magenta,FluColors.Purple,FluColors.Blue,FluColors.Teal,FluColors.Green]
|
||||
delegate: Rectangle{
|
||||
width: 42
|
||||
height: 42
|
||||
radius: 4
|
||||
color: mouse_item.containsMouse ? Qt.lighter(modelData.normal,1.1) : modelData.normal
|
||||
FluIcon {
|
||||
anchors.centerIn: parent
|
||||
icon: FluentIcons.FA_check
|
||||
iconSize: 15
|
||||
visible: modelData === FluTheme.primaryColor
|
||||
color: FluTheme.isDark ? Qt.rgba(0,0,0,1) : Qt.rgba(1,1,1,1)
|
||||
}
|
||||
MouseArea{
|
||||
id:mouse_item
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
FluTheme.primaryColor = modelData
|
||||
}
|
||||
}
|
||||
FluScrollablePage{
|
||||
|
||||
title:"Theme"
|
||||
|
||||
RowLayout{
|
||||
Layout.topMargin: 20
|
||||
Repeater{
|
||||
model: [FluColors.Yellow,FluColors.Orange,FluColors.Red,FluColors.Magenta,FluColors.Purple,FluColors.Blue,FluColors.Teal,FluColors.Green]
|
||||
delegate: Rectangle{
|
||||
width: 42
|
||||
height: 42
|
||||
radius: 4
|
||||
color: mouse_item.containsMouse ? Qt.lighter(modelData.normal,1.1) : modelData.normal
|
||||
FluIcon {
|
||||
anchors.centerIn: parent
|
||||
iconSource: FluentIcons.AcceptMedium
|
||||
iconSize: 15
|
||||
visible: modelData === FluTheme.primaryColor
|
||||
color: FluTheme.isDark ? Qt.rgba(0,0,0,1) : Qt.rgba(1,1,1,1)
|
||||
}
|
||||
MouseArea{
|
||||
id:mouse_item
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
FluTheme.primaryColor = modelData
|
||||
}
|
||||
}
|
||||
}
|
||||
FluText{
|
||||
text:"夜间模式"
|
||||
fontStyle: FluText.Subtitle
|
||||
Layout.topMargin: 20
|
||||
}
|
||||
FluToggleSwitch{
|
||||
checked: FluTheme.isDark
|
||||
onClickFunc:function(){
|
||||
FluTheme.isDark = !FluTheme.isDark
|
||||
}
|
||||
}
|
||||
FluText{
|
||||
text:"无边框"
|
||||
fontStyle: FluText.Subtitle
|
||||
Layout.topMargin: 20
|
||||
}
|
||||
FluToggleSwitch{
|
||||
checked: FluTheme.isFrameless
|
||||
onClickFunc:function(){
|
||||
FluTheme.isFrameless = !FluTheme.isFrameless
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
FluText{
|
||||
text:"夜间模式"
|
||||
Layout.topMargin: 20
|
||||
}
|
||||
FluToggleSwitch{
|
||||
selected: FluTheme.isDark
|
||||
clickFunc:function(){
|
||||
FluTheme.isDark = !FluTheme.isDark
|
||||
}
|
||||
}
|
||||
FluText{
|
||||
text:"无边框"
|
||||
Layout.topMargin: 20
|
||||
}
|
||||
FluToggleSwitch{
|
||||
selected: FluTheme.isFrameless
|
||||
clickFunc:function(){
|
||||
FluTheme.isFrameless = !FluTheme.isFrameless
|
||||
}
|
||||
}
|
||||
FluText{
|
||||
text:"native文本渲染"
|
||||
Layout.topMargin: 20
|
||||
}
|
||||
FluToggleSwitch{
|
||||
selected: FluTheme.isNativeText
|
||||
clickFunc:function(){
|
||||
FluTheme.isNativeText = !FluTheme.isNativeText
|
||||
}
|
||||
}
|
||||
}
|
||||
|
61
example/T_TimePicker.qml
Normal file
@ -0,0 +1,61 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtQuick.Window 2.15
|
||||
import FluentUI 1.0
|
||||
|
||||
FluScrollablePage{
|
||||
|
||||
title:"TimePicker"
|
||||
|
||||
|
||||
FluArea{
|
||||
width: parent.width
|
||||
Layout.topMargin: 20
|
||||
height: 80
|
||||
paddings: 10
|
||||
|
||||
ColumnLayout{
|
||||
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
}
|
||||
|
||||
FluText{
|
||||
text:"hourFormat=FluTimePicker.H"
|
||||
}
|
||||
|
||||
FluTimePicker{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FluArea{
|
||||
width: parent.width
|
||||
Layout.topMargin: 20
|
||||
height: 80
|
||||
paddings: 10
|
||||
|
||||
ColumnLayout{
|
||||
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
}
|
||||
|
||||
FluText{
|
||||
text:"hourFormat=FluTimePicker.HH"
|
||||
}
|
||||
|
||||
FluTimePicker{
|
||||
hourFormat:FluTimePicker.HH
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -5,26 +5,11 @@ import QtQuick.Controls 2.15
|
||||
import QtGraphicalEffects 1.15
|
||||
import FluentUI 1.0
|
||||
|
||||
Item {
|
||||
FluText{
|
||||
id:title
|
||||
text:"ToggleSwitch"
|
||||
fontStyle: FluText.TitleLarge
|
||||
}
|
||||
ScrollView{
|
||||
clip: true
|
||||
width: parent.width
|
||||
contentWidth: parent.width
|
||||
anchors{
|
||||
top: title.bottom
|
||||
bottom: parent.bottom
|
||||
}
|
||||
ColumnLayout{
|
||||
spacing: 5
|
||||
FluToggleSwitch{
|
||||
Layout.topMargin: 20
|
||||
}
|
||||
}
|
||||
FluScrollablePage{
|
||||
|
||||
title:"ToggleSwitch"
|
||||
|
||||
FluToggleSwitch{
|
||||
Layout.topMargin: 20
|
||||
}
|
||||
}
|
||||
|
@ -2,15 +2,11 @@
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtQuick.Window 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtGraphicalEffects 1.15
|
||||
import FluentUI 1.0
|
||||
|
||||
Item {
|
||||
FluText{
|
||||
id:title
|
||||
text:"TreeView"
|
||||
fontStyle: FluText.TitleLarge
|
||||
}
|
||||
FluContentPage {
|
||||
|
||||
title:"TreeView"
|
||||
|
||||
function randomName() {
|
||||
var names = ["张三", "李四", "王五", "赵六", "钱七", "孙八", "周九", "吴十"]
|
||||
@ -56,7 +52,7 @@ Item {
|
||||
id:tree_view
|
||||
width:240
|
||||
anchors{
|
||||
top:title.bottom
|
||||
top:parent.top
|
||||
left:parent.left
|
||||
bottom:parent.bottom
|
||||
}
|
||||
|
@ -3,55 +3,82 @@ import QtQuick.Layouts 1.15
|
||||
import QtQuick.Controls 2.15
|
||||
import FluentUI 1.0
|
||||
|
||||
Item {
|
||||
FluText{
|
||||
id:title
|
||||
text:"Typography"
|
||||
fontStyle: FluText.TitleLarge
|
||||
}
|
||||
FluContentPage {
|
||||
|
||||
title: "Typography"
|
||||
property int textSize: 13
|
||||
|
||||
ScrollView{
|
||||
clip: true
|
||||
width: parent.width
|
||||
contentWidth: parent.width
|
||||
anchors{
|
||||
top: title.bottom
|
||||
bottom: parent.bottom
|
||||
}
|
||||
ColumnLayout{
|
||||
spacing: 5
|
||||
spacing: 0
|
||||
FluText{
|
||||
text:"Display"
|
||||
Layout.topMargin: 20
|
||||
padding: 0
|
||||
pixelSize: textSize
|
||||
fontStyle: FluText.Display
|
||||
}
|
||||
FluText{
|
||||
text:"Title Large"
|
||||
padding: 0
|
||||
pixelSize: textSize
|
||||
fontStyle: FluText.TitleLarge
|
||||
}
|
||||
FluText{
|
||||
text:"Title"
|
||||
padding: 0
|
||||
pixelSize: textSize
|
||||
fontStyle: FluText.Title
|
||||
}
|
||||
FluText{
|
||||
text:"Subtitle"
|
||||
padding: 0
|
||||
pixelSize: textSize
|
||||
fontStyle: FluText.Subtitle
|
||||
}
|
||||
FluText{
|
||||
text:"Body Large"
|
||||
padding: 0
|
||||
pixelSize: textSize
|
||||
fontStyle: FluText.BodyLarge
|
||||
}
|
||||
FluText{
|
||||
text:"Body Strong"
|
||||
padding: 0
|
||||
pixelSize: textSize
|
||||
fontStyle: FluText.BodyStrong
|
||||
}
|
||||
FluText{
|
||||
text:"Body"
|
||||
padding: 0
|
||||
pixelSize: textSize
|
||||
fontStyle: FluText.Body
|
||||
}
|
||||
FluText{
|
||||
text:"Caption"
|
||||
padding: 0
|
||||
pixelSize: textSize
|
||||
fontStyle: FluText.Caption
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FluSlider{
|
||||
orientation:FluSlider.Vertical
|
||||
anchors{
|
||||
right: parent.right
|
||||
rightMargin: 30
|
||||
top: parent.top
|
||||
topMargin: 30
|
||||
}
|
||||
onValueChanged:{
|
||||
textSize = value/100*16+8
|
||||
}
|
||||
value: 31
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -8,6 +8,8 @@ SOURCES += \
|
||||
|
||||
RESOURCES += qml.qrc
|
||||
|
||||
RC_ICONS = favicon.ico
|
||||
|
||||
#qnx: target.path = /tmp/$${TARGET}/bin
|
||||
#else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||
#!isEmpty(target.path): INSTALLS += target
|
||||
|
BIN
example/favicon.ico
Normal file
After Width: | Height: | Size: 272 KiB |
@ -34,7 +34,7 @@ FluWindow {
|
||||
fontStyle: FluText.Title
|
||||
}
|
||||
FluText{
|
||||
text:"v1.0.2"
|
||||
text:"v1.0.9"
|
||||
fontStyle: FluText.Body
|
||||
Layout.alignment: Qt.AlignBottom
|
||||
}
|
||||
@ -70,6 +70,28 @@ FluWindow {
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout{
|
||||
spacing: 14
|
||||
Layout.topMargin: 20
|
||||
Layout.leftMargin: 15
|
||||
FluText{
|
||||
id:text_info
|
||||
text:"如果该项目对你有作用,就请点击上方链接给一个免费的star吧!"
|
||||
ColorAnimation {
|
||||
id: animation
|
||||
target: text_info
|
||||
property: "color"
|
||||
from: "red"
|
||||
to: "blue"
|
||||
duration: 1000
|
||||
running: true
|
||||
loops: Animation.Infinite
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
72
example/page/LoginPage.qml
Normal file
@ -0,0 +1,72 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import FluentUI 1.0
|
||||
|
||||
FluWindow {
|
||||
|
||||
id:window
|
||||
width: 400
|
||||
height: 400
|
||||
minimumWidth: 400
|
||||
minimumHeight: 400
|
||||
maximumWidth: 400
|
||||
maximumHeight: 400
|
||||
modality:2
|
||||
|
||||
title:"登录"
|
||||
|
||||
onInitArgument:
|
||||
(argument)=>{
|
||||
textbox_uesrname.text = argument.username
|
||||
textbox_password.focus = true
|
||||
}
|
||||
|
||||
FluAppBar{
|
||||
id:appbar
|
||||
title:"登录"
|
||||
}
|
||||
|
||||
ColumnLayout{
|
||||
anchors{
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
|
||||
FluAutoSuggestBox{
|
||||
id:textbox_uesrname
|
||||
values:["Admin","User"]
|
||||
placeholderText: "请输入账号"
|
||||
Layout.preferredWidth: 260
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
}
|
||||
|
||||
FluTextBox{
|
||||
id:textbox_password
|
||||
Layout.topMargin: 20
|
||||
Layout.preferredWidth: 260
|
||||
placeholderText: "请输入密码"
|
||||
echoMode:TextInput.Password
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
}
|
||||
|
||||
FluFilledButton{
|
||||
text:"登录"
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
Layout.topMargin: 20
|
||||
onClicked:{
|
||||
if(textbox_password.text === ""){
|
||||
showError("请随便输入一个密码")
|
||||
return
|
||||
}
|
||||
onResult({password:textbox_password.text})
|
||||
window.close()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
216
example/page/MainPage.qml
Normal file
@ -0,0 +1,216 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Window 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtGraphicalEffects 1.15
|
||||
|
||||
import FluentUI 1.0
|
||||
|
||||
FluWindow {
|
||||
id:rootwindow
|
||||
width: 860
|
||||
height: 600
|
||||
title: "FluentUI"
|
||||
minimumWidth: 500
|
||||
minimumHeight: 400
|
||||
|
||||
FluAppBar{
|
||||
id:appbar
|
||||
title: "FluentUI"
|
||||
}
|
||||
|
||||
FluObject{
|
||||
id:original_items
|
||||
|
||||
FluPaneItemHeader{
|
||||
title:"Inputs"
|
||||
}
|
||||
|
||||
FluPaneItem{
|
||||
title:"Buttons"
|
||||
onTap:{
|
||||
nav_view.push("qrc:/T_Buttons.qml")
|
||||
}
|
||||
}
|
||||
|
||||
FluPaneItem{
|
||||
title:"Slider"
|
||||
onTap:{
|
||||
nav_view.push("qrc:/T_Slider.qml")
|
||||
}
|
||||
}
|
||||
|
||||
FluPaneItem{
|
||||
title:"ToggleSwitch"
|
||||
onTap:{
|
||||
nav_view.push("qrc:/T_ToggleSwitch.qml")
|
||||
}
|
||||
}
|
||||
|
||||
FluPaneItemHeader{
|
||||
title:"Form"
|
||||
}
|
||||
|
||||
FluPaneItem{
|
||||
title:"TextBox"
|
||||
onTap:{
|
||||
nav_view.push("qrc:/T_TextBox.qml")
|
||||
}
|
||||
}
|
||||
|
||||
FluPaneItem{
|
||||
title:"TimePicker"
|
||||
onTap:{
|
||||
nav_view.push("qrc:/T_TimePicker.qml")
|
||||
}
|
||||
}
|
||||
|
||||
FluPaneItem{
|
||||
title:"DatePicker"
|
||||
onTap:{
|
||||
nav_view.push("qrc:/T_DatePicker.qml")
|
||||
}
|
||||
}
|
||||
|
||||
FluPaneItemHeader{
|
||||
title:"Surface"
|
||||
}
|
||||
|
||||
FluPaneItem{
|
||||
title:"InfoBar"
|
||||
onTap:{
|
||||
nav_view.push("qrc:/T_InfoBar.qml")
|
||||
}
|
||||
}
|
||||
|
||||
FluPaneItem{
|
||||
title:"Progress"
|
||||
onTap:{
|
||||
nav_view.push("qrc:/T_Progress.qml")
|
||||
}
|
||||
}
|
||||
|
||||
FluPaneItem{
|
||||
title:"Rectangle"
|
||||
onTap:{
|
||||
nav_view.push("qrc:/T_Rectangle.qml")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FluPaneItem{
|
||||
title:"Carousel"
|
||||
onTap:{
|
||||
nav_view.push("qrc:/T_Carousel.qml")
|
||||
}
|
||||
}
|
||||
|
||||
FluPaneItem{
|
||||
title:"Expander"
|
||||
onTap:{
|
||||
nav_view.push("qrc:/T_Expander.qml")
|
||||
}
|
||||
}
|
||||
|
||||
FluPaneItemHeader{
|
||||
title:"Popus"
|
||||
}
|
||||
|
||||
FluPaneItem{
|
||||
title:"Dialog"
|
||||
onTap:{
|
||||
nav_view.push("qrc:/T_Dialog.qml")
|
||||
}
|
||||
}
|
||||
|
||||
FluPaneItem{
|
||||
title:"Menu"
|
||||
onTap:{
|
||||
nav_view.push("qrc:/T_Menu.qml")
|
||||
}
|
||||
}
|
||||
|
||||
FluPaneItemHeader{
|
||||
title:"Navigation"
|
||||
}
|
||||
|
||||
FluPaneItem{
|
||||
title:"TreeView"
|
||||
onTap:{
|
||||
nav_view.push("qrc:/T_TreeView.qml")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FluPaneItem{
|
||||
title:"MultiWindow"
|
||||
onTap:{
|
||||
nav_view.push("qrc:/T_MultiWindow.qml")
|
||||
}
|
||||
}
|
||||
|
||||
FluPaneItemHeader{
|
||||
title:"Theming"
|
||||
}
|
||||
|
||||
FluPaneItem{
|
||||
title:"Theme"
|
||||
onTap:{
|
||||
nav_view.push("qrc:/T_Theme.qml")
|
||||
}
|
||||
}
|
||||
|
||||
FluPaneItem{
|
||||
title:"Awesome"
|
||||
onTap:{
|
||||
nav_view.push("qrc:/T_Awesome.qml")
|
||||
}
|
||||
}
|
||||
FluPaneItem{
|
||||
title:"Typography"
|
||||
onTap:{
|
||||
nav_view.push("qrc:/T_Typography.qml")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
FluObject{
|
||||
id:footer_items
|
||||
FluPaneItemSeparator{}
|
||||
FluPaneItem{
|
||||
title:"意见反馈"
|
||||
onTap:{
|
||||
Qt.openUrlExternally("https://github.com/zhuzichu520/FluentUI/issues/new")
|
||||
}
|
||||
}
|
||||
FluPaneItem{
|
||||
title:"关于"
|
||||
onTap:{
|
||||
FluApp.navigate("/about")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FluNavigationView{
|
||||
id:nav_view
|
||||
anchors{
|
||||
top: appbar.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
}
|
||||
items:original_items
|
||||
footerItems:footer_items
|
||||
|
||||
Component.onCompleted: {
|
||||
nav_view.setCurrentIndex(1)
|
||||
nav_view.push("qrc:/T_Buttons.qml")
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,16 +1,6 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>T_ToggleSwitch.qml</file>
|
||||
<file>T_Typography.qml</file>
|
||||
<file>App.qml</file>
|
||||
<file>MainPage.qml</file>
|
||||
<file>SettingPage.qml</file>
|
||||
<file>AboutPage.qml</file>
|
||||
<file>T_Buttons.qml</file>
|
||||
<file>T_Rectangle.qml</file>
|
||||
<file>T_InfoBar.qml</file>
|
||||
<file>T_Progress.qml</file>
|
||||
<file>T_Slider.qml</file>
|
||||
<file>res/image/image_huoyin.webp</file>
|
||||
<file>res/svg/avatar_1.svg</file>
|
||||
<file>res/svg/avatar_2.svg</file>
|
||||
@ -24,11 +14,29 @@
|
||||
<file>res/svg/avatar_10.svg</file>
|
||||
<file>res/svg/avatar_11.svg</file>
|
||||
<file>res/svg/avatar_12.svg</file>
|
||||
<file>page/AboutPage.qml</file>
|
||||
<file>page/MainPage.qml</file>
|
||||
<file>page/LoginPage.qml</file>
|
||||
<file>T_ToggleSwitch.qml</file>
|
||||
<file>T_Typography.qml</file>
|
||||
<file>T_Awesome.qml</file>
|
||||
<file>T_Buttons.qml</file>
|
||||
<file>T_Rectangle.qml</file>
|
||||
<file>T_InfoBar.qml</file>
|
||||
<file>T_Progress.qml</file>
|
||||
<file>T_Slider.qml</file>
|
||||
<file>T_TextBox.qml</file>
|
||||
<file>T_Theme.qml</file>
|
||||
<file>T_Dialog.qml</file>
|
||||
<file>T_TreeView.qml</file>
|
||||
<file>T_Expander.qml</file>
|
||||
<file>T_TimePicker.qml</file>
|
||||
<file>T_DatePicker.qml</file>
|
||||
<file>T_MultiWindow.qml</file>
|
||||
<file>T_Menu.qml</file>
|
||||
<file>T_Carousel.qml</file>
|
||||
<file>res/image/banner_1.jpg</file>
|
||||
<file>res/image/banner_2.jpg</file>
|
||||
<file>res/image/banner_3.jpg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
BIN
example/res/image/banner_1.jpg
Normal file
After Width: | Height: | Size: 300 KiB |
BIN
example/res/image/banner_2.jpg
Normal file
After Width: | Height: | Size: 298 KiB |
BIN
example/res/image/banner_3.jpg
Normal file
After Width: | Height: | Size: 130 KiB |
@ -33,14 +33,18 @@ void FluApp::run(){
|
||||
navigate(initialRoute());
|
||||
}
|
||||
|
||||
void FluApp::navigate(const QString& route){
|
||||
void FluApp::navigate(const QString& route,const QJsonObject& argument,FluRegister* fluRegister){
|
||||
if(!routes().contains(route)){
|
||||
qErrnoWarning("没有找到当前路由");
|
||||
return;
|
||||
}
|
||||
bool isAppWindow = route == initialRoute();
|
||||
FramelessView *view = new FramelessView();
|
||||
|
||||
if(fluRegister){
|
||||
fluRegister->to(view);
|
||||
view->setProperty("pageRegister",QVariant::fromValue(fluRegister));
|
||||
}
|
||||
view->setProperty("argument",argument);
|
||||
QMapIterator<QString, QVariant> iterator(properties);
|
||||
while (iterator.hasNext()) {
|
||||
iterator.next();
|
||||
@ -59,7 +63,6 @@ void FluApp::navigate(const QString& route){
|
||||
view->setSource((routes().value(route).toString()));
|
||||
if(isAppWindow){
|
||||
QObject::connect(view->engine(), &QQmlEngine::quit, qApp, &QCoreApplication::quit);
|
||||
// QObject::connect(qApp, &QGuiApplication::aboutToQuit, qApp, [&view](){view->setSource({});});
|
||||
}else{
|
||||
view->closeDeleteLater();
|
||||
}
|
||||
@ -82,7 +85,7 @@ QJsonArray FluApp::awesomelist(const QString& keyword)
|
||||
obj.insert("icon",icon);
|
||||
arr.append(obj);
|
||||
}else{
|
||||
if(name.mid(3).contains(keyword)){
|
||||
if(name.contains(keyword)){
|
||||
QJsonObject obj;
|
||||
obj.insert("name",name);
|
||||
obj.insert("icon",icon);
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <QQmlContext>
|
||||
#include <QJsonObject>
|
||||
#include <QQmlEngine>
|
||||
#include "FluRegister.h"
|
||||
#include "FramelessView.h"
|
||||
#include "stdafx.h"
|
||||
|
||||
@ -24,7 +25,7 @@ public:
|
||||
|
||||
Q_INVOKABLE void run();
|
||||
|
||||
Q_INVOKABLE void navigate(const QString& route);
|
||||
Q_INVOKABLE void navigate(const QString& route,const QJsonObject& argument = {},FluRegister* fluRegister = nullptr);
|
||||
|
||||
Q_INVOKABLE void init(QWindow *window,QMap<QString, QVariant> properties);
|
||||
|
||||
@ -37,9 +38,8 @@ public:
|
||||
Q_INVOKABLE void clipText(const QString& text);
|
||||
|
||||
private:
|
||||
|
||||
static FluApp* m_instance;
|
||||
QMap<QString, QVariant> properties;
|
||||
static FluApp* m_instance;
|
||||
QWindow *appWindow;
|
||||
|
||||
};
|
||||
|
20
src/FluRegister.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
#include "FluRegister.h"
|
||||
|
||||
#include "FluApp.h"
|
||||
#include <QCoreApplication>
|
||||
|
||||
FluRegister::FluRegister(QObject *parent)
|
||||
: QObject{parent}
|
||||
{
|
||||
from(nullptr);
|
||||
to(nullptr);
|
||||
path("");
|
||||
}
|
||||
|
||||
void FluRegister::launch(const QJsonObject& argument){
|
||||
FluApp::getInstance()->navigate(path(),argument,this);
|
||||
}
|
||||
|
||||
void FluRegister::onResult(const QJsonObject& data){
|
||||
Q_EMIT result(data);
|
||||
}
|
24
src/FluRegister.h
Normal file
@ -0,0 +1,24 @@
|
||||
#ifndef FLUREGISTER_H
|
||||
#define FLUREGISTER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <FramelessView.h>
|
||||
#include <QJsonObject>
|
||||
#include "stdafx.h"
|
||||
|
||||
class FluRegister : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY_AUTO(FramelessView*,from)
|
||||
Q_PROPERTY_AUTO(FramelessView*,to)
|
||||
Q_PROPERTY_AUTO(QString,path);
|
||||
public:
|
||||
explicit FluRegister(QObject *parent = nullptr);
|
||||
|
||||
Q_INVOKABLE void launch(const QJsonObject& argument = {});
|
||||
Q_INVOKABLE void onResult(const QJsonObject& data = {});
|
||||
Q_SIGNAL void result(const QJsonObject& data);
|
||||
|
||||
};
|
||||
|
||||
#endif // FLUREGISTER_H
|
@ -16,6 +16,8 @@ FluTheme::FluTheme(QObject *parent)
|
||||
: QObject{parent}
|
||||
{
|
||||
primaryColor(FluColors::getInstance()->Blue());
|
||||
isFrameless(true);
|
||||
textSize(13);
|
||||
isNativeText(false);
|
||||
isFrameless(false);
|
||||
isDark(false);
|
||||
}
|
||||
|
@ -11,6 +11,8 @@ class FluTheme : public QObject
|
||||
Q_PROPERTY_AUTO(FluColorSet*,primaryColor)
|
||||
Q_PROPERTY_AUTO(bool,isFrameless);
|
||||
Q_PROPERTY_AUTO(bool,isDark);
|
||||
Q_PROPERTY_AUTO(bool,isNativeText);
|
||||
Q_PROPERTY_AUTO(int,textSize);
|
||||
public:
|
||||
explicit FluTheme(QObject *parent = nullptr);
|
||||
static FluTheme *getInstance();
|
||||
|
@ -33,6 +33,22 @@ void Fluent::registerTypes(const char *uri){
|
||||
qmlRegisterType<WindowHelper>(uri,major,minor,"WindowHelper");
|
||||
qmlRegisterType<FluColorSet>(uri,major,minor,"FluColorSet");
|
||||
|
||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluArea.qml"),uri,major,minor,"FluArea");
|
||||
|
||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluContentPage.qml"),uri,major,minor,"FluContentPage");
|
||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluScrollablePage.qml"),uri,major,minor,"FluScrollablePage");
|
||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluPaneItemHeader.qml"),uri,major,minor,"FluPaneItemHeader");
|
||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluPaneItem.qml"),uri,major,minor,"FluPaneItem");
|
||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluPaneItemSeparator.qml"),uri,major,minor,"FluPaneItemSeparator");
|
||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluNavigationView.qml"),uri,major,minor,"FluNavigationView");
|
||||
|
||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluCalendarDatePicker.qml"),uri,major,minor,"FluCalendarDatePicker");
|
||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluCalenderView.qml"),uri,major,minor,"FluCalenderView");
|
||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluDatePicker.qml"),uri,major,minor,"FluDatePicker");
|
||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluTimePicker.qml"),uri,major,minor,"FluTimePicker");
|
||||
|
||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluCarousel.qml"),uri,major,minor,"FluCarousel");
|
||||
|
||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluAutoSuggestBox.qml"),uri,major,minor,"FluAutoSuggestBox");
|
||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluExpander.qml"),uri,major,minor,"FluExpander");
|
||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluTreeView.qml"),uri,major,minor,"FluTreeView");
|
||||
@ -62,7 +78,6 @@ void Fluent::registerTypes(const char *uri){
|
||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluSlider.qml"),uri,major,minor,"FluSlider");
|
||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluTextBox.qml"),uri,major,minor,"FluTextBox");
|
||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluText.qml"),uri,major,minor,"FluText");
|
||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluTimePicker.qml"),uri,major,minor,"FluTimePicker");
|
||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluFilledButton.qml"),uri,major,minor,"FluFilledButton");
|
||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluToggleSwitch.qml"),uri,major,minor,"FluToggleSwitch");
|
||||
|
||||
@ -73,10 +88,13 @@ void Fluent::initializeEngine(QQmlEngine *engine, const char *uri)
|
||||
{
|
||||
Q_UNUSED(engine)
|
||||
Q_UNUSED(uri)
|
||||
#ifdef Q_OS_WIN
|
||||
QFont font;
|
||||
font.setFamily("Microsoft YaHei");
|
||||
QGuiApplication::setFont(font);
|
||||
QFontDatabase::addApplicationFont(":/com.zhuzichu/res/font/fontawesome-webfont.ttf");
|
||||
// QQuickWindow::setTextRenderType(QQuickWindow::NativeTextRendering);
|
||||
#endif
|
||||
QFontDatabase::addApplicationFont(":/com.zhuzichu/res/font/Segoe_Fluent_Icons.ttf");
|
||||
FluApp* app = FluApp::getInstance();
|
||||
engine->rootContext()->setContextProperty("FluApp",app);
|
||||
FluColors* colors = FluColors::getInstance();
|
||||
|
@ -15,6 +15,7 @@ HEADERS += \
|
||||
FluApp.h \
|
||||
FluColorSet.h \
|
||||
FluColors.h \
|
||||
FluRegister.h \
|
||||
FluTheme.h \
|
||||
Fluent.h \
|
||||
FluentUI.h \
|
||||
@ -28,6 +29,7 @@ SOURCES += \
|
||||
FluApp.cpp \
|
||||
FluColorSet.cpp \
|
||||
FluColors.cpp \
|
||||
FluRegister.cpp \
|
||||
FluTheme.cpp \
|
||||
Fluent.cpp \
|
||||
FluentUI.cpp \
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "WindowHelper.h"
|
||||
|
||||
#include "FluRegister.h"
|
||||
|
||||
WindowHelper::WindowHelper(QObject *parent)
|
||||
: QObject{parent}
|
||||
{
|
||||
@ -10,11 +12,18 @@ void WindowHelper::setTitle(const QString& text){
|
||||
window->setTitle(text);
|
||||
}
|
||||
|
||||
|
||||
void WindowHelper::initWindow(FramelessView* window){
|
||||
this->window = window;
|
||||
}
|
||||
|
||||
QJsonObject WindowHelper::getArgument(){
|
||||
return window->property("argument").toJsonObject();
|
||||
}
|
||||
|
||||
QVariant WindowHelper::getPageRegister(){
|
||||
return window->property("pageRegister");
|
||||
}
|
||||
|
||||
void WindowHelper::setMinimumWidth(int width){
|
||||
this->window->setMinimumWidth(width);
|
||||
}
|
||||
@ -27,3 +36,25 @@ void WindowHelper::setMinimumHeight(int height){
|
||||
void WindowHelper::setMaximumHeight(int height){
|
||||
this->window->setMaximumHeight(height);
|
||||
}
|
||||
void WindowHelper::updateWindow(){
|
||||
this->window->setFlag(Qt::Window,false);
|
||||
this->window->setFlag(Qt::Window,true);
|
||||
}
|
||||
void WindowHelper::setModality(int type){
|
||||
if(type == 0){
|
||||
this->window->setModality(Qt::NonModal);
|
||||
}else if(type == 1){
|
||||
this->window->setModality(Qt::WindowModal);
|
||||
}else if(type == 2){
|
||||
this->window->setModality(Qt::ApplicationModal);
|
||||
}else{
|
||||
this->window->setModality(Qt::NonModal);
|
||||
}
|
||||
}
|
||||
|
||||
QVariant WindowHelper::createRegister(const QString& path){
|
||||
FluRegister *p = new FluRegister(this->window);
|
||||
p->from(this->window);
|
||||
p->path(path);
|
||||
return QVariant::fromValue(p);
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <QQuickWindow>
|
||||
#include <QQuickItem>
|
||||
#include <QWindow>
|
||||
#include <QJsonObject>
|
||||
#include "FramelessView.h"
|
||||
|
||||
class WindowHelper : public QObject
|
||||
@ -20,6 +21,11 @@ public:
|
||||
Q_INVOKABLE void setMaximumWidth(int width);
|
||||
Q_INVOKABLE void setMinimumHeight(int height);
|
||||
Q_INVOKABLE void setMaximumHeight(int height);
|
||||
Q_INVOKABLE QJsonObject getArgument();
|
||||
Q_INVOKABLE QVariant getPageRegister();
|
||||
Q_INVOKABLE void updateWindow();
|
||||
Q_INVOKABLE void setModality(int type);
|
||||
Q_INVOKABLE QVariant createRegister(const QString& path);
|
||||
|
||||
private:
|
||||
FramelessView* window;
|
||||
|
@ -14,7 +14,8 @@ Rectangle{
|
||||
return Window.window.active ? borerlessColor : Qt.lighter(borerlessColor,1.1)
|
||||
}
|
||||
visible: FluTheme.isFrameless
|
||||
height: visible ? 50 : 0
|
||||
height: visible ? 34 : 0
|
||||
|
||||
width: {
|
||||
if(parent==null)
|
||||
return 200
|
||||
@ -60,7 +61,7 @@ Rectangle{
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
leftMargin: 14
|
||||
leftMargin: 10
|
||||
}
|
||||
color:root.textColor
|
||||
fontStyle: FluText.Title
|
||||
@ -69,14 +70,13 @@ Rectangle{
|
||||
}
|
||||
|
||||
RowLayout{
|
||||
anchors.right: parent.right;
|
||||
anchors.rightMargin: 10
|
||||
height: parent.height
|
||||
spacing: 5
|
||||
anchors.right: parent.right
|
||||
height: 30
|
||||
spacing: 0
|
||||
|
||||
TFpsMonitor{
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
Layout.rightMargin: 12
|
||||
Layout.rightMargin: 20
|
||||
Layout.topMargin: 5
|
||||
color:root.textColor
|
||||
visible: showFps
|
||||
@ -84,23 +84,24 @@ Rectangle{
|
||||
|
||||
RowLayout{
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
spacing: 5
|
||||
Layout.rightMargin: 14
|
||||
visible: showDark
|
||||
spacing: 5
|
||||
FluText{
|
||||
text:"夜间模式"
|
||||
color:root.textColor
|
||||
fontStyle: FluText.Body
|
||||
}
|
||||
FluToggleSwitch{
|
||||
checked: FluTheme.isDark
|
||||
onClickFunc:function(){
|
||||
selected: FluTheme.isDark
|
||||
clickFunc:function(){
|
||||
FluTheme.isDark = !FluTheme.isDark
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FluIconButton{
|
||||
icon : FluentIcons.FA_window_minimize
|
||||
iconSource : FluentIcons.ChromeMinimizeContrast
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
iconSize: 15
|
||||
text:"最小化"
|
||||
@ -116,7 +117,7 @@ Rectangle{
|
||||
return false
|
||||
return Window.Maximized === window.visibility
|
||||
}
|
||||
icon : isRestore ? FluentIcons.FA_window_restore : FluentIcons.FA_window_maximize
|
||||
iconSource : isRestore ? FluentIcons.ChromeRestoreContrast : FluentIcons.ChromeMaximizeContrast
|
||||
color:hovered ? "#20000000" : "#00000000"
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
visible: resizable
|
||||
@ -128,9 +129,10 @@ Rectangle{
|
||||
}
|
||||
}
|
||||
FluIconButton{
|
||||
icon : FluentIcons.FA_close
|
||||
iconSource : FluentIcons.ChromeCloseContrast
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
text:"关闭"
|
||||
iconSize: 13
|
||||
textColor: root.textColor
|
||||
color:hovered ? "#20000000" : "#00000000"
|
||||
onClicked: {
|
||||
|
28
src/controls/FluArea.qml
Normal file
@ -0,0 +1,28 @@
|
||||
import QtQuick 2.15
|
||||
import FluentUI 1.0
|
||||
|
||||
Rectangle {
|
||||
radius: 4
|
||||
color: FluTheme.isDark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
|
||||
border.color: FluTheme.isDark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1)
|
||||
border.width: 1
|
||||
implicitHeight: height
|
||||
implicitWidth: width
|
||||
|
||||
default property alias content: container.data
|
||||
property int paddings : 0
|
||||
property int leftPadding : 0
|
||||
property int rightPadding : 0
|
||||
property int topPadding : 0
|
||||
property int bottomPadding : 0
|
||||
|
||||
Item {
|
||||
id: container
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: Math.max(paddings,leftPadding)
|
||||
anchors.rightMargin: Math.max(paddings,rightPadding)
|
||||
anchors.topMargin: Math.max(paddings,topPadding)
|
||||
anchors.bottomMargin: Math.max(paddings,bottomPadding)
|
||||
}
|
||||
|
||||
}
|
@ -3,9 +3,15 @@ import QtQuick.Controls 2.15
|
||||
import FluentUI 1.0
|
||||
|
||||
TextField{
|
||||
|
||||
property var values:[]
|
||||
property int fontStyle: FluText.Body
|
||||
property int pixelSize : FluTheme.textSize
|
||||
property int iconSource: 0
|
||||
signal itemClicked(string data)
|
||||
|
||||
id:input
|
||||
width: 300
|
||||
property var values:[]
|
||||
color: FluTheme.isDark ? "#FFFFFF" : "#1A1A1A"
|
||||
selectionColor: {
|
||||
if(FluTheme.isDark){
|
||||
@ -14,15 +20,79 @@ TextField{
|
||||
return FluTheme.primaryColor.dark
|
||||
}
|
||||
}
|
||||
rightPadding: 30
|
||||
renderType: FluTheme.isNativeText ? Text.NativeRendering : Text.QtRendering
|
||||
placeholderTextColor: {
|
||||
if(focus){
|
||||
return FluTheme.isDark ? Qt.rgba(152/255,152/255,152/255,1) : Qt.rgba(141/255,141/255,141/255,1)
|
||||
}
|
||||
return FluTheme.isDark ? Qt.rgba(210/255,210/255,210/255,1) : Qt.rgba(96/255,96/255,96/255,1)
|
||||
}
|
||||
rightPadding: icon_right.visible ? 50 : 30
|
||||
selectByMouse: true
|
||||
|
||||
Keys.onUpPressed: {
|
||||
list_view.currentIndex = Math.max(list_view.currentIndex-1,0)
|
||||
}
|
||||
|
||||
Keys.onDownPressed: {
|
||||
list_view.currentIndex = Math.min(list_view.currentIndex+1,list_view.count-1)
|
||||
}
|
||||
|
||||
signal handleClicked
|
||||
Keys.onEnterPressed:handleClicked()
|
||||
Keys.onReturnPressed:handleClicked()
|
||||
|
||||
|
||||
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.BodyLarge:
|
||||
return false
|
||||
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 input.pixelSize * 4
|
||||
case FluText.TitleLarge:
|
||||
return input.pixelSize * 2
|
||||
case FluText.Title:
|
||||
return input.pixelSize * 1.5
|
||||
case FluText.Subtitle:
|
||||
return input.pixelSize * 0.9
|
||||
case FluText.BodyLarge:
|
||||
return input.pixelSize * 1.1
|
||||
case FluText.BodyStrong:
|
||||
return input.pixelSize * 1.0
|
||||
case FluText.Body:
|
||||
return input.pixelSize * 1.0
|
||||
case FluText.Caption:
|
||||
return input.pixelSize * 0.8
|
||||
default:
|
||||
return input.pixelSize * 1.0
|
||||
}
|
||||
}
|
||||
background: FluTextBoxBackground{
|
||||
inputItem: input
|
||||
|
||||
FluIconButton{
|
||||
icon:FluentIcons.FA_close
|
||||
iconSize: 14
|
||||
iconSource:FluentIcons.ChromeClose
|
||||
iconSize: 10
|
||||
width: 20
|
||||
height: 20
|
||||
opacity: 0.5
|
||||
@ -30,12 +100,25 @@ TextField{
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
right: parent.right
|
||||
rightMargin: 5
|
||||
rightMargin: icon_right.visible ? 25 : 5
|
||||
}
|
||||
onClicked:{
|
||||
input.text = ""
|
||||
}
|
||||
}
|
||||
|
||||
FluIcon{
|
||||
id:icon_right
|
||||
iconSource: input.iconSource
|
||||
iconSize: 15
|
||||
opacity: 0.5
|
||||
visible: input.iconSource != 0
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
right: parent.right
|
||||
rightMargin: 5
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
@ -49,13 +132,18 @@ TextField{
|
||||
onClosed: {
|
||||
input.focus = false
|
||||
}
|
||||
onVisibleChanged: {
|
||||
if(visible){
|
||||
list_view.currentIndex = -1
|
||||
}
|
||||
}
|
||||
background: Rectangle{
|
||||
width: input.width
|
||||
radius: 4
|
||||
FluShadow{
|
||||
radius: 4
|
||||
}
|
||||
color: FluTheme.isDark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(243/255,241/255,240/255,1)
|
||||
color: FluTheme.isDark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1)
|
||||
height: 38*Math.min(Math.max(list_view.count,1),8)
|
||||
ListView{
|
||||
id:list_view
|
||||
@ -63,6 +151,8 @@ TextField{
|
||||
anchors.fill: parent
|
||||
boundsBehavior: ListView.StopAtBounds
|
||||
clip: true
|
||||
currentIndex: -1
|
||||
ScrollBar.vertical: FluScrollBar {}
|
||||
header: Item{
|
||||
width: input.width
|
||||
height: visible ? 38 : 0
|
||||
@ -72,46 +162,85 @@ TextField{
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
leftMargin: 15
|
||||
leftMargin: 10
|
||||
}
|
||||
}
|
||||
}
|
||||
ScrollBar.vertical: ScrollBar { }
|
||||
delegate: Item{
|
||||
height: 38
|
||||
delegate:Control{
|
||||
width: input.width
|
||||
Rectangle{
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: 2
|
||||
anchors.bottomMargin: 2
|
||||
anchors.leftMargin: 5
|
||||
anchors.rightMargin: 5
|
||||
padding:10
|
||||
background: Rectangle{
|
||||
color: {
|
||||
if(item_mouse.containsMouse){
|
||||
return FluTheme.isDark ? Qt.rgba(63/255,60/255,61/255,1) : Qt.rgba(234/255,234/255,234/255,1)
|
||||
if(list_view.currentIndex === index){
|
||||
return FluTheme.isDark ? Qt.rgba(63/255,60/255,61/255,1) : Qt.rgba(237/255,237/255,242/255,1)
|
||||
}
|
||||
return FluTheme.isDark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(243/255,241/255,240/255,1)
|
||||
if(hovered){
|
||||
return FluTheme.isDark ? Qt.rgba(63/255,60/255,61/255,1) : Qt.rgba(237/255,237/255,242/255,1)
|
||||
}
|
||||
return FluTheme.isDark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(0,0,0,0)
|
||||
}
|
||||
radius: 3
|
||||
MouseArea{
|
||||
id:item_mouse
|
||||
id:mouse_area
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
Connections{
|
||||
target: input
|
||||
function onHandleClicked(){
|
||||
if((list_view.currentIndex === index)){
|
||||
mouse_area.handleClick()
|
||||
}
|
||||
}
|
||||
}
|
||||
onClicked: handleClick()
|
||||
function handleClick(){
|
||||
input_popup.close()
|
||||
input.itemClicked(modelData)
|
||||
input.text = modelData
|
||||
}
|
||||
}
|
||||
FluText{
|
||||
text:modelData
|
||||
Rectangle{
|
||||
width: 3
|
||||
color:FluTheme.primaryColor.dark
|
||||
visible: list_view.currentIndex === index
|
||||
radius: 3
|
||||
height: 20
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
leftMargin: 10
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
contentItem: FluText{
|
||||
text:modelData
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// Item{
|
||||
// height: 38
|
||||
// width: input.width
|
||||
// Rectangle{
|
||||
// anchors.fill: parent
|
||||
// anchors.topMargin: 2
|
||||
// anchors.bottomMargin: 2
|
||||
// anchors.leftMargin: 5
|
||||
// anchors.rightMargin: 5
|
||||
|
||||
// radius: 3
|
||||
// MouseArea{
|
||||
// id:item_mouse
|
||||
// anchors.fill: parent
|
||||
// hoverEnabled: true
|
||||
// onClicked: {
|
||||
// input_popup.close()
|
||||
// input.itemClicked(modelData)
|
||||
// input.text = modelData
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -122,6 +251,10 @@ TextField{
|
||||
|
||||
function searchData(){
|
||||
var result = []
|
||||
if(values==null){
|
||||
list_view.model = result
|
||||
return
|
||||
}
|
||||
values.map(function(item){
|
||||
if(item.indexOf(input.text)!==-1){
|
||||
result.push(item)
|
||||
|
@ -1,48 +1,43 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import FluentUI 1.0
|
||||
|
||||
Rectangle {
|
||||
id: button
|
||||
Button {
|
||||
|
||||
property string text: "Standard Button"
|
||||
property int startPadding : 15
|
||||
property int endPadding : 15
|
||||
property int topPadding: 5
|
||||
property int bottomPadding: 5
|
||||
property bool disabled: false
|
||||
property color primaryColor : "#0064B0"
|
||||
signal clicked
|
||||
radius: 4
|
||||
property color normalColor: FluTheme.isDark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(254/255,254/255,254/255,1)
|
||||
property color hoverColor: FluTheme.isDark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
|
||||
property color disableColor: FluTheme.isDark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(252/255,252/255,252/255,1)
|
||||
|
||||
color:{
|
||||
if(FluTheme.isDark){
|
||||
id: control
|
||||
topPadding:5
|
||||
bottomPadding:5
|
||||
leftPadding:15
|
||||
rightPadding:15
|
||||
enabled: !disabled
|
||||
focusPolicy:Qt.TabFocus
|
||||
|
||||
Keys.onSpacePressed: control.visualFocus&&clicked()
|
||||
|
||||
background: Rectangle{
|
||||
border.color: FluTheme.isDark ? "#505050" : "#DFDFDF"
|
||||
border.width: 1
|
||||
radius: 4
|
||||
FluFocusRectangle{
|
||||
visible: control.visualFocus
|
||||
radius:8
|
||||
}
|
||||
color:{
|
||||
if(disabled){
|
||||
return Qt.rgba(59/255,59/255,59/255,1)
|
||||
return disableColor
|
||||
}
|
||||
return button_mouse.containsMouse ? "#444444" : "#3e3e3e"
|
||||
}else{
|
||||
if(disabled){
|
||||
return Qt.rgba(252/255,252/255,252/255,1)
|
||||
}
|
||||
return button_mouse.containsMouse ? "#FBFBFB" : "#FFFFFF"
|
||||
return hovered ? hoverColor :normalColor
|
||||
}
|
||||
}
|
||||
width: button_text.implicitWidth
|
||||
height: button_text.implicitHeight
|
||||
|
||||
border.color: FluTheme.isDark ? "#505050" : "#DFDFDF"
|
||||
border.width: 1
|
||||
|
||||
|
||||
FluText {
|
||||
id: button_text
|
||||
text: button.text
|
||||
font.pixelSize: 14
|
||||
leftPadding: button.startPadding
|
||||
rightPadding: button.endPadding
|
||||
topPadding: button.topPadding
|
||||
bottomPadding: button.bottomPadding
|
||||
anchors.centerIn: parent
|
||||
contentItem: FluText {
|
||||
text: control.text
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: {
|
||||
if(FluTheme.isDark){
|
||||
if(disabled){
|
||||
@ -57,14 +52,4 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id:button_mouse
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
enabled: !disabled
|
||||
onClicked: {
|
||||
button.clicked()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
5
src/controls/FluCalendarDatePicker.qml
Normal file
@ -0,0 +1,5 @@
|
||||
import QtQuick 2.15
|
||||
|
||||
Item {
|
||||
|
||||
}
|
5
src/controls/FluCalenderView.qml
Normal file
@ -0,0 +1,5 @@
|
||||
import QtQuick 2.15
|
||||
|
||||
Item {
|
||||
|
||||
}
|
136
src/controls/FluCarousel.qml
Normal file
@ -0,0 +1,136 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import FluentUI 1.0
|
||||
|
||||
Item {
|
||||
|
||||
property bool flagXChanged: true
|
||||
property int radius : 5
|
||||
property int loopTime: 2000
|
||||
property bool showIndicator: true
|
||||
|
||||
id:control
|
||||
width: 400
|
||||
height: 300
|
||||
ListModel{
|
||||
id:content_model
|
||||
}
|
||||
FluRectangle{
|
||||
anchors.fill: parent
|
||||
radius: [control.radius,control.radius,control.radius,control.radius]
|
||||
FluShadow{
|
||||
radius:control.radius
|
||||
}
|
||||
ListView{
|
||||
id:list_view
|
||||
anchors.fill: parent
|
||||
snapMode: ListView.SnapOneItem
|
||||
clip: true
|
||||
boundsBehavior: ListView.StopAtBounds
|
||||
model:content_model
|
||||
maximumFlickVelocity: 4 * (list_view.orientation === Qt.Horizontal ? width : height)
|
||||
preferredHighlightBegin: 0
|
||||
preferredHighlightEnd: 0
|
||||
highlightMoveDuration: 0
|
||||
orientation : ListView.Horizontal
|
||||
delegate: Item{
|
||||
width: ListView.view.width
|
||||
height: ListView.view.height
|
||||
property int displayIndex: {
|
||||
if(index === 0)
|
||||
return content_model.count-3
|
||||
if(index === content_model.count-1)
|
||||
return 0
|
||||
return index-1
|
||||
}
|
||||
Image {
|
||||
anchors.fill: parent
|
||||
source: model.url
|
||||
fillMode:Image.PreserveAspectCrop
|
||||
}
|
||||
}
|
||||
onMovementEnded:{
|
||||
currentIndex = list_view.contentX/list_view.width
|
||||
if(currentIndex === 0){
|
||||
currentIndex = list_view.count-2
|
||||
}else if(currentIndex === list_view.count-1){
|
||||
currentIndex = 1
|
||||
}
|
||||
flagXChanged = false
|
||||
timer_run.start()
|
||||
}
|
||||
onMovementStarted: {
|
||||
flagXChanged = true
|
||||
timer_run.stop()
|
||||
}
|
||||
onContentXChanged: {
|
||||
if(flagXChanged){
|
||||
var maxX = Math.min(list_view.width*(currentIndex+1),list_view.count*list_view.width)
|
||||
var minY = Math.max(0,(list_view.width*(currentIndex-1)))
|
||||
if(contentX>=maxX){
|
||||
contentX = maxX
|
||||
}
|
||||
if(contentX<=minY){
|
||||
contentX = minY
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function setData(data){
|
||||
content_model.clear()
|
||||
content_model.append(data[data.length-1])
|
||||
content_model.append(data)
|
||||
content_model.append(data[0])
|
||||
list_view.currentIndex = 1
|
||||
timer_run.restart()
|
||||
}
|
||||
Row{
|
||||
spacing: 10
|
||||
anchors{
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
bottom: parent.bottom
|
||||
bottomMargin: 20
|
||||
}
|
||||
visible: showIndicator
|
||||
Repeater{
|
||||
model: list_view.count
|
||||
Rectangle{
|
||||
width: 8
|
||||
height: 8
|
||||
radius: 4
|
||||
visible: {
|
||||
if(index===0 || index===list_view.count-1)
|
||||
return false
|
||||
return true
|
||||
}
|
||||
layer.samples: 4
|
||||
layer.enabled: true
|
||||
layer.smooth: true
|
||||
border.width: 1
|
||||
border.color: FluColors.Grey100
|
||||
color: list_view.currentIndex === index ? FluTheme.primaryColor.dark : Qt.rgba(1,1,1,0.5)
|
||||
}
|
||||
}
|
||||
}
|
||||
Timer{
|
||||
id:timer_anim
|
||||
interval: 250
|
||||
onTriggered: {
|
||||
list_view.highlightMoveDuration = 0
|
||||
if(list_view.currentIndex === list_view.count-1){
|
||||
list_view.currentIndex = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
Timer{
|
||||
id:timer_run
|
||||
interval: control.loopTime
|
||||
repeat: true
|
||||
onTriggered: {
|
||||
list_view.highlightMoveDuration = 250
|
||||
list_view.currentIndex = list_view.currentIndex+1
|
||||
timer_anim.start()
|
||||
}
|
||||
}
|
||||
}
|
@ -1,46 +1,56 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import FluentUI 1.0
|
||||
|
||||
Item {
|
||||
|
||||
id:root
|
||||
property bool checked: false
|
||||
property string text: "Check Box"
|
||||
property var checkClicked
|
||||
property bool hovered: mouse_area.containsMouse
|
||||
Button {
|
||||
|
||||
property bool selected: false
|
||||
property var clickFunc
|
||||
property bool disabled: false
|
||||
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
|
||||
property color borderNormalColor: FluTheme.isDark ? Qt.rgba(160/255,160/255,160/255,1) : Qt.rgba(136/255,136/255,136/255,1)
|
||||
property color borderCheckedColor: FluTheme.isDark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
||||
property color borderSelectedColor: FluTheme.isDark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
||||
property color borderHoverColor: FluTheme.isDark ? Qt.rgba(167/255,167/255,167/255,1) : Qt.rgba(135/255,135/255,135/255,1)
|
||||
property color borderDisableColor: FluTheme.isDark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1)
|
||||
|
||||
property color normalColor: FluTheme.isDark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(247/255,247/255,247/255,1)
|
||||
property color checkedColor: FluTheme.isDark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
||||
property color selectedColor: FluTheme.isDark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
||||
property color hoverColor: FluTheme.isDark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(244/255,244/255,244/255,1)
|
||||
property color checkedHoverColor: FluTheme.isDark ? Qt.darker(checkedColor,1.1) : Qt.lighter(checkedColor,1.1)
|
||||
|
||||
property color checkedDisableColor: FluTheme.isDark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1)
|
||||
|
||||
property color selectedHoverColor: FluTheme.isDark ? Qt.darker(selectedColor,1.1) : Qt.lighter(selectedColor,1.1)
|
||||
property color selectedDisableColor: FluTheme.isDark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1)
|
||||
property color disableColor: FluTheme.isDark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(253/255,253/255,253/255,1)
|
||||
|
||||
RowLayout{
|
||||
id:control
|
||||
enabled: !disabled
|
||||
focusPolicy:Qt.TabFocus
|
||||
Keys.onSpacePressed: control.visualFocus&&clicked()
|
||||
padding:0
|
||||
onClicked: {
|
||||
if(disabled){
|
||||
return
|
||||
}
|
||||
if(clickFunc){
|
||||
clickFunc()
|
||||
return
|
||||
}
|
||||
selected = !selected
|
||||
}
|
||||
background: Item{
|
||||
FluFocusRectangle{
|
||||
visible: control.visualFocus
|
||||
}
|
||||
}
|
||||
contentItem: RowLayout{
|
||||
spacing: 4
|
||||
Rectangle{
|
||||
width: 22
|
||||
height: 22
|
||||
width: 20
|
||||
height: 20
|
||||
radius: 4
|
||||
border.color: {
|
||||
if(disabled){
|
||||
return borderDisableColor
|
||||
}
|
||||
if(checked){
|
||||
return borderCheckedColor
|
||||
if(selected){
|
||||
return borderSelectedColor
|
||||
}
|
||||
if(hovered){
|
||||
return borderHoverColor
|
||||
@ -49,47 +59,30 @@ Item {
|
||||
}
|
||||
border.width: 1
|
||||
color: {
|
||||
if(checked){
|
||||
if(selected){
|
||||
if(disabled){
|
||||
return checkedDisableColor
|
||||
return selectedDisableColor
|
||||
}
|
||||
if(hovered){
|
||||
return checkedHoverColor
|
||||
return selectedHoverColor
|
||||
}
|
||||
return checkedColor
|
||||
return selectedColor
|
||||
}
|
||||
if(hovered){
|
||||
return hoverColor
|
||||
}
|
||||
return normalColor
|
||||
}
|
||||
|
||||
FluIcon {
|
||||
anchors.centerIn: parent
|
||||
icon: FluentIcons.FA_check
|
||||
iconSource: FluentIcons.AcceptMedium
|
||||
iconSize: 15
|
||||
visible: checked
|
||||
visible: selected
|
||||
color: FluTheme.isDark ? Qt.rgba(0,0,0,1) : Qt.rgba(1,1,1,1)
|
||||
}
|
||||
}
|
||||
FluText{
|
||||
text:root.text
|
||||
text:control.text
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MouseArea{
|
||||
id:mouse_area
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
enabled: !disabled
|
||||
onClicked: {
|
||||
if(checkClicked){
|
||||
checkClicked()
|
||||
return
|
||||
}
|
||||
checked = !checked
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
29
src/controls/FluContentPage.qml
Normal file
@ -0,0 +1,29 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtQuick.Window 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import FluentUI 1.0
|
||||
|
||||
Item {
|
||||
|
||||
id:root
|
||||
|
||||
property alias title: text_title.text
|
||||
default property alias content: container.data
|
||||
|
||||
FluText{
|
||||
id:text_title
|
||||
fontStyle: FluText.TitleLarge
|
||||
}
|
||||
|
||||
Item{
|
||||
clip: true
|
||||
id:container
|
||||
anchors{
|
||||
top: text_title.bottom
|
||||
bottom: parent.bottom
|
||||
}
|
||||
width: parent.width
|
||||
}
|
||||
|
||||
}
|
395
src/controls/FluDatePicker.qml
Normal file
@ -0,0 +1,395 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtQuick.Window 2.15
|
||||
import FluentUI 1.0
|
||||
|
||||
Rectangle {
|
||||
|
||||
id:root
|
||||
|
||||
property color dividerColor: FluTheme.isDark ? Qt.rgba(77/255,77/255,77/255,1) : Qt.rgba(239/255,239/255,239/255,1)
|
||||
property color hoverColor: FluTheme.isDark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
|
||||
property color normalColor: FluTheme.isDark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(254/255,254/255,254/255,1)
|
||||
property var window : Window.window
|
||||
|
||||
property bool showYear: true
|
||||
|
||||
color: {
|
||||
if(mouse_area.containsMouse){
|
||||
return hoverColor
|
||||
}
|
||||
return normalColor
|
||||
}
|
||||
height: 30
|
||||
width: 300
|
||||
radius: 4
|
||||
border.width: 1
|
||||
border.color: dividerColor
|
||||
|
||||
MouseArea{
|
||||
id:mouse_area
|
||||
hoverEnabled: true
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
popup.showPopup()
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
id:divider_1
|
||||
width: 1
|
||||
x: parent.width/3
|
||||
height: parent.height
|
||||
color: dividerColor
|
||||
visible: showYear
|
||||
}
|
||||
|
||||
|
||||
Rectangle{
|
||||
id:divider_2
|
||||
width: 1
|
||||
x: showYear ? parent.width*2/3 : parent.width/2
|
||||
height: parent.height
|
||||
color: dividerColor
|
||||
}
|
||||
|
||||
FluText{
|
||||
id:text_year
|
||||
anchors{
|
||||
left: parent.left
|
||||
right: divider_1.left
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
}
|
||||
visible: showYear
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text:"年"
|
||||
}
|
||||
|
||||
|
||||
FluText{
|
||||
id:text_month
|
||||
anchors{
|
||||
left: showYear ? divider_1.right : parent.left
|
||||
right: divider_2.left
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
}
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text:"月"
|
||||
}
|
||||
|
||||
|
||||
FluText{
|
||||
id:text_day
|
||||
anchors{
|
||||
left: divider_2.right
|
||||
right: parent.right
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
}
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text:"日"
|
||||
}
|
||||
|
||||
Popup{
|
||||
id:popup
|
||||
background: Rectangle{
|
||||
width: 300
|
||||
radius: 4
|
||||
color: FluTheme.isDark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1)
|
||||
height: 340
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
}
|
||||
FluShadow{
|
||||
radius: 4
|
||||
}
|
||||
|
||||
RowLayout{
|
||||
id:layout_content
|
||||
spacing: 0
|
||||
width: parent.width
|
||||
height: 300
|
||||
|
||||
Component{
|
||||
id:list_delegate
|
||||
|
||||
Item{
|
||||
height:38
|
||||
width:getListView().width
|
||||
|
||||
function getListView(){
|
||||
if(type === 0)
|
||||
return list_view_1
|
||||
if(type === 1)
|
||||
return list_view_2
|
||||
if(type === 2)
|
||||
return list_view_3
|
||||
}
|
||||
|
||||
|
||||
Rectangle{
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: 2
|
||||
anchors.bottomMargin: 2
|
||||
anchors.leftMargin: 5
|
||||
anchors.rightMargin: 5
|
||||
color: {
|
||||
if(getListView().currentIndex === position){
|
||||
if(FluTheme.isDark){
|
||||
return item_mouse.containsMouse ? Qt.darker(FluTheme.primaryColor.lighter,1.1) : FluTheme.primaryColor.lighter
|
||||
}else{
|
||||
return item_mouse.containsMouse ? Qt.lighter(FluTheme.primaryColor.dark,1.1): FluTheme.primaryColor.dark
|
||||
}
|
||||
}
|
||||
if(item_mouse.containsMouse){
|
||||
return FluTheme.isDark ? Qt.rgba(63/255,60/255,61/255,1) : Qt.rgba(237/255,237/255,242/255,1)
|
||||
}
|
||||
return FluTheme.isDark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(0,0,0,0)
|
||||
}
|
||||
radius: 3
|
||||
MouseArea{
|
||||
id:item_mouse
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
getListView().currentIndex = position
|
||||
if(type === 0){
|
||||
text_year.text = model
|
||||
list_view_2.model = generateMonthArray(1,12)
|
||||
text_month.text = list_view_2.model[list_view_2.currentIndex]
|
||||
|
||||
list_view_3.model = generateMonthDaysArray(list_view_1.model[list_view_1.currentIndex],list_view_2.model[list_view_2.currentIndex])
|
||||
text_day.text = list_view_3.model[list_view_3.currentIndex]
|
||||
}
|
||||
if(type === 1){
|
||||
text_month.text = model
|
||||
list_view_3.model = generateMonthDaysArray(list_view_1.model[list_view_1.currentIndex],list_view_2.model[list_view_2.currentIndex])
|
||||
text_day.text = list_view_3.model[list_view_3.currentIndex]
|
||||
|
||||
}
|
||||
if(type === 2){
|
||||
text_day.text = model
|
||||
}
|
||||
}
|
||||
}
|
||||
FluText{
|
||||
text:model
|
||||
color: {
|
||||
if(getListView().currentIndex === position){
|
||||
if(FluTheme.isDark){
|
||||
return Qt.rgba(0,0,0,1)
|
||||
}else{
|
||||
return Qt.rgba(1,1,1,1)
|
||||
}
|
||||
}else{
|
||||
return FluTheme.isDark ? "#FFFFFF" : "#1A1A1A"
|
||||
}
|
||||
}
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ListView{
|
||||
id:list_view_1
|
||||
width: 100
|
||||
height: parent.height
|
||||
boundsBehavior:Flickable.StopAtBounds
|
||||
ScrollBar.vertical: FluScrollBar {}
|
||||
model: generateYearArray(1924,2048)
|
||||
clip: true
|
||||
preferredHighlightBegin: 0
|
||||
preferredHighlightEnd: 0
|
||||
highlightMoveDuration: 0
|
||||
visible: showYear
|
||||
delegate: Loader{
|
||||
property var model: modelData
|
||||
property int type:0
|
||||
property int position:index
|
||||
sourceComponent: list_delegate
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
width: 1
|
||||
height: parent.height
|
||||
color: dividerColor
|
||||
}
|
||||
ListView{
|
||||
id:list_view_2
|
||||
width: showYear ? 100 : 150
|
||||
height: parent.height
|
||||
clip: true
|
||||
ScrollBar.vertical: FluScrollBar {}
|
||||
preferredHighlightBegin: 0
|
||||
preferredHighlightEnd: 0
|
||||
highlightMoveDuration: 0
|
||||
boundsBehavior:Flickable.StopAtBounds
|
||||
delegate: Loader{
|
||||
property var model: modelData
|
||||
property int type:1
|
||||
property int position:index
|
||||
sourceComponent: list_delegate
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
width: 1
|
||||
height: parent.height
|
||||
color: dividerColor
|
||||
}
|
||||
ListView{
|
||||
id:list_view_3
|
||||
width: showYear ? 100 : 150
|
||||
height: parent.height
|
||||
clip: true
|
||||
preferredHighlightBegin: 0
|
||||
preferredHighlightEnd: 0
|
||||
highlightMoveDuration: 0
|
||||
ScrollBar.vertical: FluScrollBar {}
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
boundsBehavior:Flickable.StopAtBounds
|
||||
delegate: Loader{
|
||||
property var model: modelData
|
||||
property int type:2
|
||||
property int position:index
|
||||
sourceComponent: list_delegate
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
width: parent.width
|
||||
height: 1
|
||||
anchors.top: layout_content.bottom
|
||||
color: dividerColor
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
id:layout_actions
|
||||
height: 40
|
||||
radius: 5
|
||||
color: FluTheme.isDark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1)
|
||||
anchors{
|
||||
bottom:parent.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
|
||||
Item {
|
||||
id:divider
|
||||
width: 1
|
||||
height: parent.height
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
|
||||
FluButton{
|
||||
anchors{
|
||||
left: parent.left
|
||||
leftMargin: 20
|
||||
rightMargin: 10
|
||||
right: divider.left
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
text: "取消"
|
||||
onClicked: {
|
||||
popup.close()
|
||||
}
|
||||
}
|
||||
|
||||
FluFilledButton{
|
||||
anchors{
|
||||
right: parent.right
|
||||
left: divider.right
|
||||
rightMargin: 20
|
||||
leftMargin: 10
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
text: "确定"
|
||||
onClicked: {
|
||||
changeFlag = false
|
||||
popup.close()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
y:35
|
||||
function showPopup() {
|
||||
changeFlag = true
|
||||
rowData[0] = text_year.text
|
||||
rowData[1] = text_month.text
|
||||
rowData[2] = text_day.text
|
||||
|
||||
const now = new Date();
|
||||
var year = text_year.text === "年"? now.getFullYear() : Number(text_year.text);
|
||||
var month = text_month.text === "月"? now.getMonth() + 1 : Number(text_month.text);
|
||||
var day = text_day.text === "日" ? now.getDate() : Number(text_day.text);
|
||||
|
||||
list_view_1.currentIndex = list_view_1.model.indexOf(year)
|
||||
text_year.text = year
|
||||
|
||||
list_view_2.model = generateMonthArray(1,12)
|
||||
list_view_2.currentIndex = list_view_2.model.indexOf(month)
|
||||
text_month.text = month
|
||||
|
||||
list_view_3.model = generateMonthDaysArray(year,month)
|
||||
list_view_3.currentIndex = list_view_3.model.indexOf(day)
|
||||
text_day.text = day
|
||||
|
||||
var pos = root.mapToItem(null, 0, 0)
|
||||
if(window.height>pos.y+root.height+popup.height){
|
||||
popup.y = root.height
|
||||
} else if(pos.y>popup.height){
|
||||
popup.y = -popup.height
|
||||
} else {
|
||||
popup.y = window.height-(pos.y+popup.height)
|
||||
}
|
||||
popup.open()
|
||||
}
|
||||
|
||||
onClosed: {
|
||||
if(changeFlag){
|
||||
text_year.text = rowData[0]
|
||||
text_month.text = rowData[1]
|
||||
text_day.text = rowData[2]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
property bool changeFlag: true
|
||||
readonly property var rowData: ["","",""]
|
||||
|
||||
function generateYearArray(startYear, endYear) {
|
||||
const yearArray = [];
|
||||
for (let year = startYear; year <= endYear; year++) {
|
||||
yearArray.push(year);
|
||||
}
|
||||
return yearArray;
|
||||
}
|
||||
|
||||
function generateMonthArray(startMonth, endMonth) {
|
||||
const monthArray = [];
|
||||
for (let month = startMonth; month <= endMonth; month++) {
|
||||
monthArray.push(month);
|
||||
}
|
||||
return monthArray;
|
||||
}
|
||||
|
||||
function generateMonthDaysArray(year, month) {
|
||||
const monthDaysArray = [];
|
||||
const lastDayOfMonth = new Date(year, month, 0).getDate();
|
||||
for (let day = 1; day <= lastDayOfMonth; day++) {
|
||||
monthDaysArray.push(day);
|
||||
}
|
||||
return monthDaysArray;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -3,6 +3,6 @@ import FluentUI 1.0
|
||||
|
||||
Rectangle {
|
||||
|
||||
color: FluTheme.isDark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(238/255,238/255,238/255,1)
|
||||
color: FluTheme.isDark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,230/255,234/255,1)
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,89 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Window 2.15
|
||||
import FluentUI 1.0
|
||||
|
||||
Item {
|
||||
Button {
|
||||
|
||||
property bool disabled: false
|
||||
property color normalColor: FluTheme.isDark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(254/255,254/255,254/255,1)
|
||||
property color hoverColor: FluTheme.isDark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
|
||||
property color disableColor: FluTheme.isDark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(252/255,252/255,252/255,1)
|
||||
|
||||
id: control
|
||||
topPadding:5
|
||||
bottomPadding:5
|
||||
leftPadding:15
|
||||
rightPadding:35
|
||||
enabled: !disabled
|
||||
focusPolicy:Qt.TabFocus
|
||||
property var window : Window.window
|
||||
|
||||
property alias items: menu.content
|
||||
|
||||
Keys.onSpacePressed: control.visualFocus&&clicked()
|
||||
|
||||
background: Rectangle{
|
||||
border.color: FluTheme.isDark ? "#505050" : "#DFDFDF"
|
||||
border.width: 1
|
||||
radius: 4
|
||||
FluFocusRectangle{
|
||||
visible: control.visualFocus
|
||||
radius:8
|
||||
}
|
||||
color:{
|
||||
if(disabled){
|
||||
return disableColor
|
||||
}
|
||||
return hovered ? hoverColor :normalColor
|
||||
}
|
||||
FluIcon{
|
||||
iconSource:FluentIcons.ChevronDown
|
||||
iconSize: 15
|
||||
anchors{
|
||||
right: parent.right
|
||||
rightMargin: 10
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
color:title.color
|
||||
}
|
||||
|
||||
}
|
||||
contentItem: FluText {
|
||||
id:title
|
||||
text: control.text
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: {
|
||||
if(FluTheme.isDark){
|
||||
if(disabled){
|
||||
return Qt.rgba(131/255,131/255,131/255,1)
|
||||
}
|
||||
return Qt.rgba(1,1,1,1)
|
||||
}else{
|
||||
if(disabled){
|
||||
return Qt.rgba(160/255,160/255,160/255,1)
|
||||
}
|
||||
return Qt.rgba(0,0,0,1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
var pos = control.mapToItem(null, 0, 0)
|
||||
if(window.height>pos.y+control.height+menu.height){
|
||||
menu.y = control.height
|
||||
}else if(pos.y>menu.height){
|
||||
menu.y = -menu.height
|
||||
}else{
|
||||
popup.y = window.height-(pos.y+menu.height)
|
||||
}
|
||||
menu.open()
|
||||
}
|
||||
|
||||
FluMenu{
|
||||
id:menu
|
||||
width: control.width
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,6 +10,8 @@ Item {
|
||||
id:root
|
||||
height: layout_header.height + container.height
|
||||
width: 400
|
||||
implicitWidth: width
|
||||
implicitHeight: height
|
||||
|
||||
property int contentHeight : 300
|
||||
|
||||
@ -18,11 +20,10 @@ Item {
|
||||
Rectangle{
|
||||
id:layout_header
|
||||
width: parent.width
|
||||
height: 50
|
||||
height: 45
|
||||
radius: 4
|
||||
border.color: FluTheme.isDark ? Qt.rgba(53/255,53/255,53/255,1) : Qt.rgba(240/255,240/255,240/255,1)
|
||||
color: FluTheme.isDark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(254/255,254/255,254/255,1)
|
||||
|
||||
color: FluTheme.isDark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
|
||||
border.color: FluTheme.isDark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1)
|
||||
|
||||
MouseArea{
|
||||
id:root_mouse
|
||||
@ -48,10 +49,14 @@ Item {
|
||||
right: parent.right
|
||||
rightMargin: 15
|
||||
}
|
||||
hoverColor: FluTheme.isDark ? Qt.rgba(73/255,73/255,73/255,1) : Qt.rgba(245/255,245/255,245/255,1)
|
||||
normalColor: FluTheme.isDark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(254/255,254/255,254/255,1)
|
||||
hovered: root_mouse.containsMouse
|
||||
icon: expand ? FluentIcons.FA_angle_up : FluentIcons.FA_angle_down
|
||||
color:{
|
||||
if(root_mouse.containsMouse){
|
||||
return FluTheme.isDark ? Qt.rgba(73/255,73/255,73/255,1) : Qt.rgba(245/255,245/255,245/255,1)
|
||||
}
|
||||
return FluTheme.isDark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(254/255,254/255,254/255,1)
|
||||
}
|
||||
iconSize: 15
|
||||
iconSource: expand ? FluentIcons.ChevronUp : FluentIcons.ChevronDown
|
||||
onClicked: {
|
||||
expand = !expand
|
||||
}
|
||||
@ -69,8 +74,8 @@ Item {
|
||||
left: layout_header.left
|
||||
}
|
||||
radius: 4
|
||||
border.color: FluTheme.isDark ? Qt.rgba(53/255,53/255,53/255,1) : Qt.rgba(240/255,240/255,240/255,1)
|
||||
color: FluTheme.isDark ? Qt.rgba(57/255,57/255,57/255,1) : Qt.rgba(249/255,249/255,249/255,1)
|
||||
color: FluTheme.isDark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
|
||||
border.color: FluTheme.isDark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1)
|
||||
height: expand ? contentHeight : 0
|
||||
Behavior on height {
|
||||
NumberAnimation{
|
||||
|
@ -2,37 +2,38 @@
|
||||
import QtQuick.Controls 2.15
|
||||
import FluentUI 1.0
|
||||
|
||||
Rectangle {
|
||||
id: button
|
||||
Button {
|
||||
id: control
|
||||
|
||||
property string text: "Filled Button"
|
||||
property int startPadding : 15
|
||||
property int endPadding : 15
|
||||
property int topPadding: 5
|
||||
property int bottomPadding: 5
|
||||
property bool disabled: false
|
||||
property color normalColor: FluTheme.isDark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
||||
property color hoverColor: FluTheme.isDark ? Qt.darker(normalColor,1.1) : Qt.lighter(normalColor,1.1)
|
||||
property color disableColor: FluTheme.isDark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1)
|
||||
|
||||
signal clicked
|
||||
radius: 4
|
||||
color:{
|
||||
if(FluTheme.isDark){
|
||||
enabled: !disabled
|
||||
topPadding:5
|
||||
bottomPadding:5
|
||||
leftPadding:15
|
||||
rightPadding:15
|
||||
Keys.onSpacePressed: control.visualFocus&&clicked()
|
||||
focusPolicy:Qt.TabFocus
|
||||
background: Rectangle{
|
||||
radius: 4
|
||||
FluFocusRectangle{
|
||||
visible: control.visualFocus
|
||||
radius:8
|
||||
}
|
||||
color:{
|
||||
if(disabled){
|
||||
return Qt.rgba(199/255,199/255,199/255,1)
|
||||
return disableColor
|
||||
}
|
||||
return button_mouse.containsMouse ? Qt.darker(FluTheme.primaryColor.lighter,1.1) : FluTheme.primaryColor.lighter
|
||||
}else{
|
||||
if(disabled){
|
||||
return Qt.rgba(199/255,199/255,199/255,1)
|
||||
}
|
||||
return button_mouse.containsMouse ? Qt.lighter(FluTheme.primaryColor.dark,1.1): FluTheme.primaryColor.dark
|
||||
return hovered ? hoverColor :normalColor
|
||||
}
|
||||
}
|
||||
width: button_text.implicitWidth
|
||||
height: button_text.implicitHeight
|
||||
|
||||
FluText {
|
||||
id: button_text
|
||||
text: button.text
|
||||
contentItem: FluText {
|
||||
text: control.text
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: {
|
||||
if(FluTheme.isDark){
|
||||
if(disabled){
|
||||
@ -44,21 +45,5 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
font.pixelSize: 14
|
||||
leftPadding: button.startPadding
|
||||
rightPadding: button.endPadding
|
||||
topPadding: button.topPadding
|
||||
bottomPadding: button.bottomPadding
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id:button_mouse
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
if(disabled)
|
||||
return
|
||||
button.clicked()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
22
src/controls/FluFocusRectangle.qml
Normal file
@ -0,0 +1,22 @@
|
||||
import QtQuick 2.15
|
||||
import FluentUI 1.0
|
||||
|
||||
Item {
|
||||
id:root
|
||||
anchors.fill: parent
|
||||
anchors.margins: -3
|
||||
|
||||
property var radius: 4
|
||||
|
||||
Rectangle{
|
||||
width: root.width
|
||||
height: root.height
|
||||
anchors.centerIn: parent
|
||||
color: "#00000000"
|
||||
border.width: 3
|
||||
radius: root.radius
|
||||
border.color: FluTheme.isDark ? Qt.rgba(1,1,1,1) : Qt.rgba(0,0,0,1)
|
||||
z: 65535
|
||||
}
|
||||
|
||||
}
|
@ -2,15 +2,15 @@
|
||||
|
||||
Text {
|
||||
|
||||
property int icon
|
||||
property int iconSource
|
||||
property int iconSize: 20
|
||||
property color iconColor: FluTheme.isDark ? "#FFFFFF" : "#000000"
|
||||
|
||||
id:text_icon
|
||||
font.family: "fontawesome"
|
||||
font.family: "Segoe Fluent Icons"
|
||||
font.pixelSize: iconSize
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: iconColor
|
||||
text: (String.fromCharCode(icon).toString(16));
|
||||
text: (String.fromCharCode(iconSource).toString(16));
|
||||
}
|
||||
|
@ -1,23 +1,21 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import FluentUI 1.0
|
||||
|
||||
Rectangle {
|
||||
|
||||
id:button
|
||||
width: 30
|
||||
height: 30
|
||||
Button {
|
||||
|
||||
property int iconSize: 20
|
||||
property int icon
|
||||
property alias text: tool_tip.text
|
||||
signal clicked
|
||||
property int iconSource
|
||||
property bool disabled: false
|
||||
property bool hovered: button_mouse.containsMouse
|
||||
|
||||
property color hoverColor: FluTheme.isDark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(244/255,244/255,244/255,1)
|
||||
property color normalColor: FluTheme.isDark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(1,1,1,1)
|
||||
property color disableColor: FluTheme.isDark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(1,1,1,1)
|
||||
|
||||
property color hoverColor: FluTheme.isDark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(0,0,0,0.03)
|
||||
property color normalColor: FluTheme.isDark ? Qt.rgba(0,0,0,0) : Qt.rgba(0,0,0,0)
|
||||
property color disableColor: FluTheme.isDark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(0,0,0,0)
|
||||
property color color: {
|
||||
if(disabled){
|
||||
return disableColor
|
||||
}
|
||||
return hovered ? hoverColor : normalColor
|
||||
}
|
||||
property color textColor: {
|
||||
if(FluTheme.isDark){
|
||||
if(disabled){
|
||||
@ -31,45 +29,46 @@ Rectangle {
|
||||
return Qt.rgba(0,0,0,1)
|
||||
}
|
||||
}
|
||||
radius: 4
|
||||
|
||||
color: {
|
||||
if(disabled){
|
||||
return disableColor
|
||||
}
|
||||
return (hovered || button_mouse.containsMouse) ? hoverColor : normalColor
|
||||
}
|
||||
|
||||
Text {
|
||||
id:text_icon
|
||||
font.family: "fontawesome"
|
||||
font.pixelSize: iconSize
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
anchors.centerIn: parent
|
||||
color:button.textColor
|
||||
text: (String.fromCharCode(icon).toString(16));
|
||||
}
|
||||
|
||||
MouseArea{
|
||||
id:button_mouse
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
enabled: !disabled
|
||||
onClicked: {
|
||||
button.clicked()
|
||||
id:control
|
||||
width: 30
|
||||
height: 30
|
||||
implicitWidth: width
|
||||
implicitHeight: height
|
||||
padding: 0
|
||||
enabled: !disabled
|
||||
focusPolicy:Qt.TabFocus
|
||||
Keys.onSpacePressed: control.visualFocus&&clicked()
|
||||
background: Rectangle{
|
||||
radius: 4
|
||||
color:control.color
|
||||
FluFocusRectangle{
|
||||
visible: control.visualFocus
|
||||
}
|
||||
}
|
||||
|
||||
FluTooltip{
|
||||
id:tool_tip
|
||||
visible: {
|
||||
if(button.text === ""){
|
||||
return false
|
||||
contentItem: Item{
|
||||
Text {
|
||||
id:text_icon
|
||||
font.family: "Segoe Fluent Icons"
|
||||
font.pixelSize: iconSize
|
||||
width: iconSize
|
||||
height: iconSize
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
anchors.centerIn: parent
|
||||
color:control.textColor
|
||||
text: (String.fromCharCode(iconSource).toString(16));
|
||||
}
|
||||
FluTooltip{
|
||||
id:tool_tip
|
||||
visible: {
|
||||
if(control.text === ""){
|
||||
return false
|
||||
}
|
||||
return hovered
|
||||
}
|
||||
return (hovered || button_mouse.containsMouse)
|
||||
text:control.text
|
||||
delay: 1000
|
||||
}
|
||||
delay: 1000
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -190,13 +190,13 @@ FluObject {
|
||||
spacing: 10
|
||||
|
||||
FluIcon{
|
||||
icon:{
|
||||
iconSource:{
|
||||
switch(_super.type){
|
||||
case mcontrol.const_success: return FluentIcons.FA_check_circle;
|
||||
case mcontrol.const_warning: return FluentIcons.FA_info_circle;
|
||||
case mcontrol.const_info: return FluentIcons.FA_info_circle;
|
||||
case mcontrol.const_error: return FluentIcons.FA_times_circle;
|
||||
}
|
||||
case mcontrol.const_success: return FluentIcons.CompletedSolid;
|
||||
case mcontrol.const_warning: return FluentIcons.InfoSolid;
|
||||
case mcontrol.const_info: return FluentIcons.InfoSolid;
|
||||
case mcontrol.const_error: return FluentIcons.StatusErrorFull;
|
||||
}FluentIcons.StatusErrorFull
|
||||
return FluentIcons.FA_info_circle
|
||||
}
|
||||
iconSize:20
|
||||
|
@ -1,16 +1,27 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtGraphicalEffects 1.15
|
||||
|
||||
Popup {
|
||||
Menu {
|
||||
id: popup
|
||||
default property alias content: container.children
|
||||
default property alias content: container.data
|
||||
|
||||
background: Rectangle {
|
||||
implicitWidth: 140
|
||||
implicitHeight: container.height
|
||||
color:FluTheme.isDark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(237/255,237/255,237/255,1)
|
||||
radius: 5
|
||||
width: 140
|
||||
height: container.height
|
||||
|
||||
background: Item {
|
||||
|
||||
Rectangle{
|
||||
anchors.fill: parent
|
||||
color:FluTheme.isDark ? Qt.rgba(45/255,45/255,45/255,0.97) : Qt.rgba(237/255,237/255,237/255,0.97)
|
||||
radius: 5
|
||||
layer.enabled: true
|
||||
layer.effect: GaussianBlur {
|
||||
radius: 8
|
||||
samples: 16
|
||||
}
|
||||
}
|
||||
|
||||
FluShadow{
|
||||
radius: 5
|
||||
@ -19,6 +30,7 @@ Popup {
|
||||
spacing: 5
|
||||
topPadding: 5
|
||||
bottomPadding: 5
|
||||
width: popup.width
|
||||
id:container
|
||||
function closePopup(){
|
||||
popup.close()
|
||||
|
@ -4,7 +4,12 @@ import QtQuick.Controls 2.15
|
||||
Item {
|
||||
|
||||
id:root
|
||||
width: 140
|
||||
width: {
|
||||
if(root.parent){
|
||||
return root.parent.width
|
||||
}
|
||||
return 140
|
||||
}
|
||||
height: 32
|
||||
|
||||
property string text: "MenuItem"
|
||||
@ -12,14 +17,21 @@ Item {
|
||||
|
||||
Rectangle{
|
||||
anchors.centerIn: parent
|
||||
width: 100
|
||||
width: root.width-40
|
||||
height: 32
|
||||
radius: 4
|
||||
color:{
|
||||
if(mouse_area.containsMouse){
|
||||
return FluTheme.isDark ? Qt.rgba(56/255,56/255,56/255,1) : Qt.rgba(230/255,230/255,230/255,1)
|
||||
if(FluTheme.isDark){
|
||||
if(mouse_area.containsMouse){
|
||||
return Qt.rgba(1,1,1,0.05)
|
||||
}
|
||||
return Qt.rgba(0,0,0,0)
|
||||
}else{
|
||||
if(mouse_area.containsMouse){
|
||||
return Qt.rgba(0,0,0,0.05)
|
||||
}
|
||||
return Qt.rgba(0,0,0,0)
|
||||
}
|
||||
return FluTheme.isDark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(237/255,237/255,237/255,1)
|
||||
}
|
||||
|
||||
FluText{
|
||||
|
@ -3,10 +3,15 @@ import QtQuick.Controls 2.15
|
||||
import FluentUI 1.0
|
||||
|
||||
TextArea{
|
||||
|
||||
property int fontStyle: FluText.Body
|
||||
property int pixelSize : FluTheme.textSize
|
||||
|
||||
id:input
|
||||
width: 300
|
||||
color: FluTheme.isDark ? "#FFFFFF" : "#1A1A1A"
|
||||
wrapMode: Text.WrapAnywhere
|
||||
renderType: FluTheme.isNativeText ? Text.NativeRendering : Text.QtRendering
|
||||
selectByMouse: true
|
||||
selectionColor: {
|
||||
if(FluTheme.isDark){
|
||||
@ -18,5 +23,57 @@ TextArea{
|
||||
background: FluTextBoxBackground{
|
||||
inputItem: input
|
||||
}
|
||||
placeholderTextColor: {
|
||||
if(focus){
|
||||
return FluTheme.isDark ? Qt.rgba(152/255,152/255,152/255,1) : Qt.rgba(141/255,141/255,141/255,1)
|
||||
}
|
||||
return FluTheme.isDark ? Qt.rgba(210/255,210/255,210/255,1) : Qt.rgba(96/255,96/255,96/255,1)
|
||||
}
|
||||
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.BodyLarge:
|
||||
return false
|
||||
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 input.pixelSize * 4
|
||||
case FluText.TitleLarge:
|
||||
return input.pixelSize * 2
|
||||
case FluText.Title:
|
||||
return input.pixelSize * 1.5
|
||||
case FluText.Subtitle:
|
||||
return input.pixelSize * 0.9
|
||||
case FluText.BodyLarge:
|
||||
return input.pixelSize * 1.1
|
||||
case FluText.BodyStrong:
|
||||
return input.pixelSize * 1.0
|
||||
case FluText.Body:
|
||||
return input.pixelSize * 1.0
|
||||
case FluText.Caption:
|
||||
return input.pixelSize * 0.8
|
||||
default:
|
||||
return input.pixelSize * 1.0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
393
src/controls/FluNavigationView.qml
Normal file
@ -0,0 +1,393 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Window 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
|
||||
import FluentUI 1.0
|
||||
|
||||
Item {
|
||||
|
||||
id:root
|
||||
|
||||
property FluObject items
|
||||
property FluObject footerItems
|
||||
|
||||
property int displayMode: width<=700 ? FluNavigationView.Minimal : FluNavigationView.Open
|
||||
|
||||
property bool displaMinimalNav : false
|
||||
|
||||
onDisplayModeChanged: {
|
||||
if(displayMode === FluNavigationView.Minimal){
|
||||
anim_navi.enabled = false
|
||||
displaMinimalNav = false
|
||||
timer_anim_enable.restart()
|
||||
}
|
||||
}
|
||||
|
||||
Timer{
|
||||
id:timer_anim_enable
|
||||
interval: 150
|
||||
onTriggered: {
|
||||
anim_navi.enabled = true
|
||||
}
|
||||
}
|
||||
|
||||
enum DisplayMode {
|
||||
Minimal,
|
||||
Open,
|
||||
Auto
|
||||
}
|
||||
|
||||
property var window : {
|
||||
if(Window.window == null)
|
||||
return null
|
||||
return Window.window
|
||||
}
|
||||
|
||||
Component{
|
||||
id:com_panel_item_separatorr
|
||||
FluDivider{
|
||||
width: nav_list.width
|
||||
height: 1
|
||||
}
|
||||
}
|
||||
|
||||
Component{
|
||||
id:com_panel_item_header
|
||||
Item{
|
||||
height: 30
|
||||
width: nav_list.width
|
||||
FluText{
|
||||
text:model.title
|
||||
fontStyle: FluText.BodyStrong
|
||||
anchors{
|
||||
bottom: parent.bottom
|
||||
left:parent.left
|
||||
leftMargin: 10
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component{
|
||||
id:com_panel_item
|
||||
Item{
|
||||
height: 38
|
||||
width: nav_list.width
|
||||
|
||||
Rectangle{
|
||||
radius: 4
|
||||
anchors{
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
topMargin: 2
|
||||
bottomMargin: 2
|
||||
leftMargin: 6
|
||||
rightMargin: 6
|
||||
}
|
||||
MouseArea{
|
||||
id:item_mouse
|
||||
hoverEnabled: true
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
if(type===0){
|
||||
model.repTap()
|
||||
if(nav_list.currentIndex !== position){
|
||||
nav_list.currentIndex = position
|
||||
model.tap()
|
||||
}
|
||||
}else{
|
||||
model.tap()
|
||||
}
|
||||
}
|
||||
}
|
||||
color: {
|
||||
if(FluTheme.isDark){
|
||||
if(item_mouse.containsMouse){
|
||||
return Qt.rgba(1,1,1,0.03)
|
||||
}
|
||||
if((nav_list.currentIndex === position)&&type===0){
|
||||
return Qt.rgba(1,1,1,0.06)
|
||||
}
|
||||
return Qt.rgba(0,0,0,0)
|
||||
}else{
|
||||
if(item_mouse.containsMouse){
|
||||
return Qt.rgba(0,0,0,0.03)
|
||||
}
|
||||
if(nav_list.currentIndex === position&&type===0){
|
||||
return Qt.rgba(0,0,0,0.06)
|
||||
}
|
||||
return Qt.rgba(0,0,0,0)
|
||||
}
|
||||
}
|
||||
|
||||
FluText{
|
||||
text:model.title
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left:parent.left
|
||||
leftMargin: 14
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id:nav_app_bar
|
||||
width: parent.width
|
||||
height: 38
|
||||
z:999
|
||||
RowLayout{
|
||||
height:parent.height
|
||||
spacing: 0
|
||||
FluIconButton{
|
||||
iconSource: FluentIcons.ChromeBack
|
||||
Layout.leftMargin: 5
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
disabled: nav_swipe.depth === 1
|
||||
iconSize: 13
|
||||
onClicked: {
|
||||
nav_swipe.pop()
|
||||
nav_list.stackIndex.pop()
|
||||
var index = nav_list.stackIndex[nav_list.stackIndex.length-1]
|
||||
nav_list.enableStack = false
|
||||
nav_list.currentIndex = index
|
||||
nav_list.enableStack = true
|
||||
}
|
||||
}
|
||||
FluIconButton{
|
||||
iconSource: FluentIcons.GlobalNavButton
|
||||
Layout.leftMargin: 5
|
||||
iconSize: 15
|
||||
visible: displayMode === FluNavigationView.Minimal
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
onClicked: {
|
||||
displaMinimalNav = !displaMinimalNav
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RowLayout{
|
||||
anchors{
|
||||
right: parent.right
|
||||
rightMargin: 14
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
spacing: 5
|
||||
FluText{
|
||||
text:"夜间模式"
|
||||
fontStyle: FluText.Body
|
||||
}
|
||||
FluToggleSwitch{
|
||||
selected: FluTheme.isDark
|
||||
clickFunc:function(){
|
||||
FluTheme.isDark = !FluTheme.isDark
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item{
|
||||
anchors{
|
||||
left: displayMode === FluNavigationView.Minimal ? parent.left : layout_list.right
|
||||
leftMargin: 10
|
||||
top: nav_app_bar.bottom
|
||||
right: parent.right
|
||||
rightMargin: 10
|
||||
bottom: parent.bottom
|
||||
bottomMargin: 20
|
||||
}
|
||||
|
||||
StackView{
|
||||
id:nav_swipe
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
popEnter : Transition{}
|
||||
popExit : Transition {
|
||||
NumberAnimation { properties: "y"; from: 0; to: nav_swipe.height; duration: 200 }
|
||||
}
|
||||
pushEnter: Transition {
|
||||
NumberAnimation { properties: "y"; from: nav_swipe.height; to: 0; duration: 200 }
|
||||
}
|
||||
pushExit : Transition{}
|
||||
replaceEnter : Transition{}
|
||||
replaceExit : Transition{}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
enabled: (displayMode === FluNavigationView.Minimal && displaMinimalNav)
|
||||
onClicked: {
|
||||
displaMinimalNav = false
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
id:layout_list
|
||||
width: 300
|
||||
anchors{
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
}
|
||||
x: {
|
||||
if(displayMode !== FluNavigationView.Minimal)
|
||||
return 0
|
||||
return (displayMode === FluNavigationView.Minimal && displaMinimalNav) ? 0 : -width
|
||||
}
|
||||
Behavior on x{
|
||||
id:anim_navi
|
||||
NumberAnimation{
|
||||
duration: 150
|
||||
}
|
||||
}
|
||||
color: {
|
||||
if(displayMode === FluNavigationView.Minimal){
|
||||
return FluTheme.isDark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(243/255,243/255,243/255,1)
|
||||
}
|
||||
if(window && window.active){
|
||||
return FluTheme.isDark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(238/255,244/255,249/255,1)
|
||||
}
|
||||
return FluTheme.isDark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1)
|
||||
}
|
||||
Behavior on color{
|
||||
ColorAnimation {
|
||||
duration: 300
|
||||
}
|
||||
}
|
||||
|
||||
Item{
|
||||
id:layout_header
|
||||
width: layout_list.width
|
||||
y:nav_app_bar.height
|
||||
height: 50
|
||||
|
||||
FluAutoSuggestBox{
|
||||
width: 280
|
||||
anchors.centerIn: parent
|
||||
iconSource: FluentIcons.Zoom
|
||||
values: {
|
||||
var arr = []
|
||||
if(items==null)
|
||||
return arr
|
||||
if(items.children==null)
|
||||
return arr
|
||||
for(var i=0;i<items.children.length;i++){
|
||||
var item = items.children[i]
|
||||
if(item instanceof FluPaneItem){
|
||||
arr.push(item.title)
|
||||
}
|
||||
}
|
||||
return arr
|
||||
}
|
||||
placeholderText: "查找"
|
||||
onItemClicked:
|
||||
(data)=>{
|
||||
var arr = []
|
||||
if(items==null)
|
||||
return arr
|
||||
if(items.children==null)
|
||||
return arr
|
||||
for(var i=0;i<items.children.length;i++){
|
||||
if(items.children[i].title === data){
|
||||
if(nav_list.currentIndex === i){
|
||||
return
|
||||
}
|
||||
items.children[i].tap()
|
||||
nav_list.currentIndex = i
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ListView{
|
||||
id:nav_list
|
||||
property bool enableStack: true
|
||||
property var stackIndex: []
|
||||
clip: true
|
||||
anchors{
|
||||
top: layout_header.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: layout_footer.top
|
||||
}
|
||||
currentIndex: -1
|
||||
onCurrentIndexChanged: {
|
||||
if(enableStack){
|
||||
stackIndex.push(currentIndex)
|
||||
}
|
||||
}
|
||||
ScrollBar.vertical: FluScrollBar {}
|
||||
|
||||
model:{
|
||||
if(items){
|
||||
return items.children
|
||||
}
|
||||
}
|
||||
boundsBehavior: ListView.StopAtBounds
|
||||
delegate: Loader{
|
||||
property var model: modelData
|
||||
property var position: index
|
||||
property int type: 0
|
||||
sourceComponent: {
|
||||
if(modelData instanceof FluPaneItem){
|
||||
return com_panel_item
|
||||
}
|
||||
if(modelData instanceof FluPaneItemHeader){
|
||||
return com_panel_item_header
|
||||
}
|
||||
if(modelData instanceof FluPaneItemSeparator){
|
||||
return com_panel_item_separatorr
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ListView{
|
||||
id:layout_footer
|
||||
width: layout_list.width
|
||||
height: childrenRect.height
|
||||
anchors.bottom: parent.bottom
|
||||
boundsBehavior: ListView.StopAtBounds
|
||||
model: {
|
||||
if(footerItems){
|
||||
return footerItems.children
|
||||
}
|
||||
}
|
||||
currentIndex: -1
|
||||
delegate: Loader{
|
||||
property var model: modelData
|
||||
property var position: index
|
||||
property int type: 1
|
||||
sourceComponent: {
|
||||
if(modelData instanceof FluPaneItem){
|
||||
return com_panel_item
|
||||
}
|
||||
if(modelData instanceof FluPaneItemHeader){
|
||||
return com_panel_item_header
|
||||
}
|
||||
if(modelData instanceof FluPaneItemSeparator){
|
||||
return com_panel_item_separatorr
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function push(url){
|
||||
nav_swipe.push(url)
|
||||
}
|
||||
|
||||
function setCurrentIndex(index){
|
||||
nav_list.currentIndex = index
|
||||
}
|
||||
|
||||
}
|
7
src/controls/FluPaneItem.qml
Normal file
@ -0,0 +1,7 @@
|
||||
import QtQuick 2.15
|
||||
|
||||
QtObject {
|
||||
property string title
|
||||
signal tap
|
||||
signal repTap
|
||||
}
|
5
src/controls/FluPaneItemHeader.qml
Normal file
@ -0,0 +1,5 @@
|
||||
import QtQuick 2.15
|
||||
|
||||
QtObject {
|
||||
property string title
|
||||
}
|
5
src/controls/FluPaneItemSeparator.qml
Normal file
@ -0,0 +1,5 @@
|
||||
import QtQuick 2.15
|
||||
|
||||
QtObject {
|
||||
|
||||
}
|
@ -1,19 +1,25 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import FluentUI 1.0
|
||||
|
||||
|
||||
Item {
|
||||
Button {
|
||||
|
||||
id:root
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
property bool checked: false
|
||||
property string text: "RodioButton"
|
||||
signal clicked
|
||||
property bool selected: false
|
||||
property bool disabled: false
|
||||
|
||||
RowLayout{
|
||||
id:control
|
||||
enabled: !disabled
|
||||
focusPolicy:Qt.TabFocus
|
||||
padding:0
|
||||
background: Item{
|
||||
FluFocusRectangle{
|
||||
visible: control.visualFocus
|
||||
}
|
||||
}
|
||||
Keys.onSpacePressed: control.visualFocus&&clicked()
|
||||
contentItem: RowLayout{
|
||||
Rectangle{
|
||||
id:rect_check
|
||||
width: 20
|
||||
@ -23,26 +29,26 @@ Item {
|
||||
layer.enabled: true
|
||||
layer.smooth: true
|
||||
border.width: {
|
||||
if(checked&&disabled){
|
||||
if(selected&&disabled){
|
||||
return 3
|
||||
}
|
||||
if(root_mouse.containsPress){
|
||||
if(checked){
|
||||
if(pressed){
|
||||
if(selected){
|
||||
return 5
|
||||
}
|
||||
return 1
|
||||
}
|
||||
if(root_mouse.containsMouse){
|
||||
if(checked){
|
||||
if(hovered){
|
||||
if(selected){
|
||||
return 3
|
||||
}
|
||||
return 1
|
||||
}
|
||||
return checked ? 5 : 1
|
||||
return selected ? 5 : 1
|
||||
}
|
||||
Behavior on border.width {
|
||||
NumberAnimation{
|
||||
duration: 100
|
||||
duration: 150
|
||||
}
|
||||
}
|
||||
border.color: {
|
||||
@ -53,7 +59,7 @@ Item {
|
||||
return Qt.rgba(198/255,198/255,198/255,1)
|
||||
}
|
||||
}
|
||||
if(checked){
|
||||
if(selected){
|
||||
if(FluTheme.isDark){
|
||||
return FluTheme.primaryColor.lighter
|
||||
}else{
|
||||
@ -70,17 +76,17 @@ Item {
|
||||
}
|
||||
}
|
||||
color:{
|
||||
if(disabled&&checked){
|
||||
if(disabled&&selected){
|
||||
return Qt.rgba(159/255,159/255,159/255,1)
|
||||
}
|
||||
if(FluTheme.isDark){
|
||||
if(root_mouse.containsMouse){
|
||||
if(hovered){
|
||||
return Qt.rgba(43/255,43/255,43/255,1)
|
||||
}
|
||||
return Qt.rgba(50/255,50/255,50/255,1)
|
||||
}else{
|
||||
if(root_mouse.containsMouse){
|
||||
if(checked){
|
||||
if(hovered){
|
||||
if(selected){
|
||||
return Qt.rgba(1,1,1,1)
|
||||
}
|
||||
return Qt.rgba(222/255,222/255,222/255,1)
|
||||
@ -89,23 +95,10 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FluText{
|
||||
text: root.text
|
||||
text: control.text
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MouseArea{
|
||||
id:root_mouse
|
||||
hoverEnabled: true
|
||||
anchors.fill: parent
|
||||
enabled: !disabled
|
||||
onClicked: {
|
||||
root.clicked()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ Item{
|
||||
property color borderColor:"red"
|
||||
property int borderWidth: 1
|
||||
property bool shadow: true
|
||||
default property alias contentItem: container.children
|
||||
default property alias contentItem: container.data
|
||||
|
||||
Rectangle{
|
||||
id:container
|
||||
|
37
src/controls/FluScrollablePage.qml
Normal file
@ -0,0 +1,37 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtQuick.Window 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import FluentUI 1.0
|
||||
|
||||
Item {
|
||||
|
||||
id:root
|
||||
|
||||
property alias title: text_title.text
|
||||
default property alias content: container.data
|
||||
property int spacing : 5
|
||||
|
||||
FluText{
|
||||
id:text_title
|
||||
fontStyle: FluText.TitleLarge
|
||||
}
|
||||
|
||||
Flickable{
|
||||
clip: true
|
||||
width: parent.width
|
||||
contentWidth: parent.width
|
||||
contentHeight: container.height
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
ScrollBar.vertical: ScrollBar { }
|
||||
anchors{
|
||||
top: text_title.bottom
|
||||
bottom: parent.bottom
|
||||
}
|
||||
ColumnLayout{
|
||||
id:container
|
||||
spacing: root.spacing
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@ Item {
|
||||
anchors.margins: -4
|
||||
property color color: FluTheme.isDark ? "#FFFFFF" : "#000000"
|
||||
|
||||
property var radius: 4
|
||||
property int radius: 4
|
||||
|
||||
Rectangle{
|
||||
width: root.width
|
||||
|
@ -6,8 +6,10 @@ Item{
|
||||
|
||||
id:root
|
||||
|
||||
property int lineWidth: 5
|
||||
property int dotSize: 26
|
||||
property int lineSize: 5
|
||||
property int size: 180
|
||||
property int dotSize: 28
|
||||
|
||||
property int value: 50
|
||||
|
||||
enum Orientation {
|
||||
@ -22,6 +24,8 @@ Item{
|
||||
|
||||
property bool isHorizontal: orientation === FluSlider.Horizontal
|
||||
|
||||
rotation: isHorizontal ? 0 : 180
|
||||
|
||||
Component.onCompleted: {
|
||||
if(isHorizontal){
|
||||
dot.x =value/100*control.width - dotSize/2
|
||||
@ -38,8 +42,8 @@ Item{
|
||||
|
||||
FluRectangle {
|
||||
id: control
|
||||
width: isHorizontal ? 200 : root.lineWidth
|
||||
height: isHorizontal ? root.lineWidth : 200
|
||||
width: isHorizontal ? size : root.lineSize
|
||||
height: isHorizontal ? root.lineSize : size
|
||||
radius: [3,3,3,3]
|
||||
clip: true
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@ -101,6 +105,7 @@ Item{
|
||||
FluTooltip{
|
||||
id:tool_tip
|
||||
text:String(root.value)
|
||||
y: isHorizontal ? -40 : 32
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,9 @@ import FluentUI 1.0
|
||||
|
||||
Text {
|
||||
|
||||
id:text
|
||||
property int fontStyle: FluText.Body
|
||||
property color textColor: FluTheme.isDark ? "#FFFFFF" : "#1A1A1A"
|
||||
property int pixelSize : FluTheme.textSize
|
||||
|
||||
enum FontStyle {
|
||||
Display,
|
||||
@ -16,12 +18,9 @@ Text {
|
||||
Caption
|
||||
}
|
||||
|
||||
property int fontStyle: FluText.Body
|
||||
property color textColor: FluTheme.isDark ? "#FFFFFF" : "#1A1A1A"
|
||||
property int pixelSize : 14
|
||||
|
||||
id:text
|
||||
color: textColor
|
||||
|
||||
renderType: FluTheme.isNativeText ? Text.NativeRendering : Text.QtRendering
|
||||
font.bold: {
|
||||
switch (fontStyle) {
|
||||
case FluText.Display:
|
||||
@ -44,7 +43,6 @@ Text {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
font.pixelSize: {
|
||||
switch (fontStyle) {
|
||||
case FluText.Display:
|
||||
@ -68,5 +66,4 @@ Text {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -3,9 +3,14 @@ import QtQuick.Controls 2.15
|
||||
import FluentUI 1.0
|
||||
|
||||
TextField{
|
||||
|
||||
property int fontStyle: FluText.Body
|
||||
property int pixelSize : FluTheme.textSize
|
||||
|
||||
id:input
|
||||
width: 300
|
||||
color: FluTheme.isDark ? "#FFFFFF" : "#1A1A1A"
|
||||
renderType: FluTheme.isNativeText ? Text.NativeRendering : Text.QtRendering
|
||||
selectionColor: {
|
||||
if(FluTheme.isDark){
|
||||
return FluTheme.primaryColor.lighter
|
||||
@ -13,6 +18,56 @@ TextField{
|
||||
return FluTheme.primaryColor.dark
|
||||
}
|
||||
}
|
||||
placeholderTextColor: {
|
||||
if(focus){
|
||||
return FluTheme.isDark ? Qt.rgba(152/255,152/255,152/255,1) : Qt.rgba(141/255,141/255,141/255,1)
|
||||
}
|
||||
return FluTheme.isDark ? Qt.rgba(210/255,210/255,210/255,1) : Qt.rgba(96/255,96/255,96/255,1)
|
||||
}
|
||||
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.BodyLarge:
|
||||
return false
|
||||
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 input.pixelSize * 4
|
||||
case FluText.TitleLarge:
|
||||
return input.pixelSize * 2
|
||||
case FluText.Title:
|
||||
return input.pixelSize * 1.5
|
||||
case FluText.Subtitle:
|
||||
return input.pixelSize * 0.9
|
||||
case FluText.BodyLarge:
|
||||
return input.pixelSize * 1.1
|
||||
case FluText.BodyStrong:
|
||||
return input.pixelSize * 1.0
|
||||
case FluText.Body:
|
||||
return input.pixelSize * 1.0
|
||||
case FluText.Caption:
|
||||
return input.pixelSize * 0.8
|
||||
default:
|
||||
return input.pixelSize * 1.0
|
||||
}
|
||||
}
|
||||
selectByMouse: true
|
||||
background: FluTextBoxBackground{
|
||||
inputItem: input
|
||||
|
@ -9,6 +9,9 @@ Rectangle{
|
||||
radius: 4
|
||||
layer.enabled: true
|
||||
color: {
|
||||
if(input.focus){
|
||||
return FluTheme.isDark ? Qt.rgba(36/255,36/255,36/255,1) : Qt.rgba(1,1,1,1)
|
||||
}
|
||||
if(input.hovered){
|
||||
return FluTheme.isDark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
|
||||
}
|
||||
|
@ -1,8 +1,393 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Shapes 1.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtQuick.Window 2.15
|
||||
import FluentUI 1.0
|
||||
|
||||
Item {
|
||||
Rectangle {
|
||||
|
||||
id:root
|
||||
|
||||
property color dividerColor: FluTheme.isDark ? Qt.rgba(77/255,77/255,77/255,1) : Qt.rgba(239/255,239/255,239/255,1)
|
||||
property color hoverColor: FluTheme.isDark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
|
||||
property color normalColor: FluTheme.isDark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(254/255,254/255,254/255,1)
|
||||
property var window : Window.window
|
||||
|
||||
property int hourFormat: FluTimePicker.H
|
||||
|
||||
property int isH: hourFormat === FluTimePicker.H
|
||||
|
||||
enum HourFormat {
|
||||
H,
|
||||
HH
|
||||
}
|
||||
|
||||
color: {
|
||||
if(mouse_area.containsMouse){
|
||||
return hoverColor
|
||||
}
|
||||
return normalColor
|
||||
}
|
||||
height: 30
|
||||
width: 300
|
||||
radius: 4
|
||||
border.width: 1
|
||||
border.color: dividerColor
|
||||
|
||||
MouseArea{
|
||||
id:mouse_area
|
||||
hoverEnabled: true
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
popup.showPopup()
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
id:divider_1
|
||||
width: 1
|
||||
x: isH ? parent.width/3 : parent.width/2
|
||||
height: parent.height
|
||||
color: dividerColor
|
||||
}
|
||||
|
||||
|
||||
Rectangle{
|
||||
id:divider_2
|
||||
width: 1
|
||||
x:parent.width*2/3
|
||||
height: parent.height
|
||||
color: dividerColor
|
||||
visible: isH
|
||||
}
|
||||
|
||||
FluText{
|
||||
id:text_hour
|
||||
anchors{
|
||||
left: parent.left
|
||||
right: divider_1.left
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
}
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text:"时"
|
||||
}
|
||||
|
||||
|
||||
FluText{
|
||||
id:text_minute
|
||||
anchors{
|
||||
left: divider_1.right
|
||||
right: isH ? divider_2.left : parent.right
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
}
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text:"分"
|
||||
}
|
||||
|
||||
|
||||
FluText{
|
||||
id:text_ampm
|
||||
visible: isH
|
||||
anchors{
|
||||
left: divider_2.right
|
||||
right: parent.right
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
}
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text:"AM/PM"
|
||||
}
|
||||
|
||||
Popup{
|
||||
id:popup
|
||||
background: Rectangle{
|
||||
width: 300
|
||||
radius: 4
|
||||
color: FluTheme.isDark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1)
|
||||
height: 340
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
}
|
||||
FluShadow{
|
||||
radius: 4
|
||||
}
|
||||
|
||||
RowLayout{
|
||||
id:layout_content
|
||||
spacing: 0
|
||||
width: parent.width
|
||||
height: 300
|
||||
|
||||
Component{
|
||||
id:list_delegate
|
||||
|
||||
Item{
|
||||
height:38
|
||||
width:getListView().width
|
||||
|
||||
function getListView(){
|
||||
if(type === 0)
|
||||
return list_view_1
|
||||
if(type === 1)
|
||||
return list_view_2
|
||||
if(type === 2)
|
||||
return list_view_3
|
||||
}
|
||||
|
||||
|
||||
Rectangle{
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: 2
|
||||
anchors.bottomMargin: 2
|
||||
anchors.leftMargin: 5
|
||||
anchors.rightMargin: 5
|
||||
color: {
|
||||
if(getListView().currentIndex === position){
|
||||
if(FluTheme.isDark){
|
||||
return item_mouse.containsMouse ? Qt.darker(FluTheme.primaryColor.lighter,1.1) : FluTheme.primaryColor.lighter
|
||||
}else{
|
||||
return item_mouse.containsMouse ? Qt.lighter(FluTheme.primaryColor.dark,1.1): FluTheme.primaryColor.dark
|
||||
}
|
||||
}
|
||||
if(item_mouse.containsMouse){
|
||||
return FluTheme.isDark ? Qt.rgba(63/255,60/255,61/255,1) : Qt.rgba(237/255,237/255,242/255,1)
|
||||
}
|
||||
return FluTheme.isDark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(0,0,0,0)
|
||||
}
|
||||
radius: 3
|
||||
MouseArea{
|
||||
id:item_mouse
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
getListView().currentIndex = position
|
||||
if(type === 0){
|
||||
text_hour.text = model
|
||||
}
|
||||
if(type === 1){
|
||||
text_minute.text = model
|
||||
}
|
||||
if(type === 2){
|
||||
text_ampm.text = model
|
||||
}
|
||||
}
|
||||
}
|
||||
FluText{
|
||||
text:model
|
||||
color: {
|
||||
if(getListView().currentIndex === position){
|
||||
if(FluTheme.isDark){
|
||||
return Qt.rgba(0,0,0,1)
|
||||
}else{
|
||||
return Qt.rgba(1,1,1,1)
|
||||
}
|
||||
}else{
|
||||
return FluTheme.isDark ? "#FFFFFF" : "#1A1A1A"
|
||||
}
|
||||
}
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ListView{
|
||||
id:list_view_1
|
||||
width: isH ? 100 : 150
|
||||
height: parent.height
|
||||
boundsBehavior:Flickable.StopAtBounds
|
||||
ScrollBar.vertical: FluScrollBar {}
|
||||
preferredHighlightBegin: 0
|
||||
preferredHighlightEnd: 0
|
||||
highlightMoveDuration: 0
|
||||
model: isH ? generateArray(1,12) : generateArray(0,23)
|
||||
clip: true
|
||||
delegate: Loader{
|
||||
property var model: modelData
|
||||
property int type:0
|
||||
property int position:index
|
||||
sourceComponent: list_delegate
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
width: 1
|
||||
height: parent.height
|
||||
color: dividerColor
|
||||
}
|
||||
ListView{
|
||||
id:list_view_2
|
||||
width: isH ? 100 : 150
|
||||
height: parent.height
|
||||
model: generateArray(0,59)
|
||||
clip: true
|
||||
preferredHighlightBegin: 0
|
||||
preferredHighlightEnd: 0
|
||||
highlightMoveDuration: 0
|
||||
ScrollBar.vertical: FluScrollBar {}
|
||||
boundsBehavior:Flickable.StopAtBounds
|
||||
delegate: Loader{
|
||||
property var model: modelData
|
||||
property int type:1
|
||||
property int position:index
|
||||
sourceComponent: list_delegate
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
width: 1
|
||||
height: parent.height
|
||||
color: dividerColor
|
||||
visible: isH
|
||||
}
|
||||
ListView{
|
||||
id:list_view_3
|
||||
width: 100
|
||||
height: 76
|
||||
model: ["上午","下午"]
|
||||
clip: true
|
||||
visible: isH
|
||||
preferredHighlightBegin: 0
|
||||
preferredHighlightEnd: 0
|
||||
highlightMoveDuration: 0
|
||||
ScrollBar.vertical: FluScrollBar {}
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
boundsBehavior:Flickable.StopAtBounds
|
||||
delegate: Loader{
|
||||
property var model: modelData
|
||||
property int type:2
|
||||
property int position:index
|
||||
sourceComponent: list_delegate
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
width: parent.width
|
||||
height: 1
|
||||
anchors.top: layout_content.bottom
|
||||
color: dividerColor
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
id:layout_actions
|
||||
height: 40
|
||||
radius: 5
|
||||
color: FluTheme.isDark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1)
|
||||
anchors{
|
||||
bottom:parent.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
|
||||
Item {
|
||||
id:divider
|
||||
width: 1
|
||||
height: parent.height
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
|
||||
FluButton{
|
||||
anchors{
|
||||
left: parent.left
|
||||
leftMargin: 20
|
||||
rightMargin: 10
|
||||
right: divider.left
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
text: "取消"
|
||||
onClicked: {
|
||||
popup.close()
|
||||
}
|
||||
}
|
||||
|
||||
FluFilledButton{
|
||||
anchors{
|
||||
right: parent.right
|
||||
left: divider.right
|
||||
rightMargin: 20
|
||||
leftMargin: 10
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
text: "确定"
|
||||
onClicked: {
|
||||
changeFlag = false
|
||||
popup.close()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
y:35
|
||||
function showPopup() {
|
||||
changeFlag = true
|
||||
rowData[0] = text_hour.text
|
||||
rowData[1] = text_minute.text
|
||||
rowData[2] = text_ampm.text
|
||||
|
||||
var now = new Date();
|
||||
|
||||
var hour
|
||||
var ampm;
|
||||
if(isH){
|
||||
hour = now.getHours();
|
||||
if(hour>12){
|
||||
ampm = "下午"
|
||||
hour = hour-12
|
||||
}else{
|
||||
ampm = "上午"
|
||||
}
|
||||
}else{
|
||||
hour = now.getHours();
|
||||
}
|
||||
hour = text_hour.text === "时"? hour.toString().padStart(2, '0') : text_hour.text
|
||||
var minute = text_minute.text === "分"? now.getMinutes().toString().padStart(2, '0') : text_minute.text
|
||||
ampm = text_ampm.text === "AM/PM"?ampm:text_ampm.text
|
||||
list_view_1.currentIndex = list_view_1.model.indexOf(hour);
|
||||
list_view_2.currentIndex = list_view_2.model.indexOf(minute);
|
||||
list_view_3.currentIndex = list_view_3.model.indexOf(ampm);
|
||||
|
||||
text_hour.text = hour
|
||||
text_minute.text = minute
|
||||
if(isH){
|
||||
text_ampm.text = ampm
|
||||
}
|
||||
|
||||
var pos = root.mapToItem(null, 0, 0)
|
||||
if(window.height>pos.y+root.height+popup.height){
|
||||
popup.y = root.height
|
||||
} else if(pos.y>popup.height){
|
||||
popup.y = -popup.height
|
||||
} else {
|
||||
popup.y = window.height-(pos.y+popup.height)
|
||||
}
|
||||
popup.open()
|
||||
}
|
||||
|
||||
onClosed: {
|
||||
if(changeFlag){
|
||||
text_hour.text = rowData[0]
|
||||
text_minute.text = rowData[1]
|
||||
text_ampm.text = rowData[2]
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
property bool changeFlag: true
|
||||
readonly property var rowData: ["","",""]
|
||||
|
||||
|
||||
function generateArray(start, n) {
|
||||
var arr = [];
|
||||
for (var i = start; i <= n; i++) {
|
||||
arr.push(i.toString().padStart(2, '0'));
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,64 +2,69 @@
|
||||
import QtQuick.Controls 2.0
|
||||
import FluentUI 1.0
|
||||
|
||||
Switch {
|
||||
id: root
|
||||
property var onClickFunc
|
||||
Button {
|
||||
|
||||
property bool selected: false
|
||||
property var clickFunc
|
||||
|
||||
id: control
|
||||
width: 40
|
||||
implicitWidth: 40
|
||||
height: 20
|
||||
implicitHeight: 20
|
||||
checkable: false
|
||||
indicator: Rectangle {
|
||||
width: root.width
|
||||
height: root.height
|
||||
focusPolicy:Qt.TabFocus
|
||||
Keys.onSpacePressed: control.visualFocus&&clicked()
|
||||
onClicked: {
|
||||
if(clickFunc){
|
||||
clickFunc()
|
||||
return
|
||||
}
|
||||
selected = !selected
|
||||
}
|
||||
background : Rectangle {
|
||||
width: control.width
|
||||
height: control.height
|
||||
radius: height / 2
|
||||
FluFocusRectangle{
|
||||
visible: control.visualFocus
|
||||
radius: 20
|
||||
}
|
||||
color: {
|
||||
if(FluTheme.isDark){
|
||||
if(root.checked){
|
||||
if(selected){
|
||||
return FluTheme.primaryColor.dark
|
||||
}
|
||||
if(switch_mouse.containsMouse){
|
||||
if(hovered){
|
||||
return "#3E3E3C"
|
||||
}
|
||||
return "#323232"
|
||||
}else{
|
||||
if(root.checked){
|
||||
if(selected){
|
||||
return FluTheme.primaryColor.dark
|
||||
}
|
||||
if(switch_mouse.containsMouse){
|
||||
if(hovered){
|
||||
return "#F4F4F4"
|
||||
}
|
||||
return "#FFFFFF"
|
||||
}
|
||||
}
|
||||
border.width: 1
|
||||
border.color: root.checked ? Qt.lighter(FluTheme.primaryColor.dark,1.2) : "#666666"
|
||||
|
||||
border.color: selected ? Qt.lighter(FluTheme.primaryColor.dark,1.2) : "#666666"
|
||||
Rectangle {
|
||||
x: root.checked ? root.implicitWidth - width - 4 : 4
|
||||
width: root.height - 8
|
||||
height: root.height - 8
|
||||
x: selected ? control.implicitWidth - width - 4 : 4
|
||||
width: control.height - 8
|
||||
height: control.height - 8
|
||||
radius: width / 2
|
||||
scale: switch_mouse.containsMouse ? 1.2 : 1.0
|
||||
scale: hovered ? 1.2 : 1.0
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: root.checked ? "#FFFFFF" : "#666666"
|
||||
// border.color: "#D5D5D5"
|
||||
color: selected ? "#FFFFFF" : "#666666"
|
||||
Behavior on x {
|
||||
NumberAnimation { duration: 200 }
|
||||
}
|
||||
}
|
||||
}
|
||||
MouseArea{
|
||||
id:switch_mouse
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
if(root.onClickFunc){
|
||||
root.onClickFunc()
|
||||
}else{
|
||||
root.checked = !root.checked
|
||||
Behavior on scale {
|
||||
NumberAnimation { duration: 150 }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,9 +5,8 @@ import QtQuick.Controls 2.15
|
||||
import FluentUI 1.0
|
||||
import QtGraphicalEffects 1.15
|
||||
|
||||
Rectangle {
|
||||
Item {
|
||||
id:root
|
||||
color: FluTheme.isDark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(253/255,253/255,253/255,1)
|
||||
|
||||
enum TreeViewSelectionMode {
|
||||
None,
|
||||
@ -101,12 +100,12 @@ Rectangle {
|
||||
if(item_layout.singleSelected && selectionMode === FluTreeView.Single){
|
||||
return Qt.rgba(62/255,62/255,62/255,1)
|
||||
}
|
||||
return (item_layout_mouse.containsMouse || item_layout_expanded.hovered || item_layout_checkbox.hovered)?Qt.rgba(62/255,62/255,62/255,1):Qt.rgba(50/255,50/255,50/255,1)
|
||||
return (item_layout_mouse.containsMouse || item_layout_expanded.hovered || item_layout_checkbox.hovered)?Qt.rgba(62/255,62/255,62/255,1):Qt.rgba(0,0,0,0)
|
||||
}else{
|
||||
if(item_layout.singleSelected && selectionMode === FluTreeView.Single){
|
||||
return Qt.rgba(244/255,244/255,244/255,1)
|
||||
return Qt.rgba(0,0,0,0.06)
|
||||
}
|
||||
return (item_layout_mouse.containsMouse || item_layout_expanded.hovered || item_layout_checkbox.hovered)?Qt.rgba(244/255,244/255,244/255,1):Qt.rgba(253/255,253/255,253/255,1)
|
||||
return (item_layout_mouse.containsMouse || item_layout_expanded.hovered || item_layout_checkbox.hovered)?Qt.rgba(0,0,0,0.03):Qt.rgba(0,0,0,0)
|
||||
}
|
||||
}
|
||||
|
||||
@ -164,7 +163,7 @@ Rectangle {
|
||||
FluCheckBox{
|
||||
id:item_layout_checkbox
|
||||
text:""
|
||||
checked: itemModel.multipSelected
|
||||
selected: itemModel.multipSelected
|
||||
visible: selectionMode === FluTreeView.Multiple
|
||||
Layout.leftMargin: 5
|
||||
|
||||
@ -198,11 +197,9 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
checkClicked:function(){
|
||||
clickFunc:function(){
|
||||
if(hasChild){
|
||||
const stack = [itemModel];
|
||||
while (stack.length > 0) {
|
||||
@ -225,8 +222,9 @@ Rectangle {
|
||||
FluIconButton{
|
||||
id:item_layout_expanded
|
||||
color:"#00000000"
|
||||
icon:item_layout.expanded?FluentIcons.FA_angle_down:FluentIcons.FA_angle_right
|
||||
iconSource:item_layout.expanded?FluentIcons.ChevronDown:FluentIcons.ChevronRight
|
||||
opacity: item_layout.hasChild
|
||||
iconSize: 15
|
||||
onClicked: {
|
||||
if(!item_layout.hasChild){
|
||||
item_layout_rect.onClickItem()
|
||||
@ -239,8 +237,8 @@ Rectangle {
|
||||
FluText {
|
||||
text: item_layout.text
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
topPadding: 10
|
||||
bottomPadding: 10
|
||||
topPadding: 7
|
||||
bottomPadding: 7
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -278,8 +276,8 @@ Rectangle {
|
||||
model: tree_model
|
||||
flickableDirection: Flickable.HorizontalAndVerticalFlick
|
||||
clip: true
|
||||
ScrollBar.vertical: ScrollBar { }
|
||||
ScrollBar.horizontal: ScrollBar { }
|
||||
ScrollBar.vertical: FluScrollBar {}
|
||||
ScrollBar.horizontal: FluScrollBar { }
|
||||
}
|
||||
|
||||
function updateData(items){
|
||||
|
@ -14,23 +14,29 @@ Item {
|
||||
return Window.window
|
||||
}
|
||||
|
||||
property color color: FluTheme.isDark ? "#202020" : "#F3F3F3"
|
||||
property color color: {
|
||||
if(window && window.active){
|
||||
return FluTheme.isDark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(238/255,244/255,249/255,1)
|
||||
}
|
||||
return FluTheme.isDark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1)
|
||||
}
|
||||
|
||||
property string title: "FluentUI"
|
||||
property int minimumWidth
|
||||
property int maximumWidth
|
||||
property int minimumHeight
|
||||
property int maximumHeight
|
||||
property int modality:0
|
||||
|
||||
signal initArgument(var argument)
|
||||
|
||||
property var pageRegister
|
||||
|
||||
property int borderless:{
|
||||
if(!FluTheme.isFrameless){
|
||||
return 0
|
||||
}
|
||||
if(window === null)
|
||||
return 4
|
||||
if(Window.window.visibility === Window.Maximized){
|
||||
return 0
|
||||
}
|
||||
return 4
|
||||
return (window && (window.visibility === Window.Maximized)) ? 0 : 4
|
||||
}
|
||||
|
||||
default property alias content: container.data
|
||||
@ -47,11 +53,7 @@ Item {
|
||||
|
||||
Rectangle{
|
||||
property color borerlessColor : FluTheme.isDark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
||||
color: {
|
||||
if(window === null)
|
||||
return borerlessColor
|
||||
return window.active ? borerlessColor : Qt.lighter(borerlessColor,1.1)
|
||||
}
|
||||
color: (window && window.active) ? borerlessColor : Qt.lighter(borerlessColor,1.1)
|
||||
border.width: 1
|
||||
anchors.fill: parent
|
||||
radius: 4
|
||||
@ -63,6 +65,12 @@ Item {
|
||||
color:root.color
|
||||
anchors.fill: parent
|
||||
anchors.margins: borderless
|
||||
clip: true
|
||||
Behavior on color{
|
||||
ColorAnimation {
|
||||
duration: 300
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
@ -73,8 +81,10 @@ Item {
|
||||
target: FluApp
|
||||
function onWindowReady(view){
|
||||
if(FluApp.equalsWindow(view,window)){
|
||||
helper.initWindow(view);
|
||||
helper.setTitle(title);
|
||||
helper.initWindow(view)
|
||||
initArgument(helper.getArgument())
|
||||
pageRegister = helper.getPageRegister()
|
||||
helper.setTitle(title)
|
||||
if(minimumWidth){
|
||||
helper.setMinimumWidth(minimumWidth)
|
||||
}
|
||||
@ -87,6 +97,8 @@ Item {
|
||||
if(maximumHeight){
|
||||
helper.setMaximumHeight(maximumHeight)
|
||||
}
|
||||
helper.setModality(root.modality);
|
||||
helper.updateWindow()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -103,17 +115,31 @@ Item {
|
||||
function showSuccess(text,duration,moremsg){
|
||||
infoBar.showSuccess(text,duration,moremsg);
|
||||
}
|
||||
|
||||
function showInfo(text,duration,moremsg){
|
||||
infoBar.showInfo(text,duration,moremsg);
|
||||
}
|
||||
|
||||
function showWarning(text,duration,moremsg){
|
||||
infoBar.showWarning(text,duration,moremsg);
|
||||
}
|
||||
|
||||
function showError(text,duration,moremsg){
|
||||
infoBar.showError(text,duration,moremsg);
|
||||
}
|
||||
|
||||
function close(){
|
||||
window.close()
|
||||
}
|
||||
|
||||
function registerForPageResult(path){
|
||||
return helper.createRegister(path)
|
||||
}
|
||||
|
||||
function onResult(data){
|
||||
if(pageRegister){
|
||||
pageRegister.onResult(data)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
0
src/macos_install.sh
Executable file → Normal file
14
src/res.qrc
@ -14,7 +14,6 @@
|
||||
<file>controls/FluDropDownButton.qml</file>
|
||||
<file>controls/FluTextBox.qml</file>
|
||||
<file>controls/FluTimePicker.qml</file>
|
||||
<file>res/font/fontawesome-webfont.ttf</file>
|
||||
<file>controls/FluAppBar.qml</file>
|
||||
<file>controls/FluRectangle.qml</file>
|
||||
<file>controls/FluWindow.qml</file>
|
||||
@ -36,5 +35,18 @@
|
||||
<file>controls/FluTreeView.qml</file>
|
||||
<file>controls/FluExpander.qml</file>
|
||||
<file>controls/FluAutoSuggestBox.qml</file>
|
||||
<file>controls/FluNavigationView.qml</file>
|
||||
<file>controls/FluPaneItem.qml</file>
|
||||
<file>controls/FluPaneItemHeader.qml</file>
|
||||
<file>controls/FluPaneItemSeparator.qml</file>
|
||||
<file>controls/FluScrollablePage.qml</file>
|
||||
<file>controls/FluContentPage.qml</file>
|
||||
<file>controls/FluArea.qml</file>
|
||||
<file>res/font/Segoe_Fluent_Icons.ttf</file>
|
||||
<file>controls/FluDatePicker.qml</file>
|
||||
<file>controls/FluCalenderView.qml</file>
|
||||
<file>controls/FluCalendarDatePicker.qml</file>
|
||||
<file>controls/FluFocusRectangle.qml</file>
|
||||
<file>controls/FluCarousel.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|