Compare commits

...

24 Commits
1.0.0 ... 1.0.4

Author SHA1 Message Date
5bb8f27968 update 2023-03-11 21:15:36 +08:00
e6d2513482 update 2023-03-11 21:03:16 +08:00
5917d23286 update 2023-03-11 20:33:29 +08:00
eb1744d5f8 update 2023-03-11 14:43:07 +08:00
b1b727030c update 2023-03-11 14:41:31 +08:00
a71831cd9d update 2023-03-11 00:29:06 +08:00
bcc5d433a9 update 2023-03-10 18:08:32 +08:00
d835b7c23d update 2023-03-09 23:53:36 +08:00
0867043d7a update 2023-03-09 23:11:59 +08:00
e2cefb6114 update 2023-03-09 16:44:24 +08:00
bdf4da81dd update 2023-03-09 15:49:37 +08:00
f4cebb5c14 update 2023-03-09 13:23:39 +08:00
88b15b92ea update 2023-03-09 11:50:40 +08:00
d43e661388 update 2023-03-09 01:18:46 +08:00
5df0efbc58 update 2023-03-08 18:15:06 +08:00
818b588daa update 2023-03-08 18:14:21 +08:00
3fbd494724 update 2023-03-08 16:13:52 +08:00
b864be5f67 update 2023-03-08 16:09:18 +08:00
a81e7958c5 update 2023-03-08 16:02:09 +08:00
b1d57c43c4 update 2023-03-08 15:56:53 +08:00
02adfb4b0e update 2023-03-08 15:33:48 +08:00
97e0d614d0 update 2023-03-08 15:22:43 +08:00
46caf288d8 update 2023-03-08 15:17:31 +08:00
aceb3fee7b update 2023-03-08 14:53:28 +08:00
68 changed files with 3787 additions and 1638 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

View File

@ -1,6 +1,7 @@
name: Ubuntu
# Qt官方没有linux平台的x86包
on:
workflow_dispatch:
push:
paths:
- '*.pro'
@ -20,11 +21,8 @@ jobs:
os: [ubuntu-18.04,ubuntu-20.04]
qt_ver: [5.15.2]
qt_arch: [gcc_64]
exclude:
# Qt6.2.2 need GLIBC_2.28, ubuntu 18.04 have not.
- os: ubuntu-18.04
qt_ver: 6.2.2
qt_arch: gcc_64
env:
targetName: example
steps:
- name: Install Qt
uses: jurplel/install-qt-action@v2
@ -32,11 +30,38 @@ jobs:
version: ${{ matrix.qt_ver }}
cached: 'false'
- name: ubuntu install GL library
run: sudo apt-get install -y libglew-dev libglfw3-dev
run: sudo apt-get install -y libglew-dev libglfw3-dev qml-module-qtquick-controls qml-module-qtquick-controls2
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: build ubuntu
run: |
qmake
make
make
- name: install QT linux deploy
uses: miurahr/install-linuxdeploy-action@v1
with:
plugins: qt appimage
# 打包
- name: package
run: |
# make sure Qt plugin finds QML sources so it can deploy the imported files
export QML_SOURCES_PATHS=src
# 拷贝依赖
linuxdeploy-x86_64.AppImage --plugin=qt --output=appimage --create-desktop-file --icon-file=${targetName}.svg --executable=bin/release/${targetName} --appdir bin/release/
mv ${{ env.targetName }}-*.AppImage ${{ env.targetName }}.AppImage
# 上传artifacts
- uses: actions/upload-artifact@v2
with:
name: ${{ env.targetName }}_${{ matrix.os }}_${{matrix.qt_ver}}
path: ${{ env.targetName }}.AppImage
# tag 上传Release
- name: uploadRelease
if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.targetName }}.AppImage
asset_name: ${{ env.targetName }}_${{ matrix.os }}_${{ matrix.qt_ver }}.AppImage
tag: ${{ github.ref }}
overwrite: true

View File

@ -27,6 +27,7 @@ jobs:
qt_tools_mingw_install: mingw810_64
env:
targetName: example.exe
fileName: example
steps:
- name: Install Qt
uses: jurplel/install-qt-action@v2
@ -65,7 +66,7 @@ jobs:
- name: package
id: package
env:
archiveName: ${{ matrix.qt_ver }}-${{ matrix.qt_target }}-${{ matrix.qt_arch }}
archiveName: ${{ env.fileName }}-${{ matrix.qt_ver }}-${{ matrix.qt_arch }}
shell: pwsh
run: |
& scripts\windows-mingw-publish.ps1 ${env:archiveName} ${env:targetName}

View File

@ -32,6 +32,7 @@ jobs:
qt_arch_install: msvc2019_64
env:
targetName: example.exe
fileName: example
# 步骤
steps:
# 安装Qt
@ -66,7 +67,7 @@ jobs:
- name: package
id: package
env:
archiveName: ${{ matrix.qt_ver }}-${{ matrix.qt_target }}-${{ matrix.qt_arch }}
archiveName: ${{ env.fileName }}-${{ matrix.qt_ver }}-${{ matrix.qt_arch }}
msvcArch: ${{ matrix.msvc_arch }}
shell: pwsh
run: |

View File

@ -4,12 +4,11 @@
这是一个漂亮的Fluent组件库使用QML插件开发的
## status
## 编译状态
| [Windows][win-link]| [Ubuntu][ubuntu-link]|[MacOS][macos-link]|
|---------------|---------------|-----------------|
| ![win-badge] | ![ubuntu-badge] | ![macos-badge] |
[win-link]: https://github.com/zhuzichu520/FluentUI/actions?query=workflow%3AWindows "WindowsAction"
[win-badge]: https://github.com/zhuzichu520/FluentUI/workflows/Windows/badge.svg "Windows"
@ -19,6 +18,18 @@
[macos-link]: https://github.com/zhuzichu520/FluentUI/actions?query=workflow%3AMacOS "MacOSAction"
[macos-badge]: https://github.com/zhuzichu520/FluentUI/workflows/MacOS/badge.svg "MacOS"
## 发布
|[已发布][release-link]|[下载][download-link]|下载次数|
|:--:|:--:|:--:|
|![release-badge] |![download-badge]|![download-latest]|
[release-link]: https://github.com/zhuzichu520/FluentUI/releases "Release status"
[release-badge]: https://img.shields.io/github/release/zhuzichu520/FluentUI.svg?style=flat-square "Release status"
[download-link]: https://github.com/zhuzichu520/FluentUI/releases/latest "Download status"
[download-badge]: https://img.shields.io/github/downloads/zhuzichu520/FluentUI/total.svg "Download status"
[download-latest]: https://img.shields.io/github/downloads/zhuzichu520/FluentUI/latest/total.svg "latest status"
## 支持的组件
|目录|说明|备注|

