mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-07-01 15:42:20 +08:00
Compare commits
47 Commits
Author | SHA1 | Date | |
---|---|---|---|
9f9d9da601 | |||
6d24cbf37c | |||
d2929ad701 | |||
689843fbef | |||
c6db001b74 | |||
3ec0841b44 | |||
b3d1568de4 | |||
2511c5dba8 | |||
3049be128f | |||
3291b3a882 | |||
d5744a39bd | |||
882606b2f6 | |||
aba33c4d1f | |||
51aef3f3ec | |||
221afeea58 | |||
c19f5d4c48 | |||
d2eb72cc5b | |||
420a9b2bbb | |||
59dacd8fae | |||
7489a4bcbe | |||
6dd859dd1d | |||
98363542d3 | |||
5b836a4d82 | |||
7dcb65f7b6 | |||
60c2ebee56 | |||
88fed82260 | |||
cb94db8a97 | |||
88008e16be | |||
f2db544be0 | |||
6db8c4d4ac | |||
4ab78bbaba | |||
11b2b04cb9 | |||
9f2e066a9f | |||
5b8312dcb9 | |||
b28f15c23b | |||
935f515a49 | |||
70585c007e | |||
bdde046a4d | |||
ad420366f1 | |||
727a0220b4 | |||
ab0fcf5d9c | |||
f43bfec992 | |||
6bf38b5e5e | |||
73ff2b45b9 | |||
7303e7d900 | |||
5ca1b715f3 | |||
cd984fddf5 |
@ -2,7 +2,7 @@
|
||||
|
||||
## 简介
|
||||
|
||||
这是一个漂亮的Fluent组件库,使用QML插件开发的
|
||||
这是一个漂亮的Fluent组件库,使用QML插件开发的。main分支是Qt6.4.3,如果需要qt5的请切换至qt5分支
|
||||
|
||||
## 编译状态
|
||||
| [Windows][win-link]| [Ubuntu][ubuntu-link]|[MacOS][macos-link]|
|
||||
@ -96,4 +96,4 @@
|
||||

|
||||
|
||||
### ⚡ Visitor count
|
||||

|
||||

|
||||
|
@ -2,27 +2,25 @@
|
||||
import QtQuick.Window
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import QtMultimedia
|
||||
import FluentUI
|
||||
|
||||
Window {
|
||||
id:app
|
||||
color: "#00000000"
|
||||
//初始化一个MediaPlayer,解决macos切换到T_MediaPalyer页面崩溃问题
|
||||
MediaPlayer{}
|
||||
Component.onCompleted: {
|
||||
FluApp.init(app)
|
||||
FluTheme.frameless = ("windows" === Qt.platform.os)
|
||||
FluTheme.dark = false
|
||||
FluTheme.darkMode = FluDarkMode.System
|
||||
FluApp.routes = {
|
||||
"/":"qrc:/page/MainPage.qml",
|
||||
"/about":"qrc:/page/AboutPage.qml",
|
||||
"/login":"qrc:/page/LoginPage.qml",
|
||||
"/chat":"qrc:/page/ChatPage.qml",
|
||||
"/media":"qrc:/page/MediaPage.qml",
|
||||
"/singleTaskWindow":"qrc:/page/SingleTaskWindow.qml",
|
||||
"/standardWindow":"qrc:/page/StandardWindow.qml",
|
||||
"/singleInstanceWindow":"qrc:/page/SingleInstanceWindow.qml"
|
||||
}
|
||||
FluApp.initialRoute = "/"
|
||||
FluApp.run()
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,25 @@
|
||||
#include "AppInfo.h"
|
||||
#include "lang/En.h"
|
||||
#include "lang/Zh.h"
|
||||
|
||||
|
||||
AppInfo::AppInfo(QObject *parent)
|
||||
: QObject{parent}
|
||||
{
|
||||
version("1.2.4");
|
||||
version("1.2.6");
|
||||
lang(new En());
|
||||
}
|
||||
|
||||
void AppInfo::changeLang(const QString& locale){
|
||||
if(_lang){
|
||||
_lang->deleteLater();
|
||||
}
|
||||
if(locale=="Zh"){
|
||||
lang(new Zh());
|
||||
}else if(locale=="En"){
|
||||
lang(new En());
|
||||
}else {
|
||||
lang(new En());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,14 +2,17 @@
|
||||
#define APPINFO_H
|
||||
|
||||
#include <QObject>
|
||||
#include "lang/Lang.h"
|
||||
#include "stdafx.h"
|
||||
|
||||
class AppInfo : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY_AUTO(QString,version)
|
||||
Q_PROPERTY_AUTO(Lang*,lang)
|
||||
public:
|
||||
explicit AppInfo(QObject *parent = nullptr);
|
||||
Q_INVOKABLE void changeLang(const QString& locale);
|
||||
};
|
||||
|
||||
#endif // APPINFO_H
|
||||
|
@ -25,11 +25,13 @@ find_package(Qt6 COMPONENTS Core Quick QuickControls2 Concurrent Network Multime
|
||||
|
||||
set(SOURCES
|
||||
ChatController.cpp
|
||||
AppInfo.cpp
|
||||
main.cpp
|
||||
)
|
||||
|
||||
set(HEADERS
|
||||
ChatController.h
|
||||
AppInfo.h
|
||||
)
|
||||
|
||||
set(RESOURCES
|
||||
|
@ -103,6 +103,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'Rectangle{
|
||||
width: 40
|
||||
height: 40
|
||||
|
@ -2,6 +2,7 @@
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Window
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Basic
|
||||
import FluentUI
|
||||
import "./component"
|
||||
|
||||
@ -51,6 +52,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluTextButton{
|
||||
text:"Text Button"
|
||||
onClicked: {
|
||||
@ -92,6 +94,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluButton{
|
||||
text:"Standard Button"
|
||||
onClicked: {
|
||||
@ -133,6 +136,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluFilledButton{
|
||||
text:"Filled Button"
|
||||
onClicked: {
|
||||
@ -174,6 +178,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluToggleButton{
|
||||
text:"Toggle Button"
|
||||
onClicked: {
|
||||
@ -216,6 +221,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluIconButton{
|
||||
iconSource:FluentIcons.ChromeCloseContrast
|
||||
onClicked: {
|
||||
@ -266,6 +272,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluDropDownButton{
|
||||
text:"DropDownButton"
|
||||
items:[
|
||||
@ -327,6 +334,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluRadioButton{
|
||||
selected:true
|
||||
text:"Text Button"
|
||||
@ -365,6 +373,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluCheckBox{
|
||||
text:"Check Box"
|
||||
}'
|
||||
|
@ -23,6 +23,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluCalendarView{
|
||||
|
||||
}'
|
||||
@ -44,6 +45,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluCalendarPicker{
|
||||
|
||||
}'
|
||||
|
@ -39,6 +39,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluCarousel{
|
||||
width: 400
|
||||
height: 300
|
||||
|
@ -30,6 +30,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluCheckBox{
|
||||
text:"Text"
|
||||
}'
|
||||
|
@ -41,6 +41,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluColorView{
|
||||
|
||||
}'
|
||||
@ -64,6 +65,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluColorPicker{
|
||||
|
||||
}'
|
||||
|
@ -32,6 +32,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluDatePicker{
|
||||
|
||||
}'
|
||||
@ -59,6 +60,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluDatePicker{
|
||||
showYear:false
|
||||
}'
|
||||
|
@ -18,22 +18,24 @@ FluScrollablePage{
|
||||
height: 68
|
||||
paddings: 10
|
||||
Layout.topMargin: 20
|
||||
FluButton{
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
Layout.topMargin: 20
|
||||
text:"Show Dialog"
|
||||
onClicked: {
|
||||
dialog.open()
|
||||
}
|
||||
FluButton{
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
Layout.topMargin: 20
|
||||
text:"Show Double Button Dialog"
|
||||
onClicked: {
|
||||
double_btn_dialog.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluContentDialog{
|
||||
id:dialog
|
||||
title:"友情提示"
|
||||
message:"确定要退出程序么?"
|
||||
negativeText:"取消"
|
||||
buttonFlags: FluContentDialog.NegativeButton | FluContentDialog.PositiveButton
|
||||
onNegativeClicked:{
|
||||
showSuccess("点击取消按钮")
|
||||
}
|
||||
@ -41,15 +43,15 @@ FluScrollablePage{
|
||||
onPositiveClicked:{
|
||||
showSuccess("点击确定按钮")
|
||||
}
|
||||
}
|
||||
dialog.open()
|
||||
'
|
||||
}
|
||||
dialog.open()'
|
||||
}
|
||||
|
||||
FluContentDialog{
|
||||
id:dialog
|
||||
id:double_btn_dialog
|
||||
title:"友情提示"
|
||||
message:"确定要退出程序么?"
|
||||
buttonFlags: FluContentDialog.NegativeButton | FluContentDialog.PositiveButton
|
||||
negativeText:"取消"
|
||||
onNegativeClicked:{
|
||||
showSuccess("点击取消按钮")
|
||||
@ -60,5 +62,61 @@ dialog.open()
|
||||
}
|
||||
}
|
||||
|
||||
FluArea{
|
||||
Layout.fillWidth: true
|
||||
height: 68
|
||||
paddings: 10
|
||||
Layout.topMargin: 20
|
||||
FluButton{
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
Layout.topMargin: 20
|
||||
text:"Show Triple Button Dialog"
|
||||
onClicked: {
|
||||
triple_btn_dialog.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluContentDialog{
|
||||
id:dialog
|
||||
title:"友情提示"
|
||||
message:"确定要退出程序么?"
|
||||
negativeText:"取消"
|
||||
buttonFlags: FluContentDialog.NeutralButton | FluContentDialog.NegativeButton | FluContentDialog.PositiveButton
|
||||
negativeText:"取消"
|
||||
onNegativeClicked:{
|
||||
showSuccess("点击取消按钮")
|
||||
}
|
||||
positiveText:"确定"
|
||||
onPositiveClicked:{
|
||||
showSuccess("点击确定按钮")
|
||||
}
|
||||
neutralText:"最小化"
|
||||
onNeutralClicked:{
|
||||
showSuccess("点击最小化按钮")
|
||||
}
|
||||
}
|
||||
dialog.open()'
|
||||
}
|
||||
|
||||
FluContentDialog{
|
||||
id:triple_btn_dialog
|
||||
title:"友情提示"
|
||||
message:"确定要退出程序么?"
|
||||
buttonFlags: FluContentDialog.NeutralButton | FluContentDialog.NegativeButton | FluContentDialog.PositiveButton
|
||||
negativeText:"取消"
|
||||
onNegativeClicked:{
|
||||
showSuccess("点击取消按钮")
|
||||
}
|
||||
positiveText:"确定"
|
||||
onPositiveClicked:{
|
||||
showSuccess("点击确定按钮")
|
||||
}
|
||||
neutralText:"最小化"
|
||||
onNeutralClicked:{
|
||||
showSuccess("点击最小化按钮")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,14 +15,14 @@ FluScrollablePage{
|
||||
|
||||
FluArea{
|
||||
Layout.fillWidth: true
|
||||
height: layout_column.height+40
|
||||
height: layout_column.height+20
|
||||
paddings: 10
|
||||
Layout.topMargin: 20
|
||||
Column{
|
||||
id:layout_column
|
||||
spacing: 15
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
top:parent.top
|
||||
left:parent.left
|
||||
}
|
||||
|
||||
@ -77,12 +77,12 @@ FluScrollablePage{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluExpander{
|
||||
headerText:"打开一个单选框"
|
||||
Item{
|
||||
|
@ -44,6 +44,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluFlipView{
|
||||
Image{
|
||||
source: "qrc:/res/image/banner_1.jpg"
|
||||
@ -97,6 +98,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluFlipView{
|
||||
vertical:true
|
||||
Image{
|
||||
|
@ -52,6 +52,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'showInfo("这是一个Info样式的InfoBar")
|
||||
|
||||
showWarning("这是一个Warning样式的InfoBar")
|
||||
|
@ -38,6 +38,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluMediaPlayer{
|
||||
id:player
|
||||
source:"http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"
|
||||
|
@ -53,6 +53,7 @@ FluScrollablePage{
|
||||
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluMenu{
|
||||
id:menu
|
||||
FluMenuItem:{
|
||||
|
@ -24,6 +24,87 @@ FluScrollablePage{
|
||||
}
|
||||
}
|
||||
|
||||
FluArea{
|
||||
Layout.fillWidth: true
|
||||
height: 86
|
||||
paddings: 10
|
||||
Layout.topMargin: 20
|
||||
Column{
|
||||
spacing: 15
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
}
|
||||
FluText{
|
||||
text:"<font color='red'>Standard</font>模式窗口,每次都会创建新窗口"
|
||||
}
|
||||
FluButton{
|
||||
text:"点击创建窗口"
|
||||
onClicked: {
|
||||
FluApp.navigate("/standardWindow")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FluArea{
|
||||
Layout.fillWidth: true
|
||||
height: 86
|
||||
paddings: 10
|
||||
Layout.topMargin: 10
|
||||
Column{
|
||||
spacing: 15
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
}
|
||||
FluText{
|
||||
text:"<font color='red'>SingleTask</font>模式窗口,如果窗口存在,这激活该窗口"
|
||||
textFormat: Text.RichText
|
||||
}
|
||||
FluButton{
|
||||
text:"点击创建窗口"
|
||||
onClicked: {
|
||||
FluApp.navigate("/singleTaskWindow")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FluArea{
|
||||
Layout.fillWidth: true
|
||||
height: 86
|
||||
paddings: 10
|
||||
Layout.topMargin: 10
|
||||
Column{
|
||||
spacing: 15
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
}
|
||||
FluText{
|
||||
text:"<font color='red'>SingleInstance</font>模式窗口,如果窗口存在,则销毁窗口,然后新建窗口"
|
||||
}
|
||||
FluButton{
|
||||
text:"点击创建窗口"
|
||||
onClicked: {
|
||||
FluApp.navigate("/singleInstanceWindow")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluWindow{
|
||||
//launchMode: FluWindow.Standard
|
||||
//launchMode: FluWindow.SingleTask
|
||||
launchMode: FluWindow.SingleInstance
|
||||
}
|
||||
'
|
||||
}
|
||||
|
||||
|
||||
FluArea{
|
||||
Layout.fillWidth: true
|
||||
height: 100
|
||||
@ -48,6 +129,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluButton{
|
||||
text:"点击跳转"
|
||||
onClicked: {
|
||||
@ -85,6 +167,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'property var loginPageRegister: registerForPageResult("/login")
|
||||
|
||||
Connections{
|
||||
|
@ -21,6 +21,7 @@ FluScrollablePage{
|
||||
|
||||
FluPivot{
|
||||
anchors.fill: parent
|
||||
currentIndex: 2
|
||||
FluPivotItem{
|
||||
title:"All"
|
||||
contentItem:FluText{
|
||||
@ -49,6 +50,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluPivot{
|
||||
anchors.fill: parent
|
||||
FluPivotItem:{
|
||||
|
@ -47,6 +47,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluProgressBar{
|
||||
|
||||
}
|
||||
|
44
example/T_RatingControl.qml
Normal file
44
example/T_RatingControl.qml
Normal file
@ -0,0 +1,44 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Window
|
||||
import QtQuick.Controls
|
||||
import FluentUI
|
||||
import "./component"
|
||||
|
||||
FluScrollablePage{
|
||||
|
||||
title:"RatingControl"
|
||||
leftPadding:10
|
||||
rightPadding:10
|
||||
bottomPadding:20
|
||||
spacing: 0
|
||||
|
||||
FluArea{
|
||||
Layout.fillWidth: true
|
||||
height: 100
|
||||
paddings: 10
|
||||
Layout.topMargin: 20
|
||||
|
||||
Column{
|
||||
spacing: 10
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
FluRatingControl{
|
||||
|
||||
}
|
||||
FluRatingControl{
|
||||
number:10
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluRatingControl{
|
||||
|
||||
}'
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -134,6 +134,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluRectangle{
|
||||
radius: [25,25,25,25]
|
||||
width: 50
|
||||
|
@ -14,6 +14,39 @@ FluScrollablePage{
|
||||
bottomPadding:20
|
||||
spacing: 0
|
||||
|
||||
FluArea{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 20
|
||||
height: 136
|
||||
paddings: 10
|
||||
|
||||
ColumnLayout{
|
||||
spacing: 10
|
||||
anchors{
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
}
|
||||
FluText{
|
||||
text:lang.dark_mode
|
||||
fontStyle: FluText.BodyStrong
|
||||
Layout.bottomMargin: 4
|
||||
}
|
||||
Repeater{
|
||||
model: [{title:"System",mode:FluDarkMode.System},{title:"Light",mode:FluDarkMode.Light},{title:"Dark",mode:FluDarkMode.Dark}]
|
||||
delegate: FluRadioButton{
|
||||
selected : FluTheme.darkMode === modelData.mode
|
||||
text:modelData.title
|
||||
onClicked:{
|
||||
FluTheme.darkMode = modelData.mode
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
FluArea{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 20
|
||||
@ -23,28 +56,62 @@ FluScrollablePage{
|
||||
ColumnLayout{
|
||||
spacing: 10
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
}
|
||||
|
||||
FluText{
|
||||
text:"NavigationView Display Mode"
|
||||
text:lang.navigation_view_display_mode
|
||||
fontStyle: FluText.BodyStrong
|
||||
Layout.bottomMargin: 4
|
||||
}
|
||||
|
||||
Repeater{
|
||||
id:repeater
|
||||
model: [{title:"Open",mode:FluNavigationView.Open},{title:"Compact",mode:FluNavigationView.Compact},{title:"Minimal",mode:FluNavigationView.Minimal},{title:"Auto",mode:FluNavigationView.Auto}]
|
||||
delegate: FluRadioButton{
|
||||
selected : MainEvent.displayMode===modelData.mode
|
||||
text:modelData.title
|
||||
onClicked:{
|
||||
MainEvent.displayMode = modelData.mode
|
||||
MainEvent.displayMode = modelData.mode
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
FluArea{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 20
|
||||
height: 80
|
||||
paddings: 10
|
||||
|
||||
ColumnLayout{
|
||||
spacing: 10
|
||||
anchors{
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
}
|
||||
|
||||
FluText{
|
||||
text:lang.locale
|
||||
fontStyle: FluText.BodyStrong
|
||||
Layout.bottomMargin: 4
|
||||
}
|
||||
|
||||
Flow{
|
||||
spacing: 5
|
||||
Repeater{
|
||||
model: ["Zh","En"]
|
||||
delegate: FluRadioButton{
|
||||
selected : appInfo.lang.objectName === modelData
|
||||
text:modelData
|
||||
onClicked:{
|
||||
console.debug(modelData)
|
||||
appInfo.changeLang(modelData)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluSlider{
|
||||
value:50
|
||||
}'
|
||||
@ -46,6 +47,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluSlider{
|
||||
vertical:true
|
||||
value:50
|
||||
|
@ -78,6 +78,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluStatusView{
|
||||
anchors.fill: parent
|
||||
statusMode: FluStatusView.Loading
|
||||
|
@ -113,6 +113,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluTabView{
|
||||
anchors.fill: parent
|
||||
Component.onCompleted: {
|
||||
|
@ -110,7 +110,6 @@ FluScrollablePage{
|
||||
id:table_view
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 20
|
||||
width:parent.width
|
||||
pageCurrent:1
|
||||
pageCount:10
|
||||
itemCount: 1000
|
||||
@ -141,15 +140,15 @@ FluScrollablePage{
|
||||
width:100
|
||||
}
|
||||
];
|
||||
table_view.columns = columns
|
||||
table_view.columns = columns
|
||||
const dataSource = [
|
||||
{
|
||||
name: "孙悟空”,
|
||||
age: 500,
|
||||
address:"钟灵毓秀的花果山,如神仙仙境的水帘洞",
|
||||
{
|
||||
name: "孙悟空”,
|
||||
age: 500,
|
||||
address:"钟灵毓秀的花果山,如神仙仙境的水帘洞",
|
||||
nickname:"齐天大圣"
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
table_view.dataSource = columns
|
||||
}
|
||||
}'
|
||||
|
@ -45,19 +45,59 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluTextBox{
|
||||
placeholderText:"单行输入框"
|
||||
}'
|
||||
}
|
||||
|
||||
|
||||
FluArea{
|
||||
Layout.fillWidth: true
|
||||
height: 68
|
||||
paddings: 10
|
||||
Layout.topMargin: 20
|
||||
|
||||
FluPasswordBox{
|
||||
Layout.topMargin: 20
|
||||
placeholderText: "请输入密码"
|
||||
Layout.preferredWidth: 300
|
||||
disabled:password_box_switch.selected
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
}
|
||||
}
|
||||
|
||||
Row{
|
||||
spacing: 5
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
right: parent.right
|
||||
}
|
||||
FluToggleSwitch{
|
||||
id:password_box_switch
|
||||
Layout.alignment: Qt.AlignRight
|
||||
text:"Disabled"
|
||||
}
|
||||
}
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluPasswordBox{
|
||||
placeholderText:"请输入密码"
|
||||
}'
|
||||
}
|
||||
|
||||
|
||||
FluArea{
|
||||
Layout.fillWidth: true
|
||||
height: 36+multiine_textbox.height
|
||||
paddings: 10
|
||||
Layout.topMargin: 20
|
||||
|
||||
FluMultilineTextBox{
|
||||
id:multiine_textbox
|
||||
Layout.topMargin: 20
|
||||
placeholderText: "多行输入框"
|
||||
Layout.preferredWidth: 300
|
||||
@ -83,6 +123,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluMultilineTextBox{
|
||||
placeholderText:"多行输入框"
|
||||
}'
|
||||
@ -122,6 +163,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluAutoSuggestBox{
|
||||
placeholderText:"AutoSuggestBox"
|
||||
}'
|
||||
|
@ -58,7 +58,11 @@ FluScrollablePage{
|
||||
Layout.topMargin: 5
|
||||
selected: FluTheme.dark
|
||||
clickFunc:function(){
|
||||
FluTheme.dark = !FluTheme.dark
|
||||
if(FluTheme.dark){
|
||||
FluTheme.darkMode = FluDarkMode.Light
|
||||
}else{
|
||||
FluTheme.darkMode = FluDarkMode.Dark
|
||||
}
|
||||
}
|
||||
}
|
||||
FluText{
|
||||
@ -76,12 +80,12 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluTheme.primaryColor = FluColors.Orange
|
||||
|
||||
FluTheme.dark = true
|
||||
|
||||
FluTheme.nativeText = true
|
||||
'
|
||||
FluTheme.nativeText = true'
|
||||
}
|
||||
|
||||
|
||||
|
@ -37,6 +37,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluTimePicker{
|
||||
|
||||
}'
|
||||
@ -67,6 +68,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluTimePicker{
|
||||
hourFormat:FluTimePicker.HH
|
||||
}'
|
||||
|
@ -30,6 +30,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluToggleSwitch{
|
||||
text:"Text"
|
||||
}'
|
||||
|
@ -45,6 +45,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluIconButton{
|
||||
iconSource:FluentIcons.ChromeCloseContrast
|
||||
iconSize: 15
|
||||
@ -87,6 +88,7 @@ FluScrollablePage{
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluButton{
|
||||
id:button_1
|
||||
text:"删除"
|
||||
@ -98,8 +100,7 @@ FluScrollablePage{
|
||||
onClicked:{
|
||||
showSuccess("点击一个Button")
|
||||
}
|
||||
}
|
||||
'
|
||||
}'
|
||||
}
|
||||
|
||||
|
||||
|
@ -142,6 +142,7 @@ FluScrollablePage {
|
||||
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluTreeView{
|
||||
id:tree_view
|
||||
width:240
|
||||
|
@ -68,7 +68,6 @@ FluExpander{
|
||||
"FluComboBox",
|
||||
"FluContentDialog",
|
||||
"FluContentPage",
|
||||
"FluControl",
|
||||
"FluDatePicker",
|
||||
"FluDivider",
|
||||
"FluDropDownButton",
|
||||
@ -118,7 +117,9 @@ FluExpander{
|
||||
"FluTableView",
|
||||
"FluColors",
|
||||
"FluTheme",
|
||||
"FluStatusView"
|
||||
"FluStatusView",
|
||||
"FluRatingControl",
|
||||
"FluPasswordBox"
|
||||
];
|
||||
code = code.replace(/\n/g, "<br>");
|
||||
code = code.replace(/ /g, " ");
|
||||
|
@ -1,14 +1,21 @@
|
||||
QT += quick quickcontrols2 concurrent network multimedia
|
||||
QT += quick concurrent network multimedia
|
||||
CONFIG += c++17
|
||||
DEFINES += QT_DEPRECATED_WARNINGS QT_NO_WARNING_OUTPUT
|
||||
|
||||
HEADERS += \
|
||||
lang/En.h \
|
||||
lang/Lang.h \
|
||||
lang/Zh.h \
|
||||
stdafx.h \
|
||||
ChatController.h \
|
||||
AppInfo.h
|
||||
|
||||
SOURCES += \
|
||||
ChatController.cpp \
|
||||
AppInfo.cpp \
|
||||
lang/En.cpp \
|
||||
lang/Lang.cpp \
|
||||
lang/Zh.cpp \
|
||||
main.cpp
|
||||
|
||||
RESOURCES += qml.qrc
|
||||
|
@ -10,14 +10,14 @@ FluObject{
|
||||
|
||||
FluPaneItemSeparator{}
|
||||
FluPaneItem{
|
||||
title:"About"
|
||||
title:lang.about
|
||||
icon:FluentIcons.Contact
|
||||
tapFunc:function(){
|
||||
FluApp.navigate("/about")
|
||||
}
|
||||
}
|
||||
FluPaneItem{
|
||||
title:"Settings"
|
||||
title:lang.settings
|
||||
icon:FluentIcons.Settings
|
||||
onTap:{
|
||||
navigationView.push("qrc:/T_Settings.qml")
|
||||
|
@ -8,15 +8,22 @@ FluObject{
|
||||
property var navigationView
|
||||
|
||||
FluPaneItem{
|
||||
title:"Home"
|
||||
icon:FluentIcons.Home
|
||||
title:lang.home
|
||||
// icon:FluentIcons.Home
|
||||
cusIcon: Image{
|
||||
anchors.centerIn: parent
|
||||
source: FluTheme.dark ? "qrc:/res/svg/home_dark.svg" : "qrc:/res/svg/home.svg"
|
||||
sourceSize: Qt.size(30,30)
|
||||
width: 18
|
||||
height: 18
|
||||
}
|
||||
onTap:{
|
||||
navigationView.push("qrc:/T_Home.qml")
|
||||
}
|
||||
}
|
||||
|
||||
FluPaneItemExpander{
|
||||
title:"Basic input"
|
||||
title:lang.basic_input
|
||||
icon:FluentIcons.CheckboxComposite
|
||||
FluPaneItem{
|
||||
title:"Buttons"
|
||||
@ -54,7 +61,7 @@ FluObject{
|
||||
}
|
||||
|
||||
FluPaneItemExpander{
|
||||
title:"Form"
|
||||
title:lang.form
|
||||
icon:FluentIcons.GridView
|
||||
FluPaneItem{
|
||||
title:"TextBox"
|
||||
@ -89,7 +96,7 @@ FluObject{
|
||||
}
|
||||
|
||||
FluPaneItemExpander{
|
||||
title:"Surface"
|
||||
title:lang.surface
|
||||
icon:FluentIcons.SurfaceHub
|
||||
FluPaneItem{
|
||||
title:"InfoBar"
|
||||
@ -106,6 +113,12 @@ FluObject{
|
||||
navigationView.push("qrc:/T_Progress.qml")
|
||||
}
|
||||
}
|
||||
FluPaneItem{
|
||||
title:"RatingControl"
|
||||
onTap:{
|
||||
navigationView.push("qrc:/T_RatingControl.qml")
|
||||
}
|
||||
}
|
||||
FluPaneItem{
|
||||
title:"Badge"
|
||||
onTap:{
|
||||
@ -139,7 +152,7 @@ FluObject{
|
||||
}
|
||||
|
||||
FluPaneItemExpander{
|
||||
title:"Popus"
|
||||
title:lang.popus
|
||||
icon:FluentIcons.ButtonMenu
|
||||
FluPaneItem{
|
||||
title:"Dialog"
|
||||
@ -162,7 +175,7 @@ FluObject{
|
||||
}
|
||||
|
||||
FluPaneItemExpander{
|
||||
title:"Navigation"
|
||||
title:lang.navigation
|
||||
icon:FluentIcons.AllApps
|
||||
FluPaneItem{
|
||||
title:"Pivot"
|
||||
@ -219,7 +232,7 @@ FluObject{
|
||||
}
|
||||
|
||||
FluPaneItemExpander{
|
||||
title:"Theming"
|
||||
title:lang.theming
|
||||
icon:FluentIcons.Brightness
|
||||
FluPaneItem{
|
||||
title:"Theme"
|
||||
@ -242,7 +255,7 @@ FluObject{
|
||||
}
|
||||
|
||||
FluPaneItemExpander{
|
||||
title:"Media"
|
||||
title:lang.media
|
||||
icon:FluentIcons.Media
|
||||
FluPaneItem{
|
||||
title:"MediaPlayer"
|
||||
|
22
example/lang/En.cpp
Normal file
22
example/lang/En.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include "En.h"
|
||||
|
||||
En::En(QObject *parent)
|
||||
: Lang{parent}
|
||||
{
|
||||
setObjectName("En");
|
||||
home("Home");
|
||||
basic_input("Basic Input");
|
||||
form("Form");
|
||||
surface("Surfaces");
|
||||
popus("Popus");
|
||||
navigation("Navigation");
|
||||
theming("Theming");
|
||||
media("Media");
|
||||
dark_mode("Dark Mode");
|
||||
sys_dark_mode("Sync with system");
|
||||
search("Search");
|
||||
about("About");
|
||||
settings("Settings");
|
||||
locale("Locale");
|
||||
navigation_view_display_mode("NavigationView Display Mode");
|
||||
}
|
17
example/lang/En.h
Normal file
17
example/lang/En.h
Normal file
@ -0,0 +1,17 @@
|
||||
#ifndef EN_H
|
||||
#define EN_H
|
||||
|
||||
#include <QObject>
|
||||
#include "Lang.h"
|
||||
|
||||
class En : public Lang
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit En(QObject *parent = nullptr);
|
||||
|
||||
signals:
|
||||
|
||||
};
|
||||
|
||||
#endif // EN_H
|
7
example/lang/Lang.cpp
Normal file
7
example/lang/Lang.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
#include "Lang.h"
|
||||
|
||||
Lang::Lang(QObject *parent)
|
||||
: QObject{parent}
|
||||
{
|
||||
|
||||
}
|
30
example/lang/Lang.h
Normal file
30
example/lang/Lang.h
Normal file
@ -0,0 +1,30 @@
|
||||
#ifndef LANG_H
|
||||
#define LANG_H
|
||||
|
||||
#include <QObject>
|
||||
#include "stdafx.h"
|
||||
|
||||
class Lang : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY_AUTO(QString,home);
|
||||
Q_PROPERTY_AUTO(QString,basic_input);
|
||||
Q_PROPERTY_AUTO(QString,form);
|
||||
Q_PROPERTY_AUTO(QString,surface);
|
||||
Q_PROPERTY_AUTO(QString,popus);
|
||||
Q_PROPERTY_AUTO(QString,navigation);
|
||||
Q_PROPERTY_AUTO(QString,theming);
|
||||
Q_PROPERTY_AUTO(QString,media);
|
||||
Q_PROPERTY_AUTO(QString,dark_mode);
|
||||
Q_PROPERTY_AUTO(QString,sys_dark_mode);
|
||||
Q_PROPERTY_AUTO(QString,search);
|
||||
Q_PROPERTY_AUTO(QString,about);
|
||||
Q_PROPERTY_AUTO(QString,settings);
|
||||
Q_PROPERTY_AUTO(QString,navigation_view_display_mode);
|
||||
Q_PROPERTY_AUTO(QString,locale);
|
||||
public:
|
||||
explicit Lang(QObject *parent = nullptr);
|
||||
|
||||
};
|
||||
|
||||
#endif // LANG_H
|
22
example/lang/Zh.cpp
Normal file
22
example/lang/Zh.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include "Zh.h"
|
||||
|
||||
Zh::Zh(QObject *parent)
|
||||
: Lang{parent}
|
||||
{
|
||||
setObjectName("Zh");
|
||||
home("首页");
|
||||
basic_input("基本输入");
|
||||
form("表单");
|
||||
surface("表面");
|
||||
popus("弹窗");
|
||||
navigation("导航");
|
||||
theming("主题");
|
||||
media("媒体");
|
||||
dark_mode("夜间模式");
|
||||
sys_dark_mode("跟随系统");
|
||||
search("查找");
|
||||
about("关于");
|
||||
settings("设置");
|
||||
locale("语言环境");
|
||||
navigation_view_display_mode("导航视图显示模式");
|
||||
}
|
17
example/lang/Zh.h
Normal file
17
example/lang/Zh.h
Normal file
@ -0,0 +1,17 @@
|
||||
#ifndef ZH_H
|
||||
#define ZH_H
|
||||
|
||||
#include <QObject>
|
||||
#include "Lang.h"
|
||||
|
||||
class Zh : public Lang
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Zh(QObject *parent = nullptr);
|
||||
|
||||
signals:
|
||||
|
||||
};
|
||||
|
||||
#endif // ZH_H
|
@ -3,21 +3,35 @@
|
||||
#include <QQmlContext>
|
||||
#include <QDir>
|
||||
#include <QQuickWindow>
|
||||
#include <QQuickStyle>
|
||||
#include <QProcess>
|
||||
#include "lang/Lang.h"
|
||||
#include "AppInfo.h"
|
||||
#include "ChatController.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication::setOrganizationName("ZhuZiChu");
|
||||
QCoreApplication::setOrganizationDomain("https://zhuzichu520.github.io");
|
||||
QCoreApplication::setApplicationName("FluentUI");
|
||||
QQuickStyle::setStyle("Basic");
|
||||
//将样式设置为Basic,不然会导致组件显示异常
|
||||
qputenv("QT_QUICK_CONTROLS_STYLE","Basic");
|
||||
//6.4及以下监听系统深色模式变化
|
||||
#ifdef Q_OS_WIN
|
||||
qputenv("QT_QPA_PLATFORM","windows:darkmode=2");
|
||||
#endif
|
||||
QGuiApplication::setOrganizationName("ZhuZiChu");
|
||||
QGuiApplication::setOrganizationDomain("https://zhuzichu520.github.io");
|
||||
QGuiApplication::setApplicationName("FluentUI");
|
||||
// QQuickWindow::setGraphicsApi(QSGRendererInterface::Software);
|
||||
QGuiApplication app(argc, argv);
|
||||
app.setQuitOnLastWindowClosed(false);
|
||||
QQmlApplicationEngine engine;
|
||||
qmlRegisterType<ChatController>("Controller",1,0,"ChatController");
|
||||
engine.rootContext()->setContextProperty("appInfo",new AppInfo());
|
||||
AppInfo* appInfo = new AppInfo();
|
||||
QQmlContext * context = engine.rootContext();
|
||||
Lang* lang = appInfo->lang();
|
||||
context->setContextProperty("lang",lang);
|
||||
QObject::connect(appInfo,&AppInfo::langChanged,&app,[context,appInfo]{
|
||||
context->setContextProperty("lang",appInfo->lang());
|
||||
});
|
||||
context->setContextProperty("appInfo",appInfo);
|
||||
const QUrl url(QStringLiteral("qrc:/App.qml"));
|
||||
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
|
||||
&app, [url](QObject *obj, const QUrl &objUrl) {
|
||||
|
@ -7,12 +7,13 @@ FluWindow {
|
||||
|
||||
id:window
|
||||
|
||||
width: 500
|
||||
width: 600
|
||||
height: 600
|
||||
minimumWidth: 500
|
||||
minimumWidth: 600
|
||||
minimumHeight: 600
|
||||
maximumWidth: 500
|
||||
maximumWidth: 600
|
||||
maximumHeight: 600
|
||||
launchMode: FluWindow.SingleTask
|
||||
|
||||
title:"关于"
|
||||
|
||||
@ -59,13 +60,14 @@ FluWindow {
|
||||
|
||||
RowLayout{
|
||||
spacing: 14
|
||||
Layout.topMargin: 20
|
||||
Layout.leftMargin: 15
|
||||
FluText{
|
||||
text:"GitHub:"
|
||||
}
|
||||
FluTextButton{
|
||||
id:text_hublink
|
||||
topPadding:0
|
||||
bottomPadding:0
|
||||
text:"https://github.com/zhuzichu520/FluentUI"
|
||||
Layout.alignment: Qt.AlignBottom
|
||||
onClicked: {
|
||||
@ -73,13 +75,30 @@ FluWindow {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout{
|
||||
spacing: 14
|
||||
Layout.leftMargin: 15
|
||||
FluText{
|
||||
text:"B站:"
|
||||
}
|
||||
FluTextButton{
|
||||
topPadding:0
|
||||
bottomPadding:0
|
||||
text:"https://www.bilibili.com/video/BV1mg4y1M71w/"
|
||||
Layout.alignment: Qt.AlignBottom
|
||||
onClicked: {
|
||||
Qt.openUrlExternally(text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout{
|
||||
spacing: 14
|
||||
Layout.topMargin: 20
|
||||
Layout.leftMargin: 15
|
||||
FluText{
|
||||
id:text_info
|
||||
text:"如果该项目对你有作用,就请点击上方链接给一个免费的star吧!"
|
||||
text:"如果该项目对你有作用,就请点击上方链接给一个免费的star,或者一键三连,谢谢!"
|
||||
ColorAnimation {
|
||||
id: animation
|
||||
target: text_info
|
||||
@ -93,5 +112,43 @@ FluWindow {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout{
|
||||
spacing: 14
|
||||
Layout.leftMargin: 15
|
||||
FluText{
|
||||
text:"捐赠:"
|
||||
}
|
||||
}
|
||||
|
||||
Item{
|
||||
Layout.preferredWidth: parent.width
|
||||
Layout.preferredHeight: 252
|
||||
Row{
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
spacing: 60
|
||||
Image{
|
||||
width: 164.55
|
||||
height: 224.25
|
||||
source: "qrc:/res/image/qrcode_wx.jpg"
|
||||
}
|
||||
Image{
|
||||
width: 162
|
||||
height: 252
|
||||
source: "qrc:/res/image/qrcode_zfb.jpg"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout{
|
||||
spacing: 14
|
||||
Layout.leftMargin: 15
|
||||
FluText{
|
||||
id:text_desc
|
||||
text:"个人开发,维护不易,你们的捐赠就是我继续更新的动力!\n有什么问题提Issues,只要时间充足我就会解决的!!"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -2,23 +2,73 @@
|
||||
import QtQuick.Window
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import "qrc:///global/"
|
||||
import Qt.labs.platform
|
||||
import FluentUI
|
||||
import "qrc:///global/"
|
||||
|
||||
FluWindow {
|
||||
id:rootwindow
|
||||
id:window
|
||||
width: 1000
|
||||
height: 640
|
||||
title: "FluentUI"
|
||||
closeDestory:false
|
||||
minimumWidth: 520
|
||||
minimumHeight: 460
|
||||
|
||||
closeFunc:function(event){
|
||||
close_app.open()
|
||||
event.accepted = false
|
||||
}
|
||||
|
||||
FluAppBar{
|
||||
id:appbar
|
||||
z:9
|
||||
showDark: true
|
||||
width:parent.width
|
||||
darkText: "Dark Mode"
|
||||
darkText: lang.dark_mode
|
||||
}
|
||||
|
||||
SystemTrayIcon {
|
||||
id:system_tray
|
||||
visible: true
|
||||
icon.source: "qrc:/res/image/favicon.ico"
|
||||
tooltip: "FluentUI"
|
||||
menu: Menu {
|
||||
MenuItem {
|
||||
text: "退出"
|
||||
onTriggered: {
|
||||
window.destoryWindow()
|
||||
FluApp.closeApp()
|
||||
}
|
||||
}
|
||||
}
|
||||
onActivated:
|
||||
(reason)=>{
|
||||
if(reason === SystemTrayIcon.Trigger){
|
||||
window.show()
|
||||
window.raise()
|
||||
window.requestActivate()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FluContentDialog{
|
||||
id:close_app
|
||||
title:"退出"
|
||||
message:"确定要退出程序吗?"
|
||||
negativeText:"最小化"
|
||||
buttonFlags: FluContentDialog.NeutralButton | FluContentDialog.NegativeButton | FluContentDialog.PositiveButton
|
||||
onNegativeClicked:{
|
||||
system_tray.showMessage("友情提示","FluentUI已隐藏至托盘,点击托盘可再次激活窗口");
|
||||
window.hide()
|
||||
}
|
||||
positiveText:"退出"
|
||||
neutralText:"取消"
|
||||
onPositiveClicked:{
|
||||
window.destoryWindow()
|
||||
FluApp.closeApp()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
FluNavigationView{
|
||||
@ -35,7 +85,7 @@ FluWindow {
|
||||
anchors.centerIn: parent
|
||||
iconSource: FluentIcons.Search
|
||||
items: ItemsOriginal.getSearchData()
|
||||
placeholderText: "Search"
|
||||
placeholderText: lang.search
|
||||
onItemClicked:
|
||||
(data)=>{
|
||||
ItemsOriginal.startPageByItem(data)
|
||||
|
46
example/page/SingleInstanceWindow.qml
Normal file
46
example/page/SingleInstanceWindow.qml
Normal file
@ -0,0 +1,46 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import FluentUI
|
||||
|
||||
FluWindow {
|
||||
|
||||
id:window
|
||||
|
||||
width: 500
|
||||
height: 600
|
||||
minimumWidth: 500
|
||||
minimumHeight: 600
|
||||
maximumWidth: 500
|
||||
maximumHeight: 600
|
||||
launchMode: FluWindow.SingleInstance
|
||||
|
||||
title:"SingleInstance"
|
||||
|
||||
FluAppBar{
|
||||
id:appbar
|
||||
title:"SingleInstance"
|
||||
width:parent.width
|
||||
}
|
||||
|
||||
FluTextBox{
|
||||
anchors{
|
||||
top:parent.top
|
||||
topMargin:60
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
}
|
||||
|
||||
FluText{
|
||||
wrapMode: Text.WrapAnywhere
|
||||
anchors{
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
leftMargin: 20
|
||||
rightMargin: 20
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
text:"我是一个SingleInstance模式的窗口,如果我存在,我会销毁之前的窗口,并创建一个新窗口"
|
||||
}
|
||||
|
||||
}
|
31
example/page/SingleTaskWindow.qml
Normal file
31
example/page/SingleTaskWindow.qml
Normal file
@ -0,0 +1,31 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import FluentUI
|
||||
|
||||
FluWindow {
|
||||
|
||||
id:window
|
||||
|
||||
width: 500
|
||||
height: 600
|
||||
minimumWidth: 500
|
||||
minimumHeight: 600
|
||||
maximumWidth: 500
|
||||
maximumHeight: 600
|
||||
launchMode: FluWindow.SingleTask
|
||||
|
||||
title:"SingleTask"
|
||||
|
||||
FluAppBar{
|
||||
id:appbar
|
||||
title:"SingleTask"
|
||||
width:parent.width
|
||||
}
|
||||
|
||||
FluText{
|
||||
anchors.centerIn: parent
|
||||
text:"我是一个SingleTask模式的窗口,如果我存在,我就激活窗口"
|
||||
}
|
||||
|
||||
}
|
31
example/page/StandardWindow.qml
Normal file
31
example/page/StandardWindow.qml
Normal file
@ -0,0 +1,31 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import FluentUI
|
||||
|
||||
FluWindow {
|
||||
|
||||
id:window
|
||||
|
||||
width: 500
|
||||
height: 600
|
||||
minimumWidth: 500
|
||||
minimumHeight: 600
|
||||
maximumWidth: 500
|
||||
maximumHeight: 600
|
||||
launchMode: FluWindow.Standard
|
||||
|
||||
title:"Standard"
|
||||
|
||||
FluAppBar{
|
||||
id:appbar
|
||||
title:"Standard"
|
||||
width:parent.width
|
||||
}
|
||||
|
||||
FluText{
|
||||
anchors.centerIn: parent
|
||||
text:"我是一个Standard模式的窗口,每次我都会创建一个新的窗口"
|
||||
}
|
||||
|
||||
}
|
@ -160,5 +160,13 @@
|
||||
<file>T_StatusView.qml</file>
|
||||
<file>T_Settings.qml</file>
|
||||
<file>global/MainEvent.qml</file>
|
||||
<file>res/svg/home.svg</file>
|
||||
<file>res/svg/home_dark.svg</file>
|
||||
<file>page/StandardWindow.qml</file>
|
||||
<file>page/SingleTaskWindow.qml</file>
|
||||
<file>page/SingleInstanceWindow.qml</file>
|
||||
<file>T_RatingControl.qml</file>
|
||||
<file>res/image/qrcode_wx.jpg</file>
|
||||
<file>res/image/qrcode_zfb.jpg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
BIN
example/res/image/qrcode_wx.jpg
Normal file
BIN
example/res/image/qrcode_wx.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 119 KiB |
BIN
example/res/image/qrcode_zfb.jpg
Normal file
BIN
example/res/image/qrcode_zfb.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 145 KiB |
1
example/res/svg/home.svg
Normal file
1
example/res/svg/home.svg
Normal 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="1681271578882" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3664" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M923.733333 394.666667c-85.333333-70.4-206.933333-174.933333-362.666666-309.333334C533.333333 61.866667 490.666667 61.866667 462.933333 85.333333c-155.733333 134.4-277.333333 238.933333-362.666666 309.333334-14.933333 14.933333-25.6 34.133333-25.6 53.333333 0 38.4 32 70.4 70.4 70.4H192v358.4c0 29.866667 23.466667 53.333333 53.333333 53.333333H405.333333c29.866667 0 53.333333-23.466667 53.333334-53.333333v-206.933333h106.666666v206.933333c0 29.866667 23.466667 53.333333 53.333334 53.333333h160c29.866667 0 53.333333-23.466667 53.333333-53.333333V518.4h46.933333c38.4 0 70.4-32 70.4-70.4 0-21.333333-10.666667-40.533333-25.6-53.333333z m-44.8 59.733333h-57.6c-29.866667 0-53.333333 23.466667-53.333333 53.333333v358.4h-138.666667V661.333333c0-29.866667-23.466667-53.333333-53.333333-53.333333h-128c-29.866667 0-53.333333 23.466667-53.333333 53.333333v206.933334H256V507.733333c0-29.866667-23.466667-53.333333-53.333333-53.333333H145.066667c-4.266667 0-6.4-2.133333-6.4-6.4 0-2.133333 2.133333-4.266667 2.133333-6.4 85.333333-70.4 206.933333-174.933333 362.666667-309.333333 4.266667-4.266667 10.666667-4.266667 14.933333 0 155.733333 134.4 277.333333 238.933333 362.666667 309.333333 2.133333 2.133333 2.133333 2.133333 2.133333 4.266667 2.133333 6.4-2.133333 8.533333-4.266667 8.533333z" fill="#2c2c2c" p-id="3665"></path></svg>
|
After Width: | Height: | Size: 1.6 KiB |
1
example/res/svg/home_dark.svg
Normal file
1
example/res/svg/home_dark.svg
Normal 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="1681277986581" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3875" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M923.733333 394.666667c-85.333333-70.4-206.933333-174.933333-362.666666-309.333334C533.333333 61.866667 490.666667 61.866667 462.933333 85.333333c-155.733333 134.4-277.333333 238.933333-362.666666 309.333334-14.933333 14.933333-25.6 34.133333-25.6 53.333333 0 38.4 32 70.4 70.4 70.4H192v358.4c0 29.866667 23.466667 53.333333 53.333333 53.333333H405.333333c29.866667 0 53.333333-23.466667 53.333334-53.333333v-206.933333h106.666666v206.933333c0 29.866667 23.466667 53.333333 53.333334 53.333333h160c29.866667 0 53.333333-23.466667 53.333333-53.333333V518.4h46.933333c38.4 0 70.4-32 70.4-70.4 0-21.333333-10.666667-40.533333-25.6-53.333333z m-44.8 59.733333h-57.6c-29.866667 0-53.333333 23.466667-53.333333 53.333333v358.4h-138.666667V661.333333c0-29.866667-23.466667-53.333333-53.333333-53.333333h-128c-29.866667 0-53.333333 23.466667-53.333333 53.333333v206.933334H256V507.733333c0-29.866667-23.466667-53.333333-53.333333-53.333333H145.066667c-4.266667 0-6.4-2.133333-6.4-6.4 0-2.133333 2.133333-4.266667 2.133333-6.4 85.333333-70.4 206.933333-174.933333 362.666667-309.333333 4.266667-4.266667 10.666667-4.266667 14.933333 0 155.733333 134.4 277.333333 238.933333 362.666667 309.333333 2.133333 2.133333 2.133333 2.133333 2.133333 4.266667 2.133333 6.4-2.133333 8.533333-4.266667 8.533333z" fill="#ffffff" p-id="3876"></path></svg>
|
After Width: | Height: | Size: 1.6 KiB |
@ -24,6 +24,7 @@ set(TARGET_SOURCES
|
||||
FluTheme.cpp
|
||||
Fluent.cpp
|
||||
FluentUI.cpp
|
||||
NativeEventFilter.cpp
|
||||
WindowHelper.cpp
|
||||
qml_plugin.cpp
|
||||
)
|
||||
@ -37,18 +38,12 @@ set(TARGET_HEADERS
|
||||
FluTheme.h
|
||||
Fluent.h
|
||||
FluentUI.h
|
||||
FramelessView.h
|
||||
NativeEventFilter.h
|
||||
WindowHelper.h
|
||||
qml_plugin.h
|
||||
stdafx.h
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
set(TARGET_SOURCES ${TARGET_SOURCES} FramelessView_win.cpp)
|
||||
else()
|
||||
set(TARGET_SOURCES ${TARGET_SOURCES} FramelessView_unix.cpp)
|
||||
endif()
|
||||
|
||||
add_definitions(-DVERSION_IN="1.0.0")
|
||||
add_definitions(-DVURI_STR="FluentUI")
|
||||
|
||||
|
10
src/Def.h
10
src/Def.h
@ -3,6 +3,16 @@
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace Fluent_DarkMode {
|
||||
Q_NAMESPACE
|
||||
enum Fluent_DarkModeType {
|
||||
System = 0x0,
|
||||
Light = 0x1,
|
||||
Dark = 0x2,
|
||||
};
|
||||
Q_ENUMS(Fluent_DarkModeType);
|
||||
}
|
||||
|
||||
namespace Fluent_Awesome {
|
||||
Q_NAMESPACE
|
||||
enum class Fluent_AwesomeType {
|
||||
|
@ -44,8 +44,8 @@ void FluApp::init(QQuickWindow *window){
|
||||
void FluApp::run(){
|
||||
#ifdef Q_OS_WIN
|
||||
if(!isCompositionEnabled()){
|
||||
FluTheme::getInstance()->frameless(false);
|
||||
}
|
||||
FluTheme::getInstance()->frameless(false);
|
||||
}
|
||||
#endif
|
||||
navigate(initialRoute());
|
||||
}
|
||||
@ -58,19 +58,41 @@ void FluApp::navigate(const QString& route,const QJsonObject& argument,FluRegist
|
||||
QQmlEngine *engine = qmlEngine(appWindow);
|
||||
QQmlComponent component(engine, routes().value(route).toString());
|
||||
QVariantMap properties;
|
||||
properties.insert("route",route);
|
||||
if(fluRegister){
|
||||
properties.insert("pageRegister",QVariant::fromValue(fluRegister));
|
||||
}
|
||||
properties.insert("argument",argument);
|
||||
QQuickWindow *view = qobject_cast<QQuickWindow*>(component.createWithInitialProperties(properties));
|
||||
|
||||
int launchMode = view->property("launchMode").toInt();
|
||||
if(launchMode==1){
|
||||
for (auto& pair : wnds) {
|
||||
QString r = pair->property("route").toString();
|
||||
if(r == route){
|
||||
pair->requestActivate();
|
||||
view->deleteLater();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}else if(launchMode==2){
|
||||
for (auto& pair : wnds) {
|
||||
QString r = pair->property("route").toString();
|
||||
if(r == route){
|
||||
pair->close();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(FluTheme::getInstance()->frameless()){
|
||||
view->setFlag(Qt::FramelessWindowHint,true);
|
||||
}
|
||||
wnds.insert(view->winId(),view);
|
||||
if(fluRegister){
|
||||
fluRegister->to(view);
|
||||
}
|
||||
view->setColor(QColor(Qt::transparent));
|
||||
if(view->maximumWidth()==view->minimumWidth()&&view->maximumHeight()==view->minimumHeight()){
|
||||
view->resize(view->minimumSize());
|
||||
}
|
||||
view->show();
|
||||
}
|
||||
|
||||
@ -105,3 +127,7 @@ void FluApp::clipText(const QString& text){
|
||||
QString FluApp::uuid(){
|
||||
return QUuid::createUuid().toString();
|
||||
}
|
||||
|
||||
void FluApp::closeApp(){
|
||||
qApp->exit(0);
|
||||
}
|
||||
|
@ -34,6 +34,8 @@ public:
|
||||
|
||||
Q_INVOKABLE QString uuid();
|
||||
|
||||
Q_INVOKABLE void closeApp();
|
||||
|
||||
public:
|
||||
QMap<quint64, QQuickWindow*> wnds;
|
||||
private:
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "FluTheme.h"
|
||||
|
||||
#include "FluColors.h"
|
||||
#include "Def.h"
|
||||
#include <QPalette>
|
||||
#include <QGuiApplication>
|
||||
|
||||
FluTheme* FluTheme::m_instance = nullptr;
|
||||
|
||||
@ -15,9 +18,44 @@ FluTheme *FluTheme::getInstance()
|
||||
FluTheme::FluTheme(QObject *parent)
|
||||
: QObject{parent}
|
||||
{
|
||||
connect(this,&FluTheme::darkModeChanged,this,[=]{
|
||||
Q_EMIT darkChanged();
|
||||
});
|
||||
primaryColor(FluColors::getInstance()->Blue());
|
||||
textSize(13);
|
||||
nativeText(true);
|
||||
nativeText(false);
|
||||
frameless(true);
|
||||
dark(false);
|
||||
darkMode(Fluent_DarkMode::Fluent_DarkModeType::Light);
|
||||
qApp->installEventFilter(this);
|
||||
}
|
||||
|
||||
bool FluTheme::eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
Q_UNUSED(obj);
|
||||
if (event->type() == QEvent::ApplicationPaletteChange)
|
||||
{
|
||||
Q_EMIT darkChanged();
|
||||
event->accept();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FluTheme::systemDark()
|
||||
{
|
||||
QPalette palette = qApp->palette();
|
||||
QColor color = palette.color(QPalette::Window).rgb();
|
||||
return !(color.red() * 0.2126 + color.green() * 0.7152 + color.blue() * 0.0722 > 255 / 2);
|
||||
}
|
||||
|
||||
bool FluTheme::dark(){
|
||||
if(_darkMode == Fluent_DarkMode::Fluent_DarkModeType::Dark){
|
||||
return true;
|
||||
}else if(_darkMode == Fluent_DarkMode::Fluent_DarkModeType::Light){
|
||||
return false;
|
||||
}else if(_darkMode == Fluent_DarkMode::Fluent_DarkModeType::System){
|
||||
return systemDark();
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -8,17 +8,22 @@
|
||||
class FluTheme : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool dark READ dark NOTIFY darkChanged)
|
||||
Q_PROPERTY_AUTO(FluColorSet*,primaryColor)
|
||||
Q_PROPERTY_AUTO(bool,frameless);
|
||||
Q_PROPERTY_AUTO(bool,dark);
|
||||
Q_PROPERTY_AUTO(int,darkMode);
|
||||
Q_PROPERTY_AUTO(bool,nativeText);
|
||||
Q_PROPERTY_AUTO(int,textSize);
|
||||
public:
|
||||
explicit FluTheme(QObject *parent = nullptr);
|
||||
static FluTheme *getInstance();
|
||||
bool dark();
|
||||
Q_SIGNAL void darkChanged();
|
||||
private:
|
||||
static FluTheme* m_instance;
|
||||
|
||||
bool _dark;
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
bool systemDark();
|
||||
};
|
||||
|
||||
#endif // FLUTHEME_H
|
||||
|
@ -34,6 +34,7 @@ void Fluent::registerTypes(const char *uri){
|
||||
qmlRegisterType<WindowHelper>(uri,major,minor,"WindowHelper");
|
||||
qmlRegisterType<FluColorSet>(uri,major,minor,"FluColorSet");
|
||||
|
||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluRatingControl.qml"),uri,major,minor,"FluRatingControl");
|
||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluStatusView.qml"),uri,major,minor,"FluStatusView");
|
||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluPagination.qml"),uri,major,minor,"FluPagination");
|
||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluToggleButton.qml"),uri,major,minor,"FluToggleButton");
|
||||
@ -87,11 +88,14 @@ void Fluent::registerTypes(const char *uri){
|
||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluRadioButton.qml"),uri,major,minor,"FluRadioButton");
|
||||
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/FluPasswordBox.qml"),uri,major,minor,"FluPasswordBox");
|
||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluText.qml"),uri,major,minor,"FluText");
|
||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluFilledButton.qml"),uri,major,minor,"FluFilledButton");
|
||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluToggleSwitch.qml"),uri,major,minor,"FluToggleSwitch");
|
||||
|
||||
qmlRegisterUncreatableMetaObject(Fluent_Awesome::staticMetaObject, uri,major,minor,"FluentIcons", "Access to enums & flags only");
|
||||
qmlRegisterUncreatableMetaObject(Fluent_DarkMode::staticMetaObject, uri,major,minor,"FluDarkMode", "Access to enums & flags only");
|
||||
|
||||
}
|
||||
|
||||
void Fluent::initializeEngine(QQmlEngine *engine, const char *uri)
|
||||
|
@ -10,72 +10,67 @@ bool NativeEventFilter::nativeEventFilter(const QByteArray &eventType, void *mes
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
if (eventType == "windows_generic_MSG" && FluTheme::getInstance()->frameless()) {
|
||||
MSG* msg = static_cast<MSG *>(message);
|
||||
if (msg == Q_NULLPTR)
|
||||
return false;
|
||||
switch(msg->message) {
|
||||
case WM_COMMAND: {
|
||||
SendMessage(msg->hwnd, WM_SYSCOMMAND, msg->wParam, msg->lParam);
|
||||
*result = DefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam);
|
||||
return true;
|
||||
}
|
||||
case WM_NCCALCSIZE:{
|
||||
NCCALCSIZE_PARAMS& params = *reinterpret_cast<NCCALCSIZE_PARAMS*>(msg->lParam);
|
||||
if (params.rgrc[0].top != 0)
|
||||
params.rgrc[0].top -= 1;
|
||||
*result = WVR_REDRAW;
|
||||
MSG* msg = static_cast<MSG *>(message);
|
||||
if (msg == Q_NULLPTR)
|
||||
return false;
|
||||
switch(msg->message) {
|
||||
case WM_NCCALCSIZE:{
|
||||
NCCALCSIZE_PARAMS& params = *reinterpret_cast<NCCALCSIZE_PARAMS*>(msg->lParam);
|
||||
if (params.rgrc[0].top != 0)
|
||||
params.rgrc[0].top -= 1;
|
||||
*result = WVR_REDRAW;
|
||||
return true;
|
||||
}
|
||||
case WM_NCHITTEST: {
|
||||
auto view = FluApp::getInstance()->wnds[(WId)msg->hwnd];
|
||||
bool isResize = !(view->maximumWidth()==view->minimumWidth()&&view->maximumHeight()==view->minimumHeight());
|
||||
const LONG borderWidth = 8;
|
||||
RECT winrect;
|
||||
GetWindowRect(msg->hwnd, &winrect);
|
||||
long x = GET_X_LPARAM(msg->lParam);
|
||||
long y = GET_Y_LPARAM(msg->lParam);
|
||||
if (x >= winrect.left && x < winrect.left + borderWidth &&
|
||||
y < winrect.bottom && y >= winrect.bottom - borderWidth && isResize) {
|
||||
*result = HTBOTTOMLEFT;
|
||||
return true;
|
||||
}
|
||||
case WM_NCHITTEST: {
|
||||
auto view = FluApp::getInstance()->wnds[(WId)msg->hwnd];
|
||||
bool isResize = !(view->maximumWidth()==view->minimumWidth()&&view->maximumHeight()==view->minimumHeight());
|
||||
const LONG borderWidth = 8;
|
||||
RECT winrect;
|
||||
GetWindowRect(msg->hwnd, &winrect);
|
||||
long x = GET_X_LPARAM(msg->lParam);
|
||||
long y = GET_Y_LPARAM(msg->lParam);
|
||||
if (x >= winrect.left && x < winrect.left + borderWidth &&
|
||||
if (x < winrect.right && x >= winrect.right - borderWidth &&
|
||||
y < winrect.bottom && y >= winrect.bottom - borderWidth && isResize) {
|
||||
*result = HTBOTTOMLEFT;
|
||||
return true;
|
||||
}
|
||||
if (x < winrect.right && x >= winrect.right - borderWidth &&
|
||||
y < winrect.bottom && y >= winrect.bottom - borderWidth && isResize) {
|
||||
*result = HTBOTTOMRIGHT;
|
||||
return true;
|
||||
}
|
||||
if (x >= winrect.left && x < winrect.left + borderWidth &&
|
||||
y >= winrect.top && y < winrect.top + borderWidth && isResize) {
|
||||
*result = HTTOPLEFT;
|
||||
return true;
|
||||
}
|
||||
if (x < winrect.right && x >= winrect.right - borderWidth &&
|
||||
y >= winrect.top && y < winrect.top + borderWidth && isResize) {
|
||||
*result = HTTOPRIGHT;
|
||||
return true;
|
||||
}
|
||||
if (x >= winrect.left && x < winrect.left + borderWidth && isResize) {
|
||||
*result = HTLEFT;
|
||||
return true;
|
||||
}
|
||||
if (x < winrect.right && x >= winrect.right - borderWidth && isResize) {
|
||||
*result = HTRIGHT;
|
||||
return true;
|
||||
}
|
||||
if (y < winrect.bottom && y >= winrect.bottom - borderWidth && isResize) {
|
||||
*result = HTBOTTOM;
|
||||
return true;
|
||||
}
|
||||
if (y >= winrect.top && y < winrect.top + borderWidth && isResize) {
|
||||
*result = HTTOP;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
*result = HTBOTTOMRIGHT;
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
if (x >= winrect.left && x < winrect.left + borderWidth &&
|
||||
y >= winrect.top && y < winrect.top + borderWidth && isResize) {
|
||||
*result = HTTOPLEFT;
|
||||
return true;
|
||||
}
|
||||
if (x < winrect.right && x >= winrect.right - borderWidth &&
|
||||
y >= winrect.top && y < winrect.top + borderWidth && isResize) {
|
||||
*result = HTTOPRIGHT;
|
||||
return true;
|
||||
}
|
||||
if (x >= winrect.left && x < winrect.left + borderWidth && isResize) {
|
||||
*result = HTLEFT;
|
||||
return true;
|
||||
}
|
||||
if (x < winrect.right && x >= winrect.right - borderWidth && isResize) {
|
||||
*result = HTRIGHT;
|
||||
return true;
|
||||
}
|
||||
if (y < winrect.bottom && y >= winrect.bottom - borderWidth && isResize) {
|
||||
*result = HTBOTTOM;
|
||||
return true;
|
||||
}
|
||||
if (y >= winrect.top && y < winrect.top + borderWidth && isResize) {
|
||||
*result = HTTOP;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
@ -23,21 +23,29 @@ WindowHelper::WindowHelper(QObject *parent)
|
||||
|
||||
void WindowHelper::initWindow(QQuickWindow* window){
|
||||
this->window = window;
|
||||
#ifdef Q_OS_WIN
|
||||
if(FluTheme::getInstance()->frameless()){
|
||||
HWND wnd = (HWND)window->winId();
|
||||
SetWindowLongPtr(wnd, GWL_STYLE, static_cast<LONG>(Style::aero_borderless));
|
||||
const MARGINS shadow_on = { 1, 1, 1, 1 };
|
||||
DwmExtendFrameIntoClientArea(wnd, &shadow_on);
|
||||
SetWindowPos(wnd, Q_NULLPTR, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE);
|
||||
ShowWindow(wnd, SW_SHOW);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
QVariant WindowHelper::createRegister(const QString& path){
|
||||
FluRegister *p = new FluRegister(this->window);
|
||||
p->from(this->window);
|
||||
void WindowHelper::firstUpdate(){
|
||||
if(isFisrt){
|
||||
#ifdef Q_OS_WIN
|
||||
if(FluTheme::getInstance()->frameless()){
|
||||
HWND wnd = (HWND)window->winId();
|
||||
SetWindowLongPtr(wnd, GWL_STYLE, static_cast<LONG>(Style::aero_borderless));
|
||||
const MARGINS shadow_on = { 1, 1, 1, 1 };
|
||||
DwmExtendFrameIntoClientArea(wnd, &shadow_on);
|
||||
SetWindowPos(wnd, Q_NULLPTR, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE);
|
||||
ShowWindow(wnd, SW_SHOW);
|
||||
window->setFlag(Qt::FramelessWindowHint,false);
|
||||
}
|
||||
#endif
|
||||
isFisrt = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
QVariant WindowHelper::createRegister(QQuickWindow* window,const QString& path){
|
||||
FluRegister *p = new FluRegister(window);
|
||||
p->from(window);
|
||||
p->path(path);
|
||||
return QVariant::fromValue(p);
|
||||
}
|
||||
|
@ -16,10 +16,13 @@ public:
|
||||
|
||||
Q_INVOKABLE void initWindow(QQuickWindow* window);
|
||||
Q_INVOKABLE void destoryWindow();
|
||||
Q_INVOKABLE QVariant createRegister(const QString& path);
|
||||
Q_INVOKABLE QVariant createRegister(QQuickWindow* window,const QString& path);
|
||||
|
||||
Q_INVOKABLE void firstUpdate();
|
||||
|
||||
private:
|
||||
QQuickWindow* window;
|
||||
bool isFisrt=true;
|
||||
};
|
||||
|
||||
#endif // WINDOWHELPER_H
|
||||
|
@ -24,6 +24,7 @@ Item {
|
||||
y: -Math.round(cursorHeight/2)
|
||||
height: parent.height+cursorHeight
|
||||
anchors.left: parent.left
|
||||
preventStealing: true
|
||||
anchors.right: parent.right
|
||||
function handleMouse(mouse) {
|
||||
if (mouse.buttons & Qt.LeftButton) {
|
||||
|
@ -67,7 +67,6 @@ Rectangle{
|
||||
height: root.height
|
||||
spacing: 0
|
||||
|
||||
|
||||
RowLayout{
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
Layout.rightMargin: 5
|
||||
@ -80,7 +79,11 @@ Rectangle{
|
||||
FluToggleSwitch{
|
||||
selected: FluTheme.dark
|
||||
clickFunc:function(){
|
||||
FluTheme.dark = !FluTheme.dark
|
||||
if(FluTheme.dark){
|
||||
FluTheme.darkMode = FluDarkMode.Light
|
||||
}else{
|
||||
FluTheme.darkMode = FluDarkMode.Dark
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import FluentUI
|
||||
|
||||
Rectangle {
|
||||
|
@ -1,8 +1,9 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Basic
|
||||
import FluentUI
|
||||
|
||||
FluControl {
|
||||
Button {
|
||||
|
||||
property bool disabled: false
|
||||
property color normalColor: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(254/255,254/255,254/255,1)
|
||||
|
@ -67,21 +67,26 @@ Rectangle {
|
||||
modal: true
|
||||
dim:false
|
||||
enter: Transition {
|
||||
NumberAnimation {
|
||||
property: "y"
|
||||
from:0
|
||||
to:popup.y
|
||||
duration: 150
|
||||
}
|
||||
reversible: true
|
||||
NumberAnimation {
|
||||
property: "opacity"
|
||||
from:0
|
||||
to:1
|
||||
duration: 150
|
||||
duration: 83
|
||||
}
|
||||
}
|
||||
|
||||
exit:Transition {
|
||||
NumberAnimation {
|
||||
property: "opacity"
|
||||
from:1
|
||||
to:0
|
||||
duration: 83
|
||||
}
|
||||
}
|
||||
|
||||
contentItem: Item{
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
FluCalendarView{
|
||||
id:container
|
||||
onDateClicked:
|
||||
@ -94,15 +99,19 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
}
|
||||
background: Item{}
|
||||
background: Item{
|
||||
FluShadow{
|
||||
radius: 5
|
||||
}
|
||||
}
|
||||
function showPopup() {
|
||||
var pos = control.mapToItem(null, 0, 0)
|
||||
if(window.height>pos.y+control.height+popup.height){
|
||||
if(window.height>pos.y+control.height+container.height){
|
||||
popup.y = control.height
|
||||
} else if(pos.y>popup.height){
|
||||
popup.y = -popup.height
|
||||
} else if(pos.y>container.height){
|
||||
popup.y = -container.height
|
||||
} else {
|
||||
popup.y = window.height-(pos.y+popup.height)
|
||||
popup.y = window.height-(pos.y+container.height)
|
||||
}
|
||||
popup.x = -(popup.width-control.width)/2
|
||||
popup.open()
|
||||
|
@ -1,9 +1,10 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Basic
|
||||
import QtQuick.Layouts
|
||||
import FluentUI
|
||||
|
||||
FluControl {
|
||||
Button {
|
||||
|
||||
property bool selected: false
|
||||
property var clickFunc
|
||||
|
@ -1,10 +1,11 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Basic
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Window
|
||||
import FluentUI
|
||||
|
||||
FluControl{
|
||||
Button{
|
||||
id:control
|
||||
width: 36
|
||||
height: 36
|
||||
@ -33,34 +34,42 @@ FluControl{
|
||||
height: container.height
|
||||
width: container.width
|
||||
contentItem: Item{
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
FluColorView{
|
||||
id:container
|
||||
}
|
||||
}
|
||||
background:Item{}
|
||||
enter: Transition {
|
||||
NumberAnimation {
|
||||
property: "y"
|
||||
from:0
|
||||
to:popup.y
|
||||
duration: 150
|
||||
background:Item{
|
||||
FluShadow{
|
||||
radius: 5
|
||||
}
|
||||
}
|
||||
enter: Transition {
|
||||
reversible: true
|
||||
NumberAnimation {
|
||||
property: "opacity"
|
||||
from:0
|
||||
to:1
|
||||
duration: 150
|
||||
duration: 83
|
||||
}
|
||||
}
|
||||
|
||||
exit:Transition {
|
||||
NumberAnimation {
|
||||
property: "opacity"
|
||||
from:1
|
||||
to:0
|
||||
duration: 83
|
||||
}
|
||||
}
|
||||
function showPopup() {
|
||||
var pos = control.mapToItem(null, 0, 0)
|
||||
if(window.height>pos.y+control.height+popup.height){
|
||||
if(window.height>pos.y+control.height+container.height){
|
||||
popup.y = control.height
|
||||
} else if(pos.y>popup.height){
|
||||
popup.y = -popup.height
|
||||
} else if(pos.y>container.height){
|
||||
popup.y = -container.height
|
||||
} else {
|
||||
popup.y = window.height-(pos.y+popup.height)
|
||||
popup.y = window.height-(pos.y+container.height)
|
||||
}
|
||||
popup.x = -(popup.width-control.width)/2
|
||||
popup.open()
|
||||
|
@ -7,11 +7,19 @@ Popup {
|
||||
id: popup
|
||||
|
||||
property string title: "Title"
|
||||
property string message: "Messaeg"
|
||||
property string message: "Message"
|
||||
property string neutralText: "Neutral"
|
||||
property string negativeText: "Negative"
|
||||
property string positiveText: "Positive"
|
||||
signal neutralClicked
|
||||
signal negativeClicked
|
||||
signal positiveClicked
|
||||
enum ButtonFlag{
|
||||
NegativeButton=1
|
||||
,NeutralButton=2
|
||||
,PositiveButton=4
|
||||
}
|
||||
property int buttonFlags: FluContentDialog.NegativeButton | FluContentDialog.PositiveButton
|
||||
property var minWidth: {
|
||||
if(Window.window==null)
|
||||
return 400
|
||||
@ -74,40 +82,48 @@ Popup {
|
||||
right: parent.right
|
||||
}
|
||||
|
||||
Item {
|
||||
id:divider
|
||||
width: 1
|
||||
height: parent.height
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
RowLayout{
|
||||
anchors
|
||||
{
|
||||
centerIn: parent
|
||||
margins: spacing
|
||||
fill: parent
|
||||
}
|
||||
spacing: 15
|
||||
FluButton{
|
||||
id:neutral_btn
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
visible: popup.buttonFlags&FluContentDialog.NeutralButton
|
||||
text: neutralText
|
||||
onClicked: {
|
||||
popup.close()
|
||||
neutralClicked()
|
||||
}
|
||||
}
|
||||
|
||||
FluButton{
|
||||
anchors{
|
||||
left: parent.left
|
||||
leftMargin: 20
|
||||
rightMargin: 10
|
||||
right: divider.left
|
||||
verticalCenter: parent.verticalCenter
|
||||
FluButton{
|
||||
id:negative_btn
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
visible: popup.buttonFlags&FluContentDialog.NegativeButton
|
||||
text: negativeText
|
||||
onClicked: {
|
||||
popup.close()
|
||||
negativeClicked()
|
||||
}
|
||||
}
|
||||
text: negativeText
|
||||
onClicked: {
|
||||
popup.close()
|
||||
negativeClicked()
|
||||
}
|
||||
}
|
||||
|
||||
FluFilledButton{
|
||||
anchors{
|
||||
right: parent.right
|
||||
left: divider.right
|
||||
rightMargin: 20
|
||||
leftMargin: 10
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
text: positiveText
|
||||
onClicked: {
|
||||
popup.close()
|
||||
positiveClicked()
|
||||
FluFilledButton{
|
||||
id:positive_btn
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
visible: popup.buttonFlags&FluContentDialog.PositiveButton
|
||||
text: positiveText
|
||||
onClicked: {
|
||||
popup.close()
|
||||
positiveClicked()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.impl
|
||||
import QtQuick.Templates as T
|
||||
import FluentUI
|
||||
|
||||
T.Button {
|
||||
id: control
|
||||
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||
implicitContentWidth + leftPadding + rightPadding)
|
||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||
implicitContentHeight + topPadding + bottomPadding)
|
||||
}
|
@ -100,240 +100,252 @@ Rectangle {
|
||||
Menu{
|
||||
id:popup
|
||||
modal: true
|
||||
width: 300
|
||||
height: 340
|
||||
width: container.width
|
||||
height: container.height
|
||||
dim:false
|
||||
enter: Transition {
|
||||
NumberAnimation {
|
||||
property: "y"
|
||||
from:0
|
||||
to:popup.y
|
||||
duration: 150
|
||||
}
|
||||
reversible: true
|
||||
NumberAnimation {
|
||||
property: "opacity"
|
||||
from:0
|
||||
to:1
|
||||
duration: 150
|
||||
duration: 83
|
||||
}
|
||||
}
|
||||
background:Item{}
|
||||
contentItem: Rectangle{
|
||||
id:container
|
||||
radius: 4
|
||||
anchors.fill: parent
|
||||
color: FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1)
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
|
||||
exit:Transition {
|
||||
NumberAnimation {
|
||||
property: "opacity"
|
||||
from:1
|
||||
to:0
|
||||
duration: 83
|
||||
}
|
||||
}
|
||||
background:Item{
|
||||
FluShadow{
|
||||
radius: 4
|
||||
}
|
||||
}
|
||||
contentItem: Item{
|
||||
clip: true
|
||||
Rectangle{
|
||||
id:container
|
||||
radius: 4
|
||||
width: 300
|
||||
height: 340
|
||||
color: FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1)
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
}
|
||||
FluShadow{
|
||||
radius: 4
|
||||
}
|
||||
|
||||
RowLayout{
|
||||
id:layout_content
|
||||
spacing: 0
|
||||
width: parent.width
|
||||
height: 300
|
||||
RowLayout{
|
||||
id:layout_content
|
||||
spacing: 0
|
||||
width: parent.width
|
||||
height: 300
|
||||
|
||||
Component{
|
||||
id:list_delegate
|
||||
Component{
|
||||
id:list_delegate
|
||||
|
||||
Item{
|
||||
height:38
|
||||
width:getListView().width
|
||||
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.dark){
|
||||
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.dark ? Qt.rgba(63/255,60/255,61/255,1) : Qt.rgba(237/255,237/255,242/255,1)
|
||||
}
|
||||
return FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(0,0,0,0)
|
||||
function getListView(){
|
||||
if(type === 0)
|
||||
return list_view_1
|
||||
if(type === 1)
|
||||
return list_view_2
|
||||
if(type === 2)
|
||||
return list_view_3
|
||||
}
|
||||
radius: 3
|
||||
MouseArea{
|
||||
id:item_mouse
|
||||
|
||||
|
||||
Rectangle{
|
||||
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: {
|
||||
anchors.topMargin: 2
|
||||
anchors.bottomMargin: 2
|
||||
anchors.leftMargin: 5
|
||||
anchors.rightMargin: 5
|
||||
color: {
|
||||
if(getListView().currentIndex === position){
|
||||
if(FluTheme.dark){
|
||||
return Qt.rgba(0,0,0,1)
|
||||
return item_mouse.containsMouse ? Qt.darker(FluTheme.primaryColor.lighter,1.1) : FluTheme.primaryColor.lighter
|
||||
}else{
|
||||
return Qt.rgba(1,1,1,1)
|
||||
return item_mouse.containsMouse ? Qt.lighter(FluTheme.primaryColor.dark,1.1): FluTheme.primaryColor.dark
|
||||
}
|
||||
}
|
||||
if(item_mouse.containsMouse){
|
||||
return FluTheme.dark ? Qt.rgba(63/255,60/255,61/255,1) : Qt.rgba(237/255,237/255,242/255,1)
|
||||
}
|
||||
return FluTheme.dark ? 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
|
||||
}
|
||||
}else{
|
||||
return FluTheme.dark ? "#FFFFFF" : "#1A1A1A"
|
||||
}
|
||||
}
|
||||
anchors.centerIn: parent
|
||||
FluText{
|
||||
text:model
|
||||
color: {
|
||||
if(getListView().currentIndex === position){
|
||||
if(FluTheme.dark){
|
||||
return Qt.rgba(0,0,0,1)
|
||||
}else{
|
||||
return Qt.rgba(1,1,1,1)
|
||||
}
|
||||
}else{
|
||||
return FluTheme.dark ? "#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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
width: parent.width
|
||||
height: 1
|
||||
anchors.top: layout_content.bottom
|
||||
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.dark ? 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{
|
||||
id:layout_actions
|
||||
height: 40
|
||||
radius: 5
|
||||
color: FluTheme.dark ? 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
|
||||
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()
|
||||
|
||||
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()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -362,12 +374,12 @@ Rectangle {
|
||||
text_day.text = day
|
||||
|
||||
var pos = root.mapToItem(null, 0, 0)
|
||||
if(window.height>pos.y+root.height+popup.height){
|
||||
if(window.height>pos.y+root.height+container.height){
|
||||
popup.y = root.height
|
||||
} else if(pos.y>popup.height){
|
||||
popup.y = -popup.height
|
||||
} else if(pos.y>container.height){
|
||||
popup.y = -container.height
|
||||
} else {
|
||||
popup.y = window.height-(pos.y+popup.height)
|
||||
popup.y = window.height-(pos.y+container.height)
|
||||
}
|
||||
popup.open()
|
||||
}
|
||||
|
@ -1,9 +1,10 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Basic
|
||||
import QtQuick.Window
|
||||
import FluentUI
|
||||
|
||||
FluControl {
|
||||
Button {
|
||||
|
||||
property bool disabled: false
|
||||
property color normalColor: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(254/255,254/255,254/255,1)
|
||||
@ -76,12 +77,13 @@ FluControl {
|
||||
|
||||
onClicked: {
|
||||
var pos = control.mapToItem(null, 0, 0)
|
||||
if(window.height>pos.y+control.height+menu.height){
|
||||
var containerHeight = menu.getContainerHeight()
|
||||
if(window.height>pos.y+control.height+containerHeight){
|
||||
menu.y = control.height
|
||||
}else if(pos.y>menu.height){
|
||||
menu.y = -menu.height
|
||||
}else if(pos.y>containerHeight){
|
||||
menu.y = -containerHeight
|
||||
}else{
|
||||
menu.y = window.height-(pos.y+menu.height)
|
||||
menu.y = window.height-(pos.y+containerHeight)
|
||||
}
|
||||
menu.open()
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ Item {
|
||||
rightMargin: 15
|
||||
}
|
||||
color:{
|
||||
if(root_mouse.containsMouse){
|
||||
if(root_mouse.containsMouse || hovered){
|
||||
return FluTheme.dark ? Qt.rgba(73/255,73/255,73/255,1) : Qt.rgba(245/255,245/255,245/255,1)
|
||||
}
|
||||
return FluTheme.dark ? Qt.rgba(0,0,0,0) : Qt.rgba(0,0,0,0)
|
||||
@ -76,6 +76,7 @@ Item {
|
||||
clip: true
|
||||
anchors{
|
||||
top: layout_header.bottom
|
||||
topMargin: -1
|
||||
left: layout_header.left
|
||||
}
|
||||
radius: 4
|
||||
@ -84,7 +85,9 @@ Item {
|
||||
height: expand ? contentHeight : 0
|
||||
Behavior on height {
|
||||
NumberAnimation{
|
||||
duration: 150
|
||||
duration: 167
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: expand ? [ 0, 0, 0, 1 ] : [ 1, 0, 0, 0 ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,9 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Basic
|
||||
import FluentUI
|
||||
|
||||
FluControl {
|
||||
Button {
|
||||
|
||||
property bool disabled: false
|
||||
property color normalColor: FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
||||
|
@ -1,5 +1,6 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Basic
|
||||
import FluentUI
|
||||
|
||||
Item{
|
||||
@ -52,7 +53,7 @@ Item{
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
FluControl{
|
||||
Button{
|
||||
id:btn_start
|
||||
height: vertical ? 20 : 40
|
||||
width: vertical ? 40 : 20
|
||||
@ -82,7 +83,7 @@ Item{
|
||||
}
|
||||
}
|
||||
|
||||
FluControl{
|
||||
Button{
|
||||
id:btn_end
|
||||
height: vertical ? 20 : 40
|
||||
width: vertical ? 40 : 20
|
||||
|
@ -1,8 +1,9 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Basic
|
||||
import FluentUI
|
||||
|
||||
FluControl {
|
||||
Button {
|
||||
|
||||
property int iconSize: 20
|
||||
property int iconSource
|
||||
|
@ -12,38 +12,50 @@ Menu {
|
||||
modal:true
|
||||
dim:false
|
||||
enter: Transition {
|
||||
NumberAnimation {
|
||||
property: "y"
|
||||
from:0
|
||||
to:popup.y
|
||||
duration: animEnabled ? 150 : 0
|
||||
}
|
||||
reversible: true
|
||||
NumberAnimation {
|
||||
property: "opacity"
|
||||
from:0
|
||||
to:1
|
||||
duration: animEnabled ? 150 : 0
|
||||
duration: 83
|
||||
}
|
||||
}
|
||||
|
||||
exit:Transition {
|
||||
NumberAnimation {
|
||||
property: "opacity"
|
||||
from:1
|
||||
to:0
|
||||
duration: 83
|
||||
}
|
||||
}
|
||||
|
||||
background:Item{
|
||||
FluShadow{
|
||||
radius: 5
|
||||
}
|
||||
}
|
||||
background:Item{}
|
||||
contentItem: Item {
|
||||
clip: true
|
||||
Rectangle{
|
||||
anchors.fill: parent
|
||||
color:FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,0.97) : Qt.rgba(237/255,237/255,237/255,0.97)
|
||||
radius: 5
|
||||
}
|
||||
FluShadow{
|
||||
radius: 5
|
||||
}
|
||||
Column{
|
||||
id:container
|
||||
spacing: 5
|
||||
topPadding: 5
|
||||
bottomPadding: 5
|
||||
width: popup.width
|
||||
id:container
|
||||
function closePopup(){
|
||||
popup.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getContainerHeight(){
|
||||
return container.height
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,9 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Basic
|
||||
import FluentUI
|
||||
|
||||
FluTextArea{
|
||||
TextArea{
|
||||
|
||||
property int fontStyle: FluText.Body
|
||||
property int pixelSize : FluTheme.textSize
|
||||
|
@ -1,6 +1,7 @@
|
||||
import QtQuick
|
||||
import QtQuick.Window
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Basic
|
||||
import QtQuick.Layouts
|
||||
import FluentUI
|
||||
|
||||
@ -120,7 +121,9 @@ Item {
|
||||
}
|
||||
Behavior on height {
|
||||
NumberAnimation{
|
||||
duration: 150
|
||||
duration: 167
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: [ 0, 0, 0, 1 ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -137,7 +140,9 @@ Item {
|
||||
}
|
||||
Behavior on height {
|
||||
NumberAnimation{
|
||||
duration: 150
|
||||
duration: 167
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: [ 0, 0, 0, 1 ]
|
||||
}
|
||||
}
|
||||
width: layout_list.width
|
||||
@ -206,12 +211,12 @@ Item {
|
||||
visible:opacity
|
||||
Behavior on opacity {
|
||||
NumberAnimation{
|
||||
duration: 220
|
||||
duration: 83
|
||||
}
|
||||
}
|
||||
Behavior on rotation {
|
||||
NumberAnimation{
|
||||
duration: 150
|
||||
duration: 83
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -246,22 +251,37 @@ Item {
|
||||
return Qt.rgba(0,0,0,0)
|
||||
}
|
||||
}
|
||||
FluIcon{
|
||||
id:item_icon
|
||||
iconSource: {
|
||||
if(model.icon){
|
||||
return model.icon
|
||||
Component{
|
||||
id:com_icon
|
||||
FluIcon{
|
||||
iconSource: {
|
||||
if(model.icon){
|
||||
return model.icon
|
||||
}
|
||||
return 0
|
||||
}
|
||||
return 0
|
||||
iconSize: 15
|
||||
}
|
||||
}
|
||||
|
||||
Item{
|
||||
id:item_icon
|
||||
width: 30
|
||||
height: 30
|
||||
iconSize: 15
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left:parent.left
|
||||
leftMargin: 3
|
||||
}
|
||||
Loader{
|
||||
anchors.centerIn: parent
|
||||
sourceComponent: {
|
||||
if(model.cusIcon){
|
||||
return model.cusIcon
|
||||
}
|
||||
return com_icon
|
||||
}
|
||||
}
|
||||
}
|
||||
FluText{
|
||||
id:item_title
|
||||
@ -275,7 +295,7 @@ Item {
|
||||
visible:opacity
|
||||
Behavior on opacity {
|
||||
NumberAnimation{
|
||||
duration: 220
|
||||
duration: 83
|
||||
}
|
||||
}
|
||||
anchors{
|
||||
@ -298,7 +318,9 @@ Item {
|
||||
Item{
|
||||
Behavior on height {
|
||||
NumberAnimation{
|
||||
duration: 150
|
||||
duration: 167
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: [ 0, 0, 0, 1 ]
|
||||
}
|
||||
}
|
||||
clip: true
|
||||
@ -382,23 +404,39 @@ Item {
|
||||
return Qt.rgba(0,0,0,0)
|
||||
}
|
||||
}
|
||||
FluIcon{
|
||||
id:item_icon
|
||||
iconSource: {
|
||||
if(model.icon){
|
||||
return model.icon
|
||||
Component{
|
||||
id:com_icon
|
||||
FluIcon{
|
||||
iconSource: {
|
||||
if(model.icon){
|
||||
return model.icon
|
||||
}
|
||||
return 0
|
||||
}
|
||||
return 0
|
||||
iconSize: 15
|
||||
}
|
||||
}
|
||||
|
||||
Item{
|
||||
id:item_icon
|
||||
width: 30
|
||||
height: 30
|
||||
iconSize: 15
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left:parent.left
|
||||
leftMargin: 3
|
||||
}
|
||||
Loader{
|
||||
anchors.centerIn: parent
|
||||
sourceComponent: {
|
||||
if(model.cusIcon){
|
||||
return model.cusIcon
|
||||
}
|
||||
return com_icon
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FluText{
|
||||
id:item_title
|
||||
text:model.title
|
||||
@ -411,7 +449,7 @@ Item {
|
||||
visible:opacity
|
||||
Behavior on opacity {
|
||||
NumberAnimation{
|
||||
duration: 220
|
||||
duration: 83
|
||||
}
|
||||
}
|
||||
color:{
|
||||
@ -473,7 +511,9 @@ Item {
|
||||
}
|
||||
Behavior on Layout.preferredWidth{
|
||||
NumberAnimation{
|
||||
duration: 220
|
||||
duration: 167
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: [ 0, 0, 0, 1 ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -513,10 +553,24 @@ Item {
|
||||
clip: true
|
||||
popEnter : Transition{}
|
||||
popExit : Transition {
|
||||
NumberAnimation { properties: "y"; from: 0; to: nav_swipe.height; duration: 200 }
|
||||
NumberAnimation {
|
||||
properties: "y"
|
||||
from: 0
|
||||
to: nav_swipe.height
|
||||
duration: 167
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: [ 1, 0, 0, 0 ]
|
||||
}
|
||||
}
|
||||
pushEnter: Transition {
|
||||
NumberAnimation { properties: "y"; from: nav_swipe.height; to: 0; duration: 200 }
|
||||
NumberAnimation {
|
||||
properties: "y";
|
||||
from: nav_swipe.height;
|
||||
to: 0
|
||||
duration: 167
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: [ 0, 0, 0, 1 ]
|
||||
}
|
||||
}
|
||||
pushExit : Transition{}
|
||||
replaceEnter : Transition{}
|
||||
@ -542,13 +596,17 @@ Item {
|
||||
}
|
||||
Behavior on width{
|
||||
NumberAnimation{
|
||||
duration: 150
|
||||
duration: 167
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: [ 0, 0, 0, 1 ]
|
||||
}
|
||||
}
|
||||
Behavior on x{
|
||||
id:anim_layout_list_x
|
||||
NumberAnimation{
|
||||
duration: 150
|
||||
duration: 167
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: [ 0, 0, 0, 1 ]
|
||||
}
|
||||
}
|
||||
anchors{
|
||||
@ -595,7 +653,7 @@ Item {
|
||||
visible: opacity
|
||||
Behavior on opacity{
|
||||
NumberAnimation{
|
||||
duration: 100
|
||||
duration: 83
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -605,7 +663,7 @@ Item {
|
||||
opacity:d.isCompactAndNotPanel
|
||||
Behavior on opacity{
|
||||
NumberAnimation{
|
||||
duration: 220
|
||||
duration: 83
|
||||
}
|
||||
}
|
||||
hoverColor: FluTheme.dark ? Qt.rgba(1,1,1,0.03) : Qt.rgba(0,0,0,0.03)
|
||||
@ -743,7 +801,7 @@ Item {
|
||||
property: "opacity"
|
||||
from:0
|
||||
to:1
|
||||
duration: 150
|
||||
duration: 83
|
||||
}
|
||||
}
|
||||
background: Rectangle{
|
||||
@ -761,7 +819,7 @@ Item {
|
||||
currentIndex: -1
|
||||
model: control_popup.childModel
|
||||
ScrollBar.vertical: FluScrollBar {}
|
||||
delegate:FluControl{
|
||||
delegate:Button{
|
||||
width: 160
|
||||
padding:10
|
||||
background: Rectangle{
|
||||
|
@ -1,12 +1,10 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import FluentUI
|
||||
import QtQuick.Layouts
|
||||
import FluentUI
|
||||
|
||||
Item {
|
||||
id: control
|
||||
|
||||
|
||||
signal requestPage(int page,int count)
|
||||
property string previousText: "<上一页"
|
||||
property string nextText: "下一页>"
|
||||
|
@ -7,6 +7,7 @@ QtObject {
|
||||
property string title
|
||||
property int order : 0
|
||||
property int icon
|
||||
property Component cusIcon
|
||||
property bool recentlyAdded: false
|
||||
property bool recentlyUpdated: false
|
||||
property string desc
|
||||
|
@ -4,7 +4,8 @@ import FluentUI
|
||||
FluObject {
|
||||
readonly property string key : FluApp.uuid()
|
||||
property string title
|
||||
property int icon
|
||||
property var icon
|
||||
property Component cusIcon
|
||||
property bool isExpand: false
|
||||
property var parent
|
||||
property int idx
|
||||
|
120
src/controls/FluPasswordBox.qml
Normal file
120
src/controls/FluPasswordBox.qml
Normal file
@ -0,0 +1,120 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Basic
|
||||
import FluentUI
|
||||
|
||||
TextField{
|
||||
|
||||
property int fontStyle: FluText.Body
|
||||
property int pixelSize : FluTheme.textSize
|
||||
property bool disabled: false
|
||||
property int iconSource: 0
|
||||
property color normalColor: FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1)
|
||||
property color disableColor: FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)
|
||||
property color placeholderNormalColor: FluTheme.dark ? Qt.rgba(210/255,210/255,210/255,1) : Qt.rgba(96/255,96/255,96/255,1)
|
||||
property color placeholderFocusColor: FluTheme.dark ? Qt.rgba(152/255,152/255,152/255,1) : Qt.rgba(141/255,141/255,141/255,1)
|
||||
property color placeholderDisableColor: FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)
|
||||
|
||||
id:control
|
||||
width: 300
|
||||
enabled: !disabled
|
||||
color: {
|
||||
if(disabled){
|
||||
return disableColor
|
||||
}
|
||||
return normalColor
|
||||
}
|
||||
echoMode:btn_reveal.pressed ? TextField.Normal : TextField.Password
|
||||
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
||||
selectionColor: FluTheme.primaryColor.lightest
|
||||
placeholderTextColor: {
|
||||
if(disabled){
|
||||
return placeholderDisableColor
|
||||
}
|
||||
if(focus){
|
||||
return placeholderFocusColor
|
||||
}
|
||||
return placeholderNormalColor
|
||||
}
|
||||
font.bold: {
|
||||
switch (fontStyle) {
|
||||
case FluText.Display:
|
||||
return true
|
||||
case FluText.TitleLarge:
|
||||
return true
|
||||
case FluText.Title:
|
||||
return true
|
||||
case FluText.SubTitle:
|
||||
return true
|
||||
case FluText.BodyStrong:
|
||||
return true
|
||||
case FluText.Body:
|
||||
return false
|
||||
case FluText.Caption:
|
||||
return false
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
font.pixelSize: {
|
||||
switch (fontStyle) {
|
||||
case FluText.Display:
|
||||
return text.pixelSize * 4.857
|
||||
case FluText.TitleLarge:
|
||||
return text.pixelSize * 2.857
|
||||
case FluText.Title:
|
||||
return text.pixelSize * 2
|
||||
case FluText.SubTitle:
|
||||
return text.pixelSize * 1.428
|
||||
case FluText.Body:
|
||||
return text.pixelSize * 1.0
|
||||
case FluText.BodyStrong:
|
||||
return text.pixelSize * 1.0
|
||||
case FluText.Caption:
|
||||
return text.pixelSize * 0.857
|
||||
default:
|
||||
return text.pixelSize * 1.0
|
||||
}
|
||||
}
|
||||
selectByMouse: true
|
||||
rightPadding: icon_end.visible ? 50 : 30
|
||||
background: FluTextBoxBackground{
|
||||
inputItem: control
|
||||
FluIcon{
|
||||
id:icon_end
|
||||
iconSource: control.iconSource
|
||||
iconSize: 15
|
||||
opacity: 0.5
|
||||
visible: control.iconSource != 0
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
right: parent.right
|
||||
rightMargin: 5
|
||||
}
|
||||
}
|
||||
}
|
||||
FluIconButton{
|
||||
id:btn_reveal
|
||||
iconSource:FluentIcons.RevealPasswordMedium
|
||||
iconSize: 10
|
||||
width: 20
|
||||
height: 20
|
||||
opacity: 0.5
|
||||
visible: control.text !== ""
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
right: parent.right
|
||||
rightMargin: icon_end.visible ? 25 : 5
|
||||
}
|
||||
}
|
||||
TapHandler {
|
||||
acceptedButtons: Qt.RightButton
|
||||
onTapped: control.echoMode !== TextInput.Password && menu.popup()
|
||||
}
|
||||
FluTextBoxMenu{
|
||||
id:menu
|
||||
inputItem: control
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ Item {
|
||||
|
||||
id:control
|
||||
default property alias content: d.children
|
||||
property alias currentIndex: nav_list.currentIndex
|
||||
property color normalColor: FluTheme.dark ? FluColors.Grey120 : FluColors.Grey120
|
||||
property color hoverColor: FluTheme.dark ? FluColors.Grey10 : FluColors.Black
|
||||
|
||||
|
@ -39,7 +39,9 @@ Rectangle {
|
||||
id:behavior
|
||||
enabled: false
|
||||
NumberAnimation{
|
||||
duration: 1000
|
||||
duration: 999
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: [0.55,0.55,0,1]
|
||||
onRunningChanged: {
|
||||
if(!running){
|
||||
behavior.enabled = false
|
||||
@ -68,18 +70,6 @@ Rectangle {
|
||||
ctx.arc(width/2, height/2, radius2 ,-0.5 * Math.PI,-0.5 * Math.PI + progress * 2 * Math.PI);
|
||||
ctx.stroke();
|
||||
ctx.closePath();
|
||||
// var start_x = width/2 + Math.cos(-0.5 * Math.PI) * radius2;
|
||||
// var start_y = height/2 + Math.sin(-0.5 * Math.PI) * radius2;
|
||||
// ctx.beginPath();
|
||||
// ctx.arc(start_x, start_y, 3, 0, 2*Math.PI);
|
||||
// ctx.fill();
|
||||
// ctx.closePath();
|
||||
// var end_x = width/2 + Math.cos(-0.5 * Math.PI + progress * 2 * Math.PI) * radius2;
|
||||
// var end_y = height/2 + Math.sin(-0.5 * Math.PI + progress * 2 * Math.PI) * radius2;
|
||||
// ctx.beginPath();
|
||||
// ctx.arc(end_x, end_y, 3, 0, 2*Math.PI);
|
||||
// ctx.fill();
|
||||
// ctx.closePath();
|
||||
ctx.restore();
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,10 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Basic
|
||||
import QtQuick.Layouts
|
||||
import FluentUI
|
||||
|
||||
FluControl {
|
||||
Button {
|
||||
|
||||
property bool selected: false
|
||||
property bool disabled: false
|
||||
@ -47,7 +48,9 @@ FluControl {
|
||||
}
|
||||
Behavior on border.width {
|
||||
NumberAnimation{
|
||||
duration: 150
|
||||
duration: 167
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: [ 0, 0, 0, 1 ]
|
||||
}
|
||||
}
|
||||
border.color: {
|
||||
|
60
src/controls/FluRatingControl.qml
Normal file
60
src/controls/FluRatingControl.qml
Normal file
@ -0,0 +1,60 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import FluentUI
|
||||
|
||||
Item {
|
||||
|
||||
property int number: 5
|
||||
property int spacing: 4
|
||||
property int size: 18
|
||||
property int value:0
|
||||
|
||||
id:control
|
||||
implicitWidth: container.width
|
||||
implicitHeight: container.height
|
||||
|
||||
QtObject{
|
||||
id:d
|
||||
property int mouseValue: 0
|
||||
property int itemSize: control.size+spacing*2
|
||||
}
|
||||
|
||||
Row{
|
||||
id:container
|
||||
spacing: 0
|
||||
Repeater{
|
||||
model:control.number
|
||||
Item{
|
||||
width: d.itemSize
|
||||
height: d.itemSize
|
||||
FluIcon{
|
||||
property bool isSelected : {
|
||||
if(d.mouseValue!==0){
|
||||
return index<d.mouseValue
|
||||
}
|
||||
return index<control.value
|
||||
}
|
||||
iconSize: control.size
|
||||
iconSource: isSelected ? FluentIcons.FavoriteStarFill : FluentIcons.FavoriteStar
|
||||
iconColor: isSelected ? FluTheme.primaryColor.dark : (FluTheme.dark ? "#FFFFFF" : "#000000")
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea{
|
||||
anchors.fill: container
|
||||
hoverEnabled: true
|
||||
onPositionChanged: (mouse)=>{
|
||||
d.mouseValue = Number(mouse.x / d.itemSize)+1
|
||||
}
|
||||
onExited: {
|
||||
d.mouseValue = 0
|
||||
}
|
||||
onClicked: (mouse)=>{
|
||||
control.value = Number(mouse.x / d.itemSize)+1
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -73,16 +73,16 @@ Item{
|
||||
anchors.horizontalCenter: vertical ? parent.horizontalCenter : undefined
|
||||
color:FluTheme.dark ? Qt.rgba(69/255,69/255,69/255,1) :Qt.rgba(1,1,1,1)
|
||||
Rectangle{
|
||||
width: dotSize/2
|
||||
height: dotSize/2
|
||||
radius: dotSize/4
|
||||
width: dotSize
|
||||
height: dotSize
|
||||
radius: dotSize/2
|
||||
color:FluTheme.dark ? FluTheme.primaryColor.lighter :FluTheme.primaryColor.dark
|
||||
anchors.centerIn: parent
|
||||
scale: {
|
||||
if(control_mouse.pressed){
|
||||
return 0.9
|
||||
return 4/10
|
||||
}
|
||||
return control_mouse.containsMouse || mouse_line.containsMouse ? 1.3 : 1
|
||||
return control_mouse.containsMouse || mouse_line.containsMouse ? 6/10 : 5/10
|
||||
}
|
||||
Behavior on scale {
|
||||
NumberAnimation{
|
||||
|
@ -28,7 +28,7 @@ Item{
|
||||
visible: opacity
|
||||
opacity: statusMode === FluStatusView.Loading
|
||||
Behavior on opacity {
|
||||
NumberAnimation { duration: 150 }
|
||||
NumberAnimation { duration: 83 }
|
||||
}
|
||||
ColumnLayout{
|
||||
anchors.centerIn: parent
|
||||
@ -51,7 +51,7 @@ Item{
|
||||
visible: opacity
|
||||
opacity: statusMode === FluStatusView.Empty
|
||||
Behavior on opacity {
|
||||
NumberAnimation { duration: 150 }
|
||||
NumberAnimation { duration: 83 }
|
||||
}
|
||||
ColumnLayout{
|
||||
anchors.centerIn: parent
|
||||
@ -71,7 +71,7 @@ Item{
|
||||
visible: opacity
|
||||
opacity: statusMode === FluStatusView.Error
|
||||
Behavior on opacity {
|
||||
NumberAnimation { duration: 150 }
|
||||
NumberAnimation { duration: 83 }
|
||||
}
|
||||
ColumnLayout{
|
||||
anchors.centerIn: parent
|
||||
|
@ -1,38 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls.impl
|
||||
import QtQuick.Templates as T
|
||||
|
||||
T.TextArea {
|
||||
id: control
|
||||
|
||||
implicitWidth: Math.max(contentWidth + leftPadding + rightPadding,
|
||||
implicitBackgroundWidth + leftInset + rightInset,
|
||||
placeholder.implicitWidth + leftPadding + rightPadding)
|
||||
implicitHeight: Math.max(contentHeight + topPadding + bottomPadding,
|
||||
implicitBackgroundHeight + topInset + bottomInset,
|
||||
placeholder.implicitHeight + topPadding + bottomPadding)
|
||||
|
||||
padding: 6
|
||||
leftPadding: padding + 4
|
||||
|
||||
color: control.palette.text
|
||||
placeholderTextColor: control.palette.placeholderText
|
||||
selectionColor: control.palette.highlight
|
||||
selectedTextColor: control.palette.highlightedText
|
||||
|
||||
PlaceholderText {
|
||||
id: placeholder
|
||||
x: control.leftPadding
|
||||
y: control.topPadding
|
||||
width: control.width - (control.leftPadding + control.rightPadding)
|
||||
height: control.height - (control.topPadding + control.bottomPadding)
|
||||
|
||||
text: control.placeholderText
|
||||
font: control.font
|
||||
color: control.placeholderTextColor
|
||||
verticalAlignment: control.verticalAlignment
|
||||
visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
|
||||
elide: Text.ElideRight
|
||||
renderType: control.renderType
|
||||
}
|
||||
}
|
@ -1,8 +1,9 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Basic
|
||||
import FluentUI
|
||||
|
||||
FluTextFiled{
|
||||
TextField{
|
||||
|
||||
property int fontStyle: FluText.Body
|
||||
property int pixelSize : FluTheme.textSize
|
||||
|
@ -1,8 +1,9 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Basic
|
||||
import FluentUI
|
||||
|
||||
FluControl {
|
||||
Button {
|
||||
|
||||
property bool disabled: false
|
||||
property color normalColor: FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
||||
@ -12,8 +13,8 @@ FluControl {
|
||||
property bool textBold: true
|
||||
|
||||
id: control
|
||||
topPadding:5
|
||||
bottomPadding:5
|
||||
topPadding:0
|
||||
bottomPadding:0
|
||||
leftPadding:0
|
||||
rightPadding:0
|
||||
enabled: !disabled
|
||||
|
@ -1,46 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls.impl
|
||||
import QtQuick.Templates as T
|
||||
|
||||
T.TextField {
|
||||
id: control
|
||||
|
||||
implicitWidth: implicitBackgroundWidth + leftInset + rightInset
|
||||
|| Math.max(contentWidth, placeholder.implicitWidth) + leftPadding + rightPadding
|
||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||
contentHeight + topPadding + bottomPadding,
|
||||
placeholder.implicitHeight + topPadding + bottomPadding)
|
||||
|
||||
padding: 6
|
||||
leftPadding: padding + 4
|
||||
|
||||
color: control.palette.text
|
||||
selectionColor: control.palette.highlight
|
||||
selectedTextColor: control.palette.highlightedText
|
||||
placeholderTextColor: control.palette.placeholderText
|
||||
verticalAlignment: TextInput.AlignVCenter
|
||||
|
||||
PlaceholderText {
|
||||
id: placeholder
|
||||
x: control.leftPadding
|
||||
y: control.topPadding
|
||||
width: control.width - (control.leftPadding + control.rightPadding)
|
||||
height: control.height - (control.topPadding + control.bottomPadding)
|
||||
|
||||
text: control.placeholderText
|
||||
font: control.font
|
||||
color: control.placeholderTextColor
|
||||
verticalAlignment: control.verticalAlignment
|
||||
visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
|
||||
elide: Text.ElideRight
|
||||
renderType: control.renderType
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
implicitWidth: 200
|
||||
implicitHeight: 40
|
||||
border.width: control.activeFocus ? 2 : 1
|
||||
color: control.palette.base
|
||||
border.color: control.activeFocus ? control.palette.highlight : control.palette.mid
|
||||
}
|
||||
}
|
@ -99,243 +99,249 @@ Rectangle {
|
||||
text:"AM/PM"
|
||||
}
|
||||
|
||||
Popup{
|
||||
Menu{
|
||||
id:popup
|
||||
width: 300
|
||||
height: 340
|
||||
width: container.width
|
||||
height: container.height
|
||||
modal: true
|
||||
dim:false
|
||||
enter: Transition {
|
||||
reversible: true
|
||||
NumberAnimation {
|
||||
property: "opacity"
|
||||
from:0
|
||||
to:1
|
||||
duration: 150
|
||||
}
|
||||
NumberAnimation {
|
||||
property: "y"
|
||||
from:0
|
||||
to:popup.y
|
||||
duration: 150
|
||||
duration: 83
|
||||
}
|
||||
}
|
||||
background:Item{}
|
||||
contentItem: Rectangle{
|
||||
id:container
|
||||
anchors.fill: parent
|
||||
radius: 4
|
||||
color: FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1)
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
|
||||
exit:Transition {
|
||||
NumberAnimation {
|
||||
property: "opacity"
|
||||
from:1
|
||||
to:0
|
||||
duration: 83
|
||||
}
|
||||
}
|
||||
background:Item{
|
||||
FluShadow{
|
||||
radius: 4
|
||||
}
|
||||
}
|
||||
contentItem: Item{
|
||||
clip: true
|
||||
Rectangle{
|
||||
id:container
|
||||
height: 340
|
||||
width: 300
|
||||
radius: 4
|
||||
color: FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1)
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
}
|
||||
RowLayout{
|
||||
id:layout_content
|
||||
spacing: 0
|
||||
width: parent.width
|
||||
height: 300
|
||||
|
||||
RowLayout{
|
||||
id:layout_content
|
||||
spacing: 0
|
||||
width: parent.width
|
||||
height: 300
|
||||
Component{
|
||||
id:list_delegate
|
||||
|
||||
Component{
|
||||
id:list_delegate
|
||||
Item{
|
||||
height:38
|
||||
width:getListView().width
|
||||
|
||||
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.dark){
|
||||
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.dark ? Qt.rgba(63/255,60/255,61/255,1) : Qt.rgba(237/255,237/255,242/255,1)
|
||||
}
|
||||
return FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(0,0,0,0)
|
||||
function getListView(){
|
||||
if(type === 0)
|
||||
return list_view_1
|
||||
if(type === 1)
|
||||
return list_view_2
|
||||
if(type === 2)
|
||||
return list_view_3
|
||||
}
|
||||
radius: 3
|
||||
MouseArea{
|
||||
id:item_mouse
|
||||
|
||||
|
||||
Rectangle{
|
||||
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: {
|
||||
anchors.topMargin: 2
|
||||
anchors.bottomMargin: 2
|
||||
anchors.leftMargin: 5
|
||||
anchors.rightMargin: 5
|
||||
color: {
|
||||
if(getListView().currentIndex === position){
|
||||
if(FluTheme.dark){
|
||||
return Qt.rgba(0,0,0,1)
|
||||
return item_mouse.containsMouse ? Qt.darker(FluTheme.primaryColor.lighter,1.1) : FluTheme.primaryColor.lighter
|
||||
}else{
|
||||
return Qt.rgba(1,1,1,1)
|
||||
return item_mouse.containsMouse ? Qt.lighter(FluTheme.primaryColor.dark,1.1): FluTheme.primaryColor.dark
|
||||
}
|
||||
}
|
||||
if(item_mouse.containsMouse){
|
||||
return FluTheme.dark ? Qt.rgba(63/255,60/255,61/255,1) : Qt.rgba(237/255,237/255,242/255,1)
|
||||
}
|
||||
return FluTheme.dark ? 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
|
||||
}
|
||||
}else{
|
||||
return FluTheme.dark ? "#FFFFFF" : "#1A1A1A"
|
||||
}
|
||||
}
|
||||
anchors.centerIn: parent
|
||||
FluText{
|
||||
text:model
|
||||
color: {
|
||||
if(getListView().currentIndex === position){
|
||||
if(FluTheme.dark){
|
||||
return Qt.rgba(0,0,0,1)
|
||||
}else{
|
||||
return Qt.rgba(1,1,1,1)
|
||||
}
|
||||
}else{
|
||||
return FluTheme.dark ? "#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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
width: parent.width
|
||||
height: 1
|
||||
anchors.top: layout_content.bottom
|
||||
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.dark ? 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{
|
||||
id:layout_actions
|
||||
height: 40
|
||||
radius: 5
|
||||
color: FluTheme.dark ? 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
|
||||
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()
|
||||
|
||||
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() {
|
||||
@ -373,12 +379,12 @@ Rectangle {
|
||||
}
|
||||
|
||||
var pos = root.mapToItem(null, 0, 0)
|
||||
if(window.height>pos.y+root.height+popup.height){
|
||||
if(window.height>pos.y+root.height+container.height){
|
||||
popup.y = root.height
|
||||
} else if(pos.y>popup.height){
|
||||
popup.y = -popup.height
|
||||
} else if(pos.y>container.height){
|
||||
popup.y = -container.height
|
||||
} else {
|
||||
popup.y = window.height-(pos.y+popup.height)
|
||||
popup.y = window.height-(pos.y+container.height)
|
||||
}
|
||||
popup.open()
|
||||
}
|
||||
|
@ -1,8 +1,9 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Basic
|
||||
import FluentUI
|
||||
|
||||
FluControl {
|
||||
Button {
|
||||
|
||||
property bool disabled: false
|
||||
property bool selected: false
|
||||
|
@ -1,9 +1,10 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import FluentUI
|
||||
import QtQuick.Controls.Basic
|
||||
import QtQuick.Layouts
|
||||
import FluentUI
|
||||
|
||||
FluControl {
|
||||
Button {
|
||||
|
||||
property bool selected: false
|
||||
property var clickFunc
|
||||
@ -57,31 +58,45 @@ FluControl {
|
||||
border.width: 1
|
||||
border.color: selected ? Qt.lighter(FluTheme.primaryColor.dark,1.2) : "#666666"
|
||||
Rectangle {
|
||||
width: pressed ? control.height - 4 : control.height - 8
|
||||
width: pressed ? 28 : 20
|
||||
anchors{
|
||||
left: selected ? undefined : parent.left
|
||||
leftMargin: selected ? control_backgound.width - width - 4 : 4
|
||||
leftMargin: selected ? 20 : 0
|
||||
right: selected ? parent.right : undefined
|
||||
rightMargin: selected ? 4 : control_backgound.width - width - 4
|
||||
rightMargin: selected ? 0: 20
|
||||
}
|
||||
height: control.height - 8
|
||||
radius: width / 2
|
||||
antialiasing: true
|
||||
scale: hovered ? 1.2 : 1.0
|
||||
smooth: true
|
||||
height: 20
|
||||
radius: 10
|
||||
scale: hovered ? 7/10 : 6/10
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: selected ? "#FFFFFF" : "#666666"
|
||||
Behavior on anchors.leftMargin {
|
||||
NumberAnimation { duration: 150 }
|
||||
NumberAnimation {
|
||||
duration: 167
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: [ 1, 0, 0, 0 ]
|
||||
}
|
||||
}
|
||||
Behavior on anchors.rightMargin {
|
||||
NumberAnimation { duration: 150 }
|
||||
NumberAnimation {
|
||||
duration: 167
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: [ 1, 0, 0, 0 ]
|
||||
}
|
||||
}
|
||||
Behavior on width {
|
||||
NumberAnimation { duration: 150 }
|
||||
NumberAnimation {
|
||||
duration: 167
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: [ 1, 0, 0, 0 ]
|
||||
}
|
||||
}
|
||||
Behavior on scale {
|
||||
NumberAnimation { duration: 150 }
|
||||
NumberAnimation {
|
||||
duration: 167
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: [ 1, 0, 0, 0 ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user