1
example.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1678260749060" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11227" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32"><path d="M0 0m170.663111 0l682.652445 0q170.663111 0 170.663111 170.663111l0 682.652445q0 170.663111-170.663111 170.663111l-682.652445 0q-170.663111 0-170.663111-170.663111l0-682.652445q0-170.663111 170.663111-170.663111Z" fill="#EBF2FF" p-id="11228"></path><path d="M512.351993 787.674257c182.822858 0 330.926439 98.568613 331.033103 231.312514 0 1.674632-0.031999 3.338597-0.106664 5.002563H181.43622c-0.074665-1.663965-0.106664-3.327931-0.106664-5.002563 0-132.743901 148.210246-231.312514 331.022437-231.312514z" fill="#7D99C8" p-id="11229"></path><path d="M592.264994 721.158309v79.817004h-0.810649c-5.546551 30.079373-38.847191 53.204225-79.102352 53.204225-40.244495 0-73.545134-23.114185-79.091686-53.193559h-0.81065V721.158309h159.815337z" fill="#FBDBCB" p-id="11230"></path><path d="M508.213412 765.626716c-44.105748-1.226641-85.363555-19.306264-118.568196-56.916147-22.826191-25.866128-35.199267-53.054895-37.097894-81.576968l-21.610217-1.610633a59.988084 59.988084 0 0 1-55.433511-56.585488l-0.319994-5.72788a34.932606 34.932606 0 0 1 43.124435-35.839254l0.949314-9.098477a608.008666 608.008666 0 0 1 40.031166-159.015354l10.389117-25.866127H655.026354l10.389117 25.866127a608.008666 608.008666 0 0 1 40.031166 159.015354l0.95998 9.098477a34.932606 34.932606 0 0 1 43.103102 35.839254l-0.309327 5.72788a59.988084 59.988084 0 0 1-55.433512 56.585488l-21.610217 1.610633c-1.909294 28.522072-14.271703 55.710839-37.097893 81.576968-34.239287 38.793858-77.054395 56.798817-122.717444 56.980146z" fill="#FFE7DB" p-id="11231"></path><path d="M546.911273 182.822858a10.666444 10.666444 0 0 1 1.429303 4.31991c0.533322 5.055895 0.714652 9.226474 0.533322 12.501073l-0.202662 2.346618 3.221266-0.543989c21.876878-3.733256 38.452532-9.877128 49.705631-18.452949l2.197288-1.73863a10.666444 10.666444 0 0 1 16.682319 3.98925c8.767817 20.650236 11.125102 40.681819 7.039853 60.116081l-0.373325 1.578633c4.746568 1.514635 9.589134 3.199933 14.506364 5.066562 27.882086 10.581113 57.769463 26.367451 76.883732 75.65709 20.212912 52.084248 18.826274 116.562905-4.149247 193.425304l-1.855961 6.101206H701.425387c-0.47999-51.732256-8.319827-90.526114-23.540843-116.392242-15.221016-25.866128-29.716714-46.185704-43.487094-60.969396-41.513802 10.399783-79.85967 15.914335-115.037603 16.564988l-6.997188 0.063998v0.191996c-37.065894 0-77.737047-5.546551-122.024124-16.628986-13.77038 10.954438-28.266078 31.220683-43.487094 60.7774-15.221016 29.556718-23.060853 68.414575-23.540843 116.584238h-11.114435c-24.746151-79.571676-26.740776-146.076957-6.005209-199.52651 8.746484-22.548864 19.732922-38.079207 31.764672-49.321639 18.079623-20.660903 40.180496-36.009916 66.302619-46.068374a424.716485 424.716485 0 0 1 32.319326-11.029103c25.25814-9.034478 44.991063-16.767651 59.209433-23.210183a366.221704 366.221704 0 0 0 29.151393-14.869024l7.359847-4.266578a10.666444 10.666444 0 0 1 14.623695 3.733256z" fill="#7D99C8" p-id="11232"></path></svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -6,8 +6,11 @@ FluWindow {
width: 500
height: 600
minimumWidth: 300
minimumHeight: 400
minimumWidth: 500
minimumHeight: 600
maximumWidth: 500
maximumHeight: 600
title:"关于"
FluAppBar{
@ -31,7 +34,7 @@ FluWindow {
fontStyle: FluText.Title
}
FluText{
text:"v1.0.0"
text:"v1.0.4"
fontStyle: FluText.Body
Layout.alignment: Qt.AlignBottom
}

View File

@ -8,191 +8,179 @@ import FluentUI 1.0
FluWindow {
id:rootwindow
width: 800
height: 600
width: 860
height: 680
title: "FluentUI"
minimumWidth: 600
minimumWidth: 500
minimumHeight: 400
FluAppBar{
id:appbar
title: "FluentUI"
showDark: true
showFps: true
}
ListModel{
id:nav_items
ListElement{
text:"Buttons"
page:"qrc:/T_Buttons.qml"
FluObject{
id:original_items
FluPaneItemHeader{
title:"Inputs"
}
ListElement{
text:"TextBox"
page:"qrc:/T_TextBox.qml"
FluPaneItem{
title:"Buttons"
onTap:{
nav_view.push("qrc:/T_Buttons.qml")
}
}
ListElement{
text:"ToggleSwitch"
page:"qrc:/T_ToggleSwitch.qml"
FluPaneItem{
title:"Slider"
onTap:{
nav_view.push("qrc:/T_Slider.qml")
}
}
ListElement{
text:"Slider"
page:"qrc:/T_Slider.qml"
FluPaneItem{
title:"ToggleSwitch"
onTap:{
nav_view.push("qrc:/T_ToggleSwitch.qml")
}
}
ListElement{
text:"InfoBar"
page:"qrc:/T_InfoBar.qml"
FluPaneItemHeader{
title:"Form"
}
ListElement{
text:"Dialog"
page:"qrc:/T_Dialog.qml"
FluPaneItem{
title:"TextBox"
onTap:{
nav_view.push("qrc:/T_TextBox.qml")
}
}
ListElement{
text:"Progress"
page:"qrc:/T_Progress.qml"
FluPaneItem{
title:"TimePicker"
onTap:{
nav_view.push("qrc:/T_TimePicker.qml")
}
}
ListElement{
text:"Rectangle"
page:"qrc:/T_Rectangle.qml"
FluPaneItemHeader{
title:"Surface"
}
ListElement{
text:"TreeView"
page:"qrc:/T_TreeView.qml"
FluPaneItem{
title:"InfoBar"
onTap:{
nav_view.push("qrc:/T_InfoBar.qml")
}
}
ListElement{
text:"Theme"
page:"qrc:/T_Theme.qml"
FluPaneItem{
title:"Progress"
onTap:{
nav_view.push("qrc:/T_Progress.qml")
}
}
ListElement{
text:"Awesome"
page:"qrc:/T_Awesome.qml"
FluPaneItem{
title:"Rectangle"
onTap:{
nav_view.push("qrc:/T_Rectangle.qml")
}
}
ListElement{
text:"Typography"
page:"qrc:/T_Typography.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")
}
}
FluPaneItemHeader{
title:"Navigation"
}
FluPaneItem{
title:"TreeView"
onTap:{
nav_view.push("qrc:/T_TreeView.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")
}
}
}
FluIconButton{
icon:FluentIcons.FA_navicon
FluNavigationView{
id:nav_view
anchors{
top: appbar.bottom
left: parent.left
bottom: parent.bottom
leftMargin: 12
bottomMargin: 12
}
FluMenu{
id:menu
x:40
margins:4
FluMenuItem{
text:"意见反馈"
onClicked:{
showInfo("正在建设中...")
}
}
FluMenuItem{
text:"关于"
onClicked:{
FluApp.navigate("/About")
}
}
}
onClicked:{
menu.open()
}
}
ListView{
id:nav_list
anchors{
top: appbar.bottom
bottom: parent.bottom
topMargin: 20
bottomMargin: 52
}
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)
items:original_items
footerItems:footer_items
Loader{
anchors.fill: parent
anchors.margins:20
source: nav_items.get(nav_list.currentIndex).page
Component.onCompleted: {
nav_view.setCurrentIndex(1)
nav_view.push("qrc:/T_Buttons.qml")
}
}
}

View File

@ -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,8 +43,8 @@ Item {
bottom: parent.bottom
}
delegate: Item {
width: 120
height: 60
width: 68
height: 80
FluIconButton{
id:item_icon
icon:modelData.icon
@ -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
}
}
}

View File

@ -2,130 +2,183 @@
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
FluText{
id:title
text:"Buttons"
fontStyle: FluText.TitleLarge
}
ScrollView{
clip: true
FluScrollablePage{
title:"Buttons"
spacing: 20
FluArea{
Layout.topMargin: 20
width: parent.width
contentWidth: parent.width
anchors{
top: title.bottom
bottom: parent.bottom
height: 68
paddings: 10
FluButton{
disabled:button_switch.checked
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
FluText{
text:"Disabled"
}
}
}
FluArea{
width: parent.width
height: 68
paddings: 10
FluFilledButton{
disabled:filled_button_switch.checked
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{
icon:FluentIcons.ChromeCloseContrast
disabled:icon_button_switch.checked
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: 100
paddings: 10
ColumnLayout{
spacing: 8
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
Repeater{
id:repeater
property int selecIndex : 0
model: 3
delegate: FluRadioButton{
checked : repeater.selecIndex===index
disabled:radio_button_switch.checked
text:"Radio Button_"+index
onClicked:{
showWarning("点击FilledButton")
repeater.selecIndex = index
}
}
Item{
height: 1
Layout.fillWidth: true
}
FluToggleSwitch{
id:filled_button_switch
Layout.alignment: Qt.AlignRight
}
FluText{
text:"Disabled"
}
}
FluDivider{
Layout.fillWidth: true ; height:1
}
Row{
spacing: 5
anchors{
verticalCenter: parent.verticalCenter
right: parent.right
}
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"
}
FluToggleSwitch{
id:radio_button_switch
Layout.alignment: Qt.AlignRight
}
FluDivider{
Layout.fillWidth: true ; height:1
FluText{
text:"Disabled"
}
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"
}
}
}
FluArea{
width: parent.width
height: 68
paddings: 10
FluCheckBox{
disabled:icon_button_check.checked
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
}
Row{
spacing: 5
anchors{
verticalCenter: parent.verticalCenter
right: parent.right
}
FluToggleSwitch{
id:icon_button_check
Layout.alignment: Qt.AlignRight
}
FluText{
text:"Disabled"
}
}
}

View File

@ -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()
}
}
}

60
example/T_Expander.qml Normal file
View File

@ -0,0 +1,60 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import QtGraphicalEffects 1.15
import FluentUI 1.0
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{
checked : 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:"先帝创业未半而中道崩殂,今天下三分,益州疲弊,此诚危急存亡之秋也。然侍卫之臣不懈于内,忠志之士忘身于外者,盖追先帝之殊遇,欲报之于陛下也。诚宜开张圣听,以光先帝遗德,恢弘志士之气,不宜妄自菲薄,引喻失义,以塞忠谏之路也。宫中府中,俱为一体;陟罚臧否,不宜异同。若有作奸犯科及为忠善者,宜付有司论其刑赏,以昭陛下平明之理,不宜偏私,使内外异法也。侍中、侍郎郭攸之、费祎、董允等,此皆良实,志虑忠纯,是以先帝简拔以遗陛下。愚以为宫中之事,事无大小,悉以咨之,然后施行,必能裨补阙漏,有所广益。将军向宠,性行淑均,晓畅军事,试用于昔日,先帝称之曰能,是以众议举宠为督。愚以为营中之事,悉以咨之,必能使行阵和睦,优劣得所。亲贤臣,远小人,此先汉所以兴隆也;亲小人,远贤臣,此后汉所以倾颓也。先帝在时,每与臣论此事,未尝不叹息痛恨于桓、灵也。侍中、尚书、长史、参军,此悉贞良死节之臣,愿陛下亲之信之,则汉室之隆,可计日而待也。臣本布衣,躬耕于南阳,苟全性命于乱世,不求闻达于诸侯。先帝不以臣卑鄙,猥自枉屈,三顾臣于草庐之中,咨臣以当世之事,由是感激,遂许先帝以驱驰。后值倾覆,受任于败军之际,奉命于危难之间,尔来二十有一年矣。先帝知臣谨慎,故临崩寄臣以大事也。受命以来,夙夜忧叹,恐托付不效,以伤先帝之明;故五月渡泸,深入不毛。今南方已定,兵甲已足,当奖率三军,北定中原,庶竭驽钝,攘除奸凶,兴复汉室,还于旧都。此臣所以报先帝而忠陛下之职分也。至于斟酌损益,进尽忠言,则攸之、祎、允之任也。愿陛下托臣以讨贼兴复之效,不效,则治臣之罪,以告先帝之灵。若无兴德之言,则责攸之、祎、允等之慢,以彰其咎;陛下亦宜自谋,以咨诹善道,察纳雅言,深追先帝遗诏。臣不胜受恩感激。今当远离,临表涕零,不知所言。"
}
}
}
}
}

View File

@ -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")
}
}
}

View File

@ -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
}
}

View File

@ -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
}
}

View File

@ -5,27 +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
}
}

View File

@ -5,32 +5,45 @@ 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: "多行输入框"
}
}
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);
}
return name;
}
for (let i = 0; i < numNames; i++) {
const name = generateRandomName();
names.push(name);
}
return names;
}
}

View File

@ -5,60 +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
icon: 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:"夜间模式"
Layout.topMargin: 20
}
FluToggleSwitch{
checked: FluTheme.isDark
onClickFunc:function(){
FluTheme.isDark = !FluTheme.isDark
}
}
FluText{
text:"无边框"
Layout.topMargin: 20
}
FluToggleSwitch{
checked: FluTheme.isFrameless
onClickFunc:function(){
FluTheme.isFrameless = !FluTheme.isFrameless
}
}
FluText{
text:"native文本渲染"
Layout.topMargin: 20
}
FluToggleSwitch{
checked: FluTheme.isNativeText
onClickFunc:function(){
FluTheme.isNativeText = !FluTheme.isNativeText
}
}
}

61
example/T_TimePicker.qml Normal file
View 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
}
}
}
}

View File

@ -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
}
}

View File

@ -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
}

View File

@ -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
}
}

View File

@ -2,6 +2,7 @@
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QDir>
#include <QQuickWindow>
#include <QProcess>
QMap<QString, QVariant> properties(){
@ -16,6 +17,7 @@ int main(int argc, char *argv[])
QCoreApplication::setOrganizationDomain("https://zhuzichu520.github.io");
QCoreApplication::setApplicationName("FluentUI");
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
// QQuickWindow::setSceneGraphBackend(QSGRendererInterface::Software);
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
QMapIterator<QString, QVariant> iterator(properties());

View File

@ -3,7 +3,6 @@
<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>
@ -29,5 +28,8 @@
<file>T_Theme.qml</file>
<file>T_Dialog.qml</file>
<file>T_TreeView.qml</file>
<file>T_Expander.qml</file>
<file>MainPage.qml</file>
<file>T_TimePicker.qml</file>
</qresource>
</RCC>

2190
src/Def.h

File diff suppressed because it is too large Load Diff

View File

@ -59,7 +59,7 @@ 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({});});
// QObject::connect(qApp, &QGuiApplication::aboutToQuit, qApp, [&view](){view->setSource({});});
}else{
view->closeDeleteLater();
}
@ -82,7 +82,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);

View File

@ -16,5 +16,8 @@ FluTheme::FluTheme(QObject *parent)
: QObject{parent}
{
primaryColor(FluColors::getInstance()->Blue());
textSize(13);
isNativeText(false);
isFrameless(false);
isDark(false);
}

View File

@ -9,7 +9,10 @@ class FluTheme : public QObject
{
Q_OBJECT
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();

View File

@ -33,6 +33,23 @@ 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/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");
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluContentDialog.qml"),uri,major,minor,"FluContentDialog");
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluMenuItem.qml"),uri,major,minor,"FluMenuItem");
@ -60,7 +77,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");
@ -71,10 +87,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();

View File

@ -21,6 +21,7 @@ public:
void closeDeleteLater();
bool isMax() const;
bool isFull() const;
void refreshWindow();
QQuickItem *titleItem() const;
static QMap<WId,FramelessView*> *windowCache;
@ -38,6 +39,7 @@ signals:
protected:
void showEvent(QShowEvent *e) override;
void resizeEvent(QResizeEvent *e) override;
bool event(QEvent *ev) override;
# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) override;
# else

View File

@ -3,6 +3,7 @@
#include <QQuickItem>
#include <QScreen>
#include <QWindow>
#include <FluTheme.h>
class FramelessViewPrivate
{
@ -12,10 +13,10 @@ public:
bool m_deleteLater = false;
QQuickItem *m_titleItem = nullptr;
};
FramelessView::FramelessView(QWindow *parent) : Super(parent), d(new FramelessViewPrivate)
{
setFlags(Qt::CustomizeWindowHint | Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinMaxButtonsHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
setResizeMode(SizeRootObjectToView);
refreshWindow();
setIsMax(windowState() == Qt::WindowMaximized);
setIsFull(windowState() == Qt::WindowFullScreen);
connect(this, &QWindow::windowStateChanged, this, [&](Qt::WindowState state) {
@ -23,15 +24,31 @@ FramelessView::FramelessView(QWindow *parent) : Super(parent), d(new FramelessVi
setIsMax(windowState() == Qt::WindowMaximized);
setIsFull(windowState() == Qt::WindowFullScreen);
});
connect(FluTheme::getInstance(),&FluTheme::isFramelessChanged,this,[=](){
refreshWindow();
});
}
void FramelessView::refreshWindow(){
if(FluTheme::getInstance()->isFrameless()){
setFlags(Qt::CustomizeWindowHint | Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinMaxButtonsHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
}else{
setFlags(Qt::Window);
}
setResizeMode(SizeViewToRootObject);
setResizeMode(SizeRootObjectToView);
}
FramelessView::~FramelessView()
{
delete d;
}
void FramelessView::showEvent(QShowEvent *e)
{
Super::showEvent(e);
}
QRect FramelessView::calcCenterGeo(const QRect &screenGeo, const QSize &normalSize)
{
int w = normalSize.width();
@ -46,9 +63,9 @@ QRect FramelessView::calcCenterGeo(const QRect &screenGeo, const QSize &normalSi
y = screenGeo.y();
h = screenGeo.height();
}
return { x, y, w, h };
}
void FramelessView::moveToScreenCenter()
{
auto geo = calcCenterGeo(screen()->availableGeometry(), size());
@ -58,6 +75,7 @@ void FramelessView::moveToScreenCenter()
setGeometry(geo);
update();
}
void FramelessView::closeDeleteLater(){
d->m_deleteLater = true;
}
@ -66,14 +84,17 @@ bool FramelessView::isMax() const
{
return d->m_isMax;
}
bool FramelessView::isFull() const
{
return d->m_isFull;
}
QQuickItem *FramelessView::titleItem() const
{
return d->m_titleItem;
}
void FramelessView::setIsMax(bool isMax)
{
if (d->m_isMax == isMax)
@ -82,6 +103,7 @@ void FramelessView::setIsMax(bool isMax)
d->m_isMax = isMax;
emit isMaxChanged(d->m_isMax);
}
void FramelessView::setIsFull(bool isFull)
{
if(d->m_isFull == isFull)
@ -90,6 +112,7 @@ void FramelessView::setIsFull(bool isFull)
d->m_isFull = isFull;
emit isFullChanged(d->m_isFull);
}
void FramelessView::setTitleItem(QQuickItem *item)
{
d->m_titleItem = item;
@ -107,3 +130,15 @@ void FramelessView::resizeEvent(QResizeEvent *e)
{
Super::resizeEvent(e);
}
bool FramelessView::event(QEvent *ev)
{
if (ev->type() == QEvent::Close) {
if(d->m_deleteLater){
deleteLater();
ev->setAccepted(false);
}
}
return QQuickWindow::event(ev);
}

View File

@ -3,27 +3,7 @@
#include <QQuickItem>
#include <QScreen>
#include <QWindow>
#include <VersionHelpers.h>
#include <WinUser.h>
#include <dwmapi.h>
#include <objidl.h> // Fixes error C2504: 'IUnknown' : base class undefined
#include <windows.h>
#include <windowsx.h>
#include <wtypes.h>
#pragma comment(lib, "Dwmapi.lib") // Adds missing library, fixes error LNK2019: unresolved
#pragma comment(lib, "User32.lib")
#pragma comment(lib, "Gdi32.lib")
static bool isMaxWin(QWindow* win)
{
return win->windowState() == Qt::WindowMaximized;
}
static bool isFullWin(QQuickView* win)
{
return win->windowState() == Qt::WindowFullScreen;
}
#include <FluTheme.h>
class FramelessViewPrivate
{
@ -33,10 +13,10 @@ public:
bool m_deleteLater = false;
QQuickItem *m_titleItem = nullptr;
};
FramelessView::FramelessView(QWindow *parent) : Super(parent), d(new FramelessViewPrivate)
{
setFlags(Qt::CustomizeWindowHint | Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinMaxButtonsHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
setResizeMode(SizeRootObjectToView);
refreshWindow();
setIsMax(windowState() == Qt::WindowMaximized);
setIsFull(windowState() == Qt::WindowFullScreen);
connect(this, &QWindow::windowStateChanged, this, [&](Qt::WindowState state) {
@ -44,15 +24,31 @@ FramelessView::FramelessView(QWindow *parent) : Super(parent), d(new FramelessVi
setIsMax(windowState() == Qt::WindowMaximized);
setIsFull(windowState() == Qt::WindowFullScreen);
});
connect(FluTheme::getInstance(),&FluTheme::isFramelessChanged,this,[=](){
refreshWindow();
});
}
void FramelessView::refreshWindow(){
if(FluTheme::getInstance()->isFrameless()){
setFlags(Qt::CustomizeWindowHint | Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinMaxButtonsHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
}else{
setFlags(Qt::Window);
}
setResizeMode(SizeViewToRootObject);
setResizeMode(SizeRootObjectToView);
}
FramelessView::~FramelessView()
{
delete d;
}
void FramelessView::showEvent(QShowEvent *e)
{
Super::showEvent(e);
}
QRect FramelessView::calcCenterGeo(const QRect &screenGeo, const QSize &normalSize)
{
int w = normalSize.width();
@ -67,9 +63,9 @@ QRect FramelessView::calcCenterGeo(const QRect &screenGeo, const QSize &normalSi
y = screenGeo.y();
h = screenGeo.height();
}
return { x, y, w, h };
}
void FramelessView::moveToScreenCenter()
{
auto geo = calcCenterGeo(screen()->availableGeometry(), size());
@ -79,6 +75,7 @@ void FramelessView::moveToScreenCenter()
setGeometry(geo);
update();
}
void FramelessView::closeDeleteLater(){
d->m_deleteLater = true;
}
@ -87,14 +84,17 @@ bool FramelessView::isMax() const
{
return d->m_isMax;
}
bool FramelessView::isFull() const
{
return d->m_isFull;
}
QQuickItem *FramelessView::titleItem() const
{
return d->m_titleItem;
}
void FramelessView::setIsMax(bool isMax)
{
if (d->m_isMax == isMax)
@ -103,6 +103,7 @@ void FramelessView::setIsMax(bool isMax)
d->m_isMax = isMax;
emit isMaxChanged(d->m_isMax);
}
void FramelessView::setIsFull(bool isFull)
{
if(d->m_isFull == isFull)
@ -111,6 +112,7 @@ void FramelessView::setIsFull(bool isFull)
d->m_isFull = isFull;
emit isFullChanged(d->m_isFull);
}
void FramelessView::setTitleItem(QQuickItem *item)
{
d->m_titleItem = item;
@ -121,43 +123,16 @@ bool FramelessView::nativeEvent(const QByteArray &eventType, void *message, qint
bool FramelessView::nativeEvent(const QByteArray &eventType, void *message, long *result)
#endif
{
#if (QT_VERSION == QT_VERSION_CHECK(5, 11, 1))
// Work-around a bug caused by typo which only exists in Qt 5.11.1
const auto msg = *reinterpret_cast<MSG**>(message);
#else
const auto msg = static_cast<LPMSG>(message);
#endif
if (!msg || !msg->hwnd)
MSG* msg = static_cast<MSG*>(message);
if (msg->message == WM_WINDOWPOSCHANGING)
{
return false;
}
switch (msg->message)
{
case WM_NCCALCSIZE: {
const auto mode = static_cast<BOOL>(msg->wParam);
const auto clientRect = mode ? &(reinterpret_cast<LPNCCALCSIZE_PARAMS>(msg->lParam)->rgrc[0]) : reinterpret_cast<LPRECT>(msg->lParam);
if (mode == TRUE)
WINDOWPOS* wp = reinterpret_cast<WINDOWPOS*>(msg->lParam);
if (wp != nullptr && (wp->flags & SWP_NOSIZE) == 0)
{
*result = WVR_REDRAW;
//规避 拖动border进行resize时界面闪烁
if (!isMaxWin(this) && !isFullWin(this))
{
if (clientRect->top != 0)
{
clientRect->top -= 0.1;
}
}
else
{
if (clientRect->top != 0)
{
clientRect->top += 0.1;
}
}
wp->flags |= SWP_NOCOPYBITS;
*result = 0;
return true;
}
break;
}
}
return Super::nativeEvent(eventType, message, result);
}
@ -166,3 +141,15 @@ void FramelessView::resizeEvent(QResizeEvent *e)
{
Super::resizeEvent(e);
}
bool FramelessView::event(QEvent *ev)
{
if (ev->type() == QEvent::Close) {
if(d->m_deleteLater){
deleteLater();
ev->setAccepted(false);
}
}
return QQuickWindow::event(ev);
}

View File

@ -13,13 +13,16 @@ Rectangle{
return borerlessColor
return Window.window.active ? borerlessColor : Qt.lighter(borerlessColor,1.1)
}
height: 50
visible: FluTheme.isFrameless
height: visible ? 34 : 0
width: {
if(parent==null)
return 200
return parent.width
}
z: 65535
clip: true
property string title: "标题"
property color textColor: FluTheme.isDark ? "#000000" : "#FFFFFF"
property bool showDark: false
@ -58,7 +61,7 @@ Rectangle{
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
leftMargin: 14
leftMargin: 10
}
color:root.textColor
fontStyle: FluText.Title
@ -67,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
@ -82,8 +84,9 @@ Rectangle{
RowLayout{
Layout.alignment: Qt.AlignVCenter
spacing: 5
Layout.rightMargin: 14
visible: showDark
spacing: 5
FluText{
text:"夜间模式"
color:root.textColor
@ -98,7 +101,7 @@ Rectangle{
}
FluIconButton{
icon : FluentIcons.FA_window_minimize
icon : FluentIcons.ChromeMinimizeContrast
Layout.alignment: Qt.AlignVCenter
iconSize: 15
text:"最小化"
@ -114,7 +117,7 @@ Rectangle{
return false
return Window.Maximized === window.visibility
}
icon : isRestore ? FluentIcons.FA_window_restore : FluentIcons.FA_window_maximize
icon : isRestore ? FluentIcons.ChromeRestoreContrast : FluentIcons.ChromeMaximizeContrast
color:hovered ? "#20000000" : "#00000000"
Layout.alignment: Qt.AlignVCenter
visible: resizable
@ -126,9 +129,10 @@ Rectangle{
}
}
FluIconButton{
icon : FluentIcons.FA_close
icon : FluentIcons.ChromeCloseContrast
Layout.alignment: Qt.AlignVCenter
text:"关闭"
iconSize: 13
textColor: root.textColor
color:hovered ? "#20000000" : "#00000000"
onClicked: {

28
src/controls/FluArea.qml Normal file
View 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)
}
}

View File

@ -0,0 +1,208 @@
import QtQuick 2.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 icon: -1
signal itemClicked(string data)
id:input
width: 300
color: FluTheme.isDark ? "#FFFFFF" : "#1A1A1A"
selectionColor: {
if(FluTheme.isDark){
return FluTheme.primaryColor.lighter
}else{
return FluTheme.primaryColor.dark
}
}
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
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.ChromeClose
iconSize: 10
width: 20
height: 20
opacity: 0.5
visible: input.text !== ""
anchors{
verticalCenter: parent.verticalCenter
right: parent.right
rightMargin: icon_right.visible ? 25 : 5
}
onClicked:{
input.text = ""
}
}
FluIcon{
id:icon_right
icon: input.icon
iconSize: 15
opacity: 0.5
visible: input.icon != -1
anchors{
verticalCenter: parent.verticalCenter
right: parent.right
rightMargin: 5
}
}
}
Component.onCompleted: {
searchData()
}
Popup{
id:input_popup
visible: input.focus
y:input.height
onClosed: {
input.focus = false
}
background: Rectangle{
width: input.width
radius: 4
FluShadow{
radius: 4
}
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
signal closePopup
anchors.fill: parent
boundsBehavior: ListView.StopAtBounds
clip: true
header: Item{
width: input.width
height: visible ? 38 : 0
visible: list_view.count === 0
FluText{
text:"没有找到结果"
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
leftMargin: 10
}
}
}
ScrollBar.vertical: ScrollBar { }
delegate: Item{
height: 38
width: input.width
Rectangle{
anchors.fill: parent
anchors.topMargin: 2
anchors.bottomMargin: 2
anchors.leftMargin: 5
anchors.rightMargin: 5
color: {
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: {
input_popup.close()
input.itemClicked(modelData)
input.text = modelData
}
}
FluText{
text:modelData
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
leftMargin: 10
}
}
}
}
}
}
}
onTextChanged: {
searchData()
}
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)
}
})
list_view.model = result
}
}

View File

@ -7,8 +7,8 @@ Rectangle {
property string text: "Standard Button"
property int startPadding : 15
property int endPadding : 15
property int topPadding: 8
property int bottomPadding: 8
property int topPadding: 5
property int bottomPadding: 5
property bool disabled: false
property color primaryColor : "#0064B0"
signal clicked
@ -37,7 +37,6 @@ Rectangle {
FluText {
id: button_text
text: button.text
font.pixelSize: 14
leftPadding: button.startPadding
rightPadding: button.endPadding
topPadding: button.topPadding
@ -63,8 +62,9 @@ Rectangle {
anchors.fill: parent
hoverEnabled: true
onClicked: {
if(disabled)
if(disabled){
return
}
button.clicked()
}
}

View File

@ -0,0 +1,5 @@
import QtQuick 2.15
Item {
}

View File

@ -0,0 +1,5 @@
import QtQuick 2.15
Item {
}

View File

@ -9,61 +9,64 @@ Item {
property string text: "Check Box"
property var checkClicked
property bool hovered: mouse_area.containsMouse
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 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 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 disableColor: FluTheme.isDark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(253/255,253/255,253/255,1)
RowLayout{
spacing: 4
Rectangle{
width: 22
height: 22
width: 20
height: 20
radius: 4
border.color: {
if(FluTheme.isDark){
if(checked){
return FluTheme.primaryColor.lighter
}
return Qt.rgba(160/255,160/255,160/255,1)
}else{
if(checked){
if(mouse_area.containsMouse){
return Qt.rgba(25/255,117/255,187/255,1)
}
return FluTheme.primaryColor.dark
}
return Qt.rgba(136/255,136/255,136/255,1)
if(disabled){
return borderDisableColor
}
if(checked){
return borderCheckedColor
}
if(hovered){
return borderHoverColor
}
return borderNormalColor
}
border.width: 1
color: {
if(FluTheme.isDark){
if(checked){
if(mouse_area.containsMouse){
return Qt.rgba(74/255,149/255,207/255,1)
}
return FluTheme.primaryColor.lighter
if(checked){
if(disabled){
return checkedDisableColor
}
if(mouse_area.containsMouse){
return Qt.rgba(62/255,62/255,62/255,1)
if(hovered){
return checkedHoverColor
}
return Qt.rgba(45/255,45/255,45/255,1)
}else{
if(checked){
if(mouse_area.containsMouse){
return Qt.rgba(25/255,117/255,187/255,1)
}
return FluTheme.primaryColor.dark
}
if(mouse_area.containsMouse){
return Qt.rgba(244/255,244/255,244/255,1)
}
return Qt.rgba(247/255,247/255,247/255,1)
return checkedColor
}
if(hovered){
return hoverColor
}
return normalColor
}
FluIcon {
anchors.centerIn: parent
icon: FluentIcons.FA_check
icon: FluentIcons.AcceptMedium
iconSize: 15
visible: checked
color: FluTheme.isDark ? Qt.rgba(0,0,0,1) : Qt.rgba(1,1,1,1)
@ -79,6 +82,7 @@ Item {
id:mouse_area
anchors.fill: parent
hoverEnabled: true
enabled: !disabled
onClicked: {
if(checkClicked){
checkClicked()

View File

@ -23,10 +23,12 @@ Popup {
anchors.centerIn: Overlay.overlay
closePolicy: Popup.CloseOnEscape
background: Rectangle {
id:layout_content
implicitWidth:minWidth
implicitHeight: text_title.height + text_message.height + layout_actions.height
color:FluTheme.isDark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(249/255,249/255,249/255,1)
radius:5
FluShadow{
radius: 5
}

View 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
}
}

View File

@ -0,0 +1,5 @@
import QtQuick 2.15
Item {
}

View File

@ -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)
}

View File

@ -0,0 +1,84 @@
import QtQuick 2.15
import FluentUI 1.0
Item {
property string headerText: "Titlte"
property bool expand: false
id:root
height: layout_header.height + container.height
width: 400
implicitWidth: width
implicitHeight: height
property int contentHeight : 300
default property alias content: container.data
Rectangle{
id:layout_header
width: parent.width
height: 45
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)
MouseArea{
id:root_mouse
anchors.fill: parent
hoverEnabled: true
onClicked: {
expand = !expand
}
}
FluText{
text: headerText
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
leftMargin: 15
}
}
FluIconButton{
anchors{
verticalCenter: parent.verticalCenter
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
iconSize: 15
icon: expand ? FluentIcons.ChevronUp : FluentIcons.ChevronDown
onClicked: {
expand = !expand
}
}
}
Rectangle{
id:container
width: parent.width
clip: true
anchors{
top: layout_header.bottom
left: layout_header.left
}
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)
height: expand ? contentHeight : 0
Behavior on height {
NumberAnimation{
duration: 150
}
}
}
}

View File

@ -8,8 +8,8 @@ Rectangle {
property string text: "Filled Button"
property int startPadding : 15
property int endPadding : 15
property int topPadding: 8
property int bottomPadding: 8
property int topPadding: 5
property int bottomPadding: 5
property bool disabled: false
signal clicked

View File

@ -7,7 +7,7 @@ Text {
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

View File

@ -13,6 +13,11 @@ Rectangle {
signal clicked
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(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 textColor: {
if(FluTheme.isDark){
if(disabled){
@ -29,22 +34,15 @@ Rectangle {
radius: 4
color: {
if(FluTheme.isDark){
if(disabled){
return Qt.rgba(59/255,59/255,59/255,1)
}
return button_mouse.containsMouse ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(50/255,50/255,50/255,1)
}else{
if(disabled){
return Qt.rgba(1,1,1,1)
}
return button_mouse.containsMouse ? Qt.rgba(244/255,244/255,244/255,1) : Qt.rgba(1,1,1,1)
if(disabled){
return disableColor
}
return (hovered || button_mouse.containsMouse) ? hoverColor : normalColor
}
Text {
id:text_icon
font.family: "fontawesome"
font.family: "Segoe Fluent Icons"
font.pixelSize: iconSize
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
@ -57,8 +55,10 @@ Rectangle {
id:button_mouse
anchors.fill: parent
hoverEnabled: true
enabled: !disabled
onClicked: {
if(disabled){
return
}
button.clicked()
}
}
@ -69,7 +69,7 @@ Rectangle {
if(button.text === ""){
return false
}
return button_mouse.containsMouse
return (hovered || button_mouse.containsMouse)
}
delay: 1000
}

View File

@ -192,11 +192,11 @@ FluObject {
FluIcon{
icon:{
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

View File

@ -11,6 +11,7 @@ Popup {
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
FluShadow{
radius: 5
}

View File

@ -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
}
}
}

View File

@ -0,0 +1,392 @@
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
RowLayout{
height:parent.height
spacing: 0
FluIconButton{
icon: 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{
icon: 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{
checked: FluTheme.isDark
onClickFunc:function(){
FluTheme.isDark = !FluTheme.isDark
}
}
}
}
Item{
anchors{
left: displayMode === FluNavigationView.Minimal ? parent.left : layout_list.right
leftMargin: 2
top: nav_app_bar.bottom
right: parent.right
rightMargin: 10
bottom: parent.bottom
bottomMargin: 20
}
StackView{
id:nav_swipe
anchors.fill: parent
clip: true
anchors.margins: 10
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: nav_app_bar.bottom
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
height: 50
FluAutoSuggestBox{
width: 280
anchors.centerIn: parent
icon: 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)
}
}
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
}
}

View File

@ -0,0 +1,7 @@
import QtQuick 2.15
QtObject {
property string title
signal tap
signal repTap
}

View File

@ -0,0 +1,5 @@
import QtQuick 2.15
QtObject {
property string title
}

View File

@ -0,0 +1,5 @@
import QtQuick 2.15
QtObject {
}

View File

@ -4,8 +4,8 @@ import QtQuick.Controls 2.12
FluRectangle {
id: control
width: 180
height: 6
width: 150
height: 5
radius: [3,3,3,3]
clip: true
color: FluTheme.isDark ? Qt.rgba(41/255,41/255,41/255,1) : Qt.rgba(214/255,214/255,214/255,1)

View File

@ -4,13 +4,13 @@ import QtQuick.Controls 2.12
Rectangle {
id: control
width: 60
height: 60
radius: 30
width: 44
height: 44
radius: 22
border.width: linWidth
color: "#00000000"
border.color: FluTheme.isDark ? Qt.rgba(41/255,41/255,41/255,1) : Qt.rgba(214/255,214/255,214/255,1)
property real linWidth : 6
property real linWidth : 5
property real progress: 0.25
property bool indeterminate: true
readonly property real radius2 : radius - linWidth/2

View File

@ -0,0 +1,34 @@
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
}
ScrollView{
clip: true
width: parent.width
contentWidth: parent.width
anchors{
top: text_title.bottom
bottom: parent.bottom
}
ColumnLayout{
id:container
spacing: root.spacing
width: parent.width
}
}
}

View File

@ -6,23 +6,44 @@ Item{
id:root
property int lineWidth: 6
property int dotSize: 30
property int lineSize: 5
property int size: 180
property int dotSize: 28
property int value: 50
enum Orientation {
Horizontal,
Vertical
}
height: control.height
width: control.width
property int orientation: FluSlider.Horizontal
property bool isHorizontal: orientation === FluSlider.Horizontal
rotation: isHorizontal ? 0 : 180
Component.onCompleted: {
dot.x =value/100*control.width - dotSize/2
root.value = Qt.binding(function(){
return (dot.x+15)/control.width*100
})
if(isHorizontal){
dot.x =value/100*control.width - dotSize/2
root.value = Qt.binding(function(){
return (dot.x+dotSize/2)/control.width*100
})
}else{
dot.y =value/100*control.height - dotSize/2
root.value = Qt.binding(function(){
return (dot.y+dotSize/2)/control.height*100
})
}
}
FluRectangle {
id: control
width: 300
height: root.lineWidth
width: isHorizontal ? size : root.lineSize
height: isHorizontal ? root.lineSize : size
radius: [3,3,3,3]
clip: true
anchors.verticalCenter: parent.verticalCenter
@ -30,8 +51,8 @@ Item{
Rectangle{
id:rect
radius: 3
width: control.width*(value/100)
height: control.height
width: isHorizontal ? control.width*(value/100) : control.width
height: isHorizontal ? control.height : control.height*(value/100)
color:FluTheme.isDark ? FluTheme.primaryColor.lighter :FluTheme.primaryColor.dark
}
}
@ -40,11 +61,12 @@ Item{
id:dot
width: dotSize
height: dotSize
FluShadow{
radius: 15
}
radius: 15
anchors.verticalCenter: parent.verticalCenter
FluShadow{
radius: dotSize/2
}
radius: dotSize/2
anchors.verticalCenter: isHorizontal ? parent.verticalCenter : undefined
anchors.horizontalCenter: isHorizontal ? undefined :parent.horizontalCenter
color:FluTheme.isDark ? Qt.rgba(69/255,69/255,69/255,1) :Qt.rgba(1,1,1,1)
Rectangle{
width: dotSize/2
@ -65,9 +87,11 @@ Item{
hoverEnabled: true
drag {
target: dot
axis: Drag.XAxis
minimumX: -dotSize/2
maximumX: control.width - dotSize/2
axis: isHorizontal ? Drag.XAxis : Drag.YAxis
minimumX: isHorizontal ? -dotSize/2 : 0
maximumX: isHorizontal ? (control.width - dotSize/2) : 0
minimumY: isHorizontal ? 0 : -dotSize/2
maximumY: isHorizontal ? 0 : (control.height - dotSize/2)
}
onPressed: {
tool_tip.visible = true
@ -81,6 +105,7 @@ Item{
FluTooltip{
id:tool_tip
text:String(root.value)
y: isHorizontal ? -40 : 32
}
}

View File

@ -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 {
}
}
}

View File

@ -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

View File

@ -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)
}

View File

@ -1,8 +1,356 @@
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:"上午"
}
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: ScrollBar { }
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
ScrollBar.vertical: ScrollBar { }
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
ScrollBar.vertical: ScrollBar { }
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
list_view_1.currentIndex = -1
list_view_2.currentIndex = -1
list_view_3.currentIndex = -1
var pos = root.mapToItem(null, 0, 0)
if(window.height>pos.y+35+340){
popup.y = 35
}else{
popup.y = window.height-(pos.y+340)
}
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;
}
}

View File

@ -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)
}
}
@ -198,8 +197,6 @@ Rectangle {
}
}
}
}
checkClicked:function(){
@ -225,8 +222,9 @@ Rectangle {
FluIconButton{
id:item_layout_expanded
color:"#00000000"
icon:item_layout.expanded?FluentIcons.FA_angle_down:FluentIcons.FA_angle_right
icon: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
}
}
}

View File

@ -14,7 +14,13 @@ 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
@ -22,13 +28,12 @@ Item {
property int maximumHeight
property int borderless:{
if(window === null)
return 4
if(Window.window.visibility === Window.Maximized){
if(!FluTheme.isFrameless){
return 0
}
return 4
return (window && (window.visibility === Window.Maximized)) ? 0 : 4
}
default property alias content: container.data
FluWindowResize{
@ -43,11 +48,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
@ -59,6 +60,12 @@ Item {
color:root.color
anchors.fill: parent
anchors.margins: borderless
clip: true
Behavior on color{
ColorAnimation {
duration: 300
}
}
}
Component.onCompleted: {

0
src/macos_install.sh Normal file → Executable file
View File

View File

@ -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>
@ -34,5 +33,18 @@
<file>controls/FluTextButton.qml</file>
<file>controls/FluContentDialog.qml</file>
<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>
</qresource>
</RCC>

Binary file not shown.

Binary file not shown.