Compare commits
98 Commits
Author | SHA1 | Date | |
---|---|---|---|
d5ca38dec2 | |||
cb50c31e1e | |||
561b4ec8c0 | |||
4df6800ea4 | |||
1ecc1bd569 | |||
0810572e27 | |||
5ac0ba7463 | |||
596457cf59 | |||
8595b2fdec | |||
2337680aaf | |||
ba06480436 | |||
0d87dadc61 | |||
7290b98fdb | |||
78815224fe | |||
6275c161fe | |||
9f24cdaebd | |||
e2ff752ed9 | |||
ea88707366 | |||
112bb6e07a | |||
26ad581072 | |||
03771cd7c9 | |||
9223d5f937 | |||
a273aa4588 | |||
fbcb65f549 | |||
082fd79c51 | |||
80619f6974 | |||
ad4d077480 | |||
ff93a6204a | |||
5a7dfeea6e | |||
0240244bba | |||
887fd2c02b | |||
e625b91b08 | |||
a5cf6f734b | |||
414bc14996 | |||
7276eb5f2f | |||
b6c689e0ec | |||
a48bc51edc | |||
b2d0975ed7 | |||
7dea573069 | |||
0d4dd483da | |||
d1656cfb63 | |||
73cc5bccc8 | |||
9ff81251c8 | |||
74940665ae | |||
21ddc79f3f | |||
64bbae9266 | |||
bbb6fe9329 | |||
c42f3ef70f | |||
f13f1727af | |||
9f9e48659b | |||
294606d019 | |||
bfa5c93d40 | |||
9656b3dd95 | |||
8a52f143d7 | |||
dc3b1acaa5 | |||
1a8d06331f | |||
d09414db1b | |||
bf3006415b | |||
cdba8b7921 | |||
192c65a510 | |||
90943674b3 | |||
157dc9166b | |||
a7e8a5e4cf | |||
96071ac8d7 | |||
e25b944704 | |||
1566e3934e | |||
16e71f01b1 | |||
e54c161aa6 | |||
2147965b00 | |||
3a940466d5 | |||
564b27cd02 | |||
4be2ad6ba0 | |||
1d9f6f5eff | |||
0610f63f26 | |||
d741b3eb4f | |||
cb7d2097f2 | |||
dff77d3d4f | |||
6d0834c653 | |||
059a1b17cc | |||
e1096b8e22 | |||
cd577c5599 | |||
d43532986a | |||
4c9e576072 | |||
b254064e26 | |||
ffd8072826 | |||
9a1db0b230 | |||
9786e69fc2 | |||
82be3b12e3 | |||
1c0f5acaf8 | |||
243f8aa248 | |||
cbb8c3122b | |||
9f2c58306c | |||
adc3558e02 | |||
98d73eb6cb | |||
b442696f92 | |||
82f606dd65 | |||
4efb91084a | |||
103dbe9d56 |
@ -4,6 +4,13 @@ project(FluentUI VERSION 0.1 LANGUAGES CXX)
|
|||||||
|
|
||||||
option(FLUENTUI_BUILD_EXAMPLES "Build FluentUI demo applications." ON)
|
option(FLUENTUI_BUILD_EXAMPLES "Build FluentUI demo applications." ON)
|
||||||
option(FLUENTUI_BUILD_FRAMELESSHEPLER "Build FramelessHelper." ON)
|
option(FLUENTUI_BUILD_FRAMELESSHEPLER "Build FramelessHelper." ON)
|
||||||
|
option(FLUENTUI_BUILD_STATIC_LIB "Build static library." OFF)
|
||||||
|
|
||||||
|
#设置QML插件输出目录,可以通过外部设置,如果外部没有设置就默认到<QT_SDK_DIR_PATH>\qml\FluentUI目录下
|
||||||
|
set(FLUENTUI_QML_PLUGIN_DIRECTORY "" CACHE PATH "Path to FluentUI plugin")
|
||||||
|
if(NOT FLUENTUI_QML_PLUGIN_DIRECTORY)
|
||||||
|
set(FLUENTUI_QML_PLUGIN_DIRECTORY ${CMAKE_PREFIX_PATH}/qml/FluentUI)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
||||||
@ -12,11 +19,15 @@ if (FLUENTUI_BUILD_EXAMPLES)
|
|||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (FLUENTUI_BUILD_FRAMELESSHEPLER)
|
if (FLUENTUI_BUILD_FRAMELESSHEPLER)
|
||||||
add_definitions(-DFRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT)
|
set(FRAMELESSHELPER_BUILD_STATIC ON)
|
||||||
add_definitions(-DFRAMELESSHELPER_QUICK_NO_DEBUG_OUTPUT)
|
set(FRAMELESSHELPER_NO_SUMMARY OFF)
|
||||||
|
set(FRAMELESSHELPER_NO_DEBUG_OUTPUT OFF)
|
||||||
|
set(FRAMELESSHELPER_BUILD_WIDGETS OFF)
|
||||||
add_subdirectory(framelesshelper)
|
add_subdirectory(framelesshelper)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
message("------------------------ FluentUI ------------------------")
|
message("------------------------ FluentUI ------------------------")
|
||||||
message("Build FluentUI demo applications.: ${FLUENTUI_BUILD_EXAMPLES}")
|
message("Build FluentUI demo applications.: ${FLUENTUI_BUILD_EXAMPLES}")
|
||||||
message("Build FramelessHelper.: ${FLUENTUI_BUILD_FRAMELESSHEPLER}")
|
message("Build FramelessHelper.: ${FLUENTUI_BUILD_FRAMELESSHEPLER}")
|
||||||
|
message("Build static library.: ${FLUENTUI_BUILD_STATIC_LIB}")
|
||||||
|
message("Path to FluentUI plugin.: ${FLUENTUI_QML_PLUGIN_DIRECTORY}")
|
||||||
|
0
doc/preview/demo_content_dialog.png
Executable file → Normal file
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
0
doc/preview/demo_filledbtn.png
Executable file → Normal file
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
0
doc/preview/demo_icon.png
Executable file → Normal file
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
0
doc/preview/demo_infobar.png
Executable file → Normal file
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
0
doc/preview/demo_large.png
Executable file → Normal file
Before Width: | Height: | Size: 192 KiB After Width: | Height: | Size: 192 KiB |
0
doc/preview/demo_multiline_textbox.png
Executable file → Normal file
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
0
doc/preview/demo_progress_bar_ring.png
Executable file → Normal file
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
0
doc/preview/demo_radiobtn.png
Executable file → Normal file
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
0
doc/preview/demo_rectangle.png
Executable file → Normal file
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
0
doc/preview/demo_slider.png
Executable file → Normal file
Before Width: | Height: | Size: 997 B After Width: | Height: | Size: 997 B |
0
doc/preview/demo_standardbtn.png
Executable file → Normal file
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
0
doc/preview/demo_textbox.png
Executable file → Normal file
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
0
doc/preview/demo_textbtn.png
Executable file → Normal file
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
0
doc/preview/demo_toggle_switch.png
Executable file → Normal file
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
0
doc/preview/demo_tooltip.png
Executable file → Normal file
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
0
doc/preview/demo_tree_view.png
Executable file → Normal file
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
0
doc/preview/qt_creator_project.png
Executable file → Normal file
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 61 KiB |
@ -3,12 +3,16 @@ cmake_minimum_required(VERSION 3.20)
|
|||||||
project(example VERSION 0.1 LANGUAGES CXX)
|
project(example VERSION 0.1 LANGUAGES CXX)
|
||||||
|
|
||||||
#配置通用编译
|
#配置通用编译
|
||||||
set(CMAKE_AUTOMOC ON)
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE)
|
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
#判断FluentUI库类型
|
||||||
|
if(FLUENTUI_BUILD_STATIC_LIB)
|
||||||
|
add_definitions(-DFLUENTUI_BUILD_STATIC_LIB)
|
||||||
|
endif()
|
||||||
|
|
||||||
#设置可执行文件输出目录
|
#设置可执行文件输出目录
|
||||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/debug)
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/debug)
|
||||||
@ -20,10 +24,17 @@ endif()
|
|||||||
file(TO_CMAKE_PATH "/" PATH_SEPARATOR)
|
file(TO_CMAKE_PATH "/" PATH_SEPARATOR)
|
||||||
|
|
||||||
#设置版本号
|
#设置版本号
|
||||||
add_definitions(-DVERSION=1,3,5,0)
|
add_definitions(-DVERSION=1,3,7,4)
|
||||||
|
|
||||||
find_package(Qt6 REQUIRED COMPONENTS Quick)
|
find_package(Qt6 REQUIRED COMPONENTS Quick Svg)
|
||||||
qt_standard_project_setup()
|
|
||||||
|
if(QT_VERSION VERSION_GREATER_EQUAL "6.3")
|
||||||
|
qt_standard_project_setup()
|
||||||
|
else()
|
||||||
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
set(CMAKE_AUTORCC ON)
|
||||||
|
set(CMAKE_AUTOUIC ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
#遍历所有Cpp文件
|
#遍历所有Cpp文件
|
||||||
file(GLOB_RECURSE CPP_FILES *.cpp *.h)
|
file(GLOB_RECURSE CPP_FILES *.cpp *.h)
|
||||||
@ -92,12 +103,24 @@ set_target_properties(example PROPERTIES
|
|||||||
)
|
)
|
||||||
|
|
||||||
#链接库
|
#链接库
|
||||||
target_link_libraries(example PRIVATE
|
if (FLUENTUI_BUILD_STATIC_LIB)
|
||||||
Qt6::Quick
|
target_link_libraries(example PRIVATE
|
||||||
fluentuiplugin
|
Qt6::Quick
|
||||||
FramelessHelper::Core
|
Qt::Svg
|
||||||
FramelessHelper::Quick
|
fluentui
|
||||||
)
|
fluentuiplugin
|
||||||
|
FramelessHelper::Core
|
||||||
|
FramelessHelper::Quick
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
target_link_libraries(example PRIVATE
|
||||||
|
Qt6::Quick
|
||||||
|
Qt::Svg
|
||||||
|
fluentuiplugin
|
||||||
|
FramelessHelper::Core
|
||||||
|
FramelessHelper::Quick
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
#安装
|
#安装
|
||||||
install(TARGETS example
|
install(TARGETS example
|
||||||
@ -105,10 +128,3 @@ install(TARGETS example
|
|||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
qt_generate_deploy_app_script(
|
|
||||||
TARGET example
|
|
||||||
OUTPUT_SCRIPT deploy_script
|
|
||||||
NO_UNSUPPORTED_PLATFORM_ERROR
|
|
||||||
)
|
|
||||||
install(SCRIPT ${deploy_script})
|
|
||||||
|
@ -5,14 +5,17 @@ import QtQuick.Layouts
|
|||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
Window {
|
Window {
|
||||||
id:app
|
id: app
|
||||||
|
flags: Qt.SplashScreen
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
FluApp.init(app)
|
FluApp.init(app)
|
||||||
FluTheme.darkMode = FluDarkMode.System
|
FluTheme.darkMode = FluDarkMode.System
|
||||||
|
FluTheme.enableAnimation = true
|
||||||
FluApp.routes = {
|
FluApp.routes = {
|
||||||
"/":"qrc:/example/qml/window/MainWindow.qml",
|
"/":"qrc:/example/qml/window/MainWindow.qml",
|
||||||
"/about":"qrc:/example/qml/window/AboutWindow.qml",
|
"/about":"qrc:/example/qml/window/AboutWindow.qml",
|
||||||
"/login":"qrc:/example/qml/window/LoginWindow.qml",
|
"/login":"qrc:/example/qml/window/LoginWindow.qml",
|
||||||
|
"/hotload":"qrc:/example/qml/window/HotloadWindow.qml",
|
||||||
"/singleTaskWindow":"qrc:/example/qml/window/SingleTaskWindow.qml",
|
"/singleTaskWindow":"qrc:/example/qml/window/SingleTaskWindow.qml",
|
||||||
"/standardWindow":"qrc:/example/qml/window/StandardWindow.qml",
|
"/standardWindow":"qrc:/example/qml/window/StandardWindow.qml",
|
||||||
"/singleInstanceWindow":"qrc:/example/qml/window/SingleInstanceWindow.qml"
|
"/singleInstanceWindow":"qrc:/example/qml/window/SingleInstanceWindow.qml"
|
||||||
|
@ -37,11 +37,6 @@ FluExpander{
|
|||||||
rightMargin: 5
|
rightMargin: 5
|
||||||
topMargin: 5
|
topMargin: 5
|
||||||
}
|
}
|
||||||
onActiveFocusChanged: {
|
|
||||||
if(activeFocus){
|
|
||||||
control.expand = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onClicked:{
|
onClicked:{
|
||||||
FluTools.clipText(content.text)
|
FluTools.clipText(content.text)
|
||||||
showSuccess("复制成功")
|
showSuccess("复制成功")
|
||||||
@ -131,13 +126,14 @@ FluExpander{
|
|||||||
"FluCopyableText",
|
"FluCopyableText",
|
||||||
"FluAcrylic",
|
"FluAcrylic",
|
||||||
"FluRemoteLoader",
|
"FluRemoteLoader",
|
||||||
"FluMenuBar"
|
"FluMenuBar",
|
||||||
|
"FluPagination",
|
||||||
|
"FluRadioButtons",
|
||||||
|
"FluImage",
|
||||||
|
"FluSpinBox"
|
||||||
];
|
];
|
||||||
code = code.replace(/\n/g, "<br>");
|
code = code.replace(/\n/g, "<br>");
|
||||||
code = code.replace(/ /g, " ");
|
code = code.replace(/ /g, " ");
|
||||||
return code.replace(RegExp("\\b(" + qmlKeywords.join("|") + ")\\b", "g"), "<span style='color: #c23a80'>$1</span>");
|
return code.replace(RegExp("\\b(" + qmlKeywords.join("|") + ")\\b", "g"), "<span style='color: #c23a80'>$1</span>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,12 @@ FluObject{
|
|||||||
navigationView.push("qrc:/example/qml/page/T_Text.qml")
|
navigationView.push("qrc:/example/qml/page/T_Text.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FluPaneItem{
|
||||||
|
title:"Image"
|
||||||
|
onTap:{
|
||||||
|
navigationView.push("qrc:/example/qml/page/T_Image.qml")
|
||||||
|
}
|
||||||
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Slider"
|
title:"Slider"
|
||||||
image:"qrc:/example/res/image/control/Slider.png"
|
image:"qrc:/example/res/image/control/Slider.png"
|
||||||
@ -72,6 +78,12 @@ FluObject{
|
|||||||
navigationView.push("qrc:/example/qml/page/T_CheckBox.qml")
|
navigationView.push("qrc:/example/qml/page/T_CheckBox.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FluPaneItem{
|
||||||
|
title:"RadioButton"
|
||||||
|
onTap:{
|
||||||
|
navigationView.push("qrc:/example/qml/page/T_RadioButton.qml")
|
||||||
|
}
|
||||||
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"ToggleSwitch"
|
title:"ToggleSwitch"
|
||||||
onTap:{
|
onTap:{
|
||||||
@ -253,9 +265,9 @@ FluObject{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"TableView2"
|
title:"Pagination"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/example/qml/page/T_TableView2.qml")
|
navigationView.push("qrc:/example/qml/page/T_Pagination.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
@ -321,6 +333,12 @@ FluObject{
|
|||||||
navigationView.push("qrc:/example/qml/page/T_RemoteLoader.qml")
|
navigationView.push("qrc:/example/qml/page/T_RemoteLoader.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FluPaneItem{
|
||||||
|
title:"HotLoader"
|
||||||
|
tapFunc:function(){
|
||||||
|
FluApp.navigate("/hotload")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRecentlyAddedData(){
|
function getRecentlyAddedData(){
|
||||||
|
@ -58,6 +58,7 @@ FluScrollablePage{
|
|||||||
width: 100
|
width: 100
|
||||||
height: 100
|
height: 100
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
}'
|
}'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@ FluContentPage {
|
|||||||
cellWidth: 80
|
cellWidth: 80
|
||||||
cellHeight: 80
|
cellHeight: 80
|
||||||
clip: true
|
clip: true
|
||||||
|
boundsBehavior: GridView.StopAtBounds
|
||||||
model:FluApp.awesomelist()
|
model:FluApp.awesomelist()
|
||||||
ScrollBar.vertical: FluScrollBar {}
|
ScrollBar.vertical: FluScrollBar {}
|
||||||
anchors{
|
anchors{
|
||||||
|
@ -24,6 +24,7 @@ FluScrollablePage{
|
|||||||
FluTextButton{
|
FluTextButton{
|
||||||
disabled:text_button_switch.checked
|
disabled:text_button_switch.checked
|
||||||
text:"Text Button"
|
text:"Text Button"
|
||||||
|
contentDescription: "文本按钮"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
showInfo("点击Text Button")
|
showInfo("点击Text Button")
|
||||||
}
|
}
|
||||||
@ -221,6 +222,9 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
FluMenuItem{
|
FluMenuItem{
|
||||||
text:"Menu_4"
|
text:"Menu_4"
|
||||||
|
onClicked: {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluToggleSwitch{
|
FluToggleSwitch{
|
||||||
@ -237,20 +241,18 @@ FluScrollablePage{
|
|||||||
Layout.topMargin: -1
|
Layout.topMargin: -1
|
||||||
code:'FluDropDownButton{
|
code:'FluDropDownButton{
|
||||||
text:"DropDownButton"
|
text:"DropDownButton"
|
||||||
items:[
|
FluMenuItem{
|
||||||
FluMenuItem{
|
text:"Menu_1"
|
||||||
text:"Menu_1"
|
},
|
||||||
},
|
FluMenuItem{
|
||||||
FluMenuItem{
|
text:"Menu_2"
|
||||||
text:"Menu_2"
|
},
|
||||||
},
|
FluMenuItem{
|
||||||
FluMenuItem{
|
text:"Menu_3"
|
||||||
text:"Menu_3"
|
},
|
||||||
},
|
FluMenuItem{
|
||||||
FluMenuItem{
|
text:"Menu_4"
|
||||||
text:"Menu_4"
|
}
|
||||||
}
|
|
||||||
]
|
|
||||||
}'
|
}'
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,24 +261,23 @@ FluScrollablePage{
|
|||||||
height: 100
|
height: 100
|
||||||
paddings: 10
|
paddings: 10
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
ColumnLayout{
|
FluRadioButtons{
|
||||||
spacing: 8
|
spacing: 8
|
||||||
anchors{
|
anchors{
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
left: parent.left
|
left: parent.left
|
||||||
}
|
}
|
||||||
Repeater{
|
FluRadioButton{
|
||||||
id:repeater
|
disabled:radio_button_switch.checked
|
||||||
property int selecIndex : 0
|
text:"Radio Button_1"
|
||||||
model: 3
|
}
|
||||||
delegate: FluRadioButton{
|
FluRadioButton{
|
||||||
checked : repeater.selecIndex===index
|
disabled:radio_button_switch.checked
|
||||||
disabled:radio_button_switch.checked
|
text:"Radio Button_2"
|
||||||
text:"Radio Button_"+index
|
}
|
||||||
clickListener:function(){
|
FluRadioButton{
|
||||||
repeater.selecIndex = index
|
disabled:radio_button_switch.checked
|
||||||
}
|
text:"Radio Button_3"
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluToggleSwitch{
|
FluToggleSwitch{
|
||||||
|
@ -22,7 +22,12 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
FluCheckBox{
|
FluCheckBox{
|
||||||
disabled: check_box_switch.checked
|
disabled: check_box_switch.checked
|
||||||
text:"Text"
|
text:"Right"
|
||||||
|
}
|
||||||
|
FluCheckBox{
|
||||||
|
disabled: check_box_switch.checked
|
||||||
|
text:"Left"
|
||||||
|
textRight: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluToggleSwitch{
|
FluToggleSwitch{
|
||||||
|
@ -23,8 +23,6 @@ FluScrollablePage{
|
|||||||
text:"此颜色组件是Github上的开源项目"
|
text:"此颜色组件是Github上的开源项目"
|
||||||
}
|
}
|
||||||
FluTextButton{
|
FluTextButton{
|
||||||
leftPadding: 0
|
|
||||||
rightPadding: 0
|
|
||||||
text:"https://github.com/rshest/qml-colorpicker"
|
text:"https://github.com/rshest/qml-colorpicker"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
Qt.openUrlExternally(text)
|
Qt.openUrlExternally(text)
|
||||||
|
@ -46,6 +46,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
FluComboBox {
|
FluComboBox {
|
||||||
editable: true
|
editable: true
|
||||||
|
font:FluTextStyle.BodyStrong
|
||||||
model: ListModel {
|
model: ListModel {
|
||||||
id: model_2
|
id: model_2
|
||||||
ListElement { text: "Banana" }
|
ListElement { text: "Banana" }
|
||||||
|
@ -23,6 +23,9 @@ FluScrollablePage{
|
|||||||
text:"showYear=true"
|
text:"showYear=true"
|
||||||
}
|
}
|
||||||
FluDatePicker{
|
FluDatePicker{
|
||||||
|
onCurrentChanged: {
|
||||||
|
showSuccess(current.toLocaleDateString())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -50,7 +53,9 @@ FluScrollablePage{
|
|||||||
|
|
||||||
FluDatePicker{
|
FluDatePicker{
|
||||||
showYear:false
|
showYear:false
|
||||||
|
onCurrentChanged: {
|
||||||
|
showSuccess(current.toLocaleDateString())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ FluScrollablePage{
|
|||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
Item{
|
Item{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
ColumnLayout{
|
FluRadioButtons{
|
||||||
spacing: 8
|
spacing: 8
|
||||||
anchors{
|
anchors{
|
||||||
top: parent.top
|
top: parent.top
|
||||||
@ -35,17 +35,14 @@ FluScrollablePage{
|
|||||||
topMargin: 15
|
topMargin: 15
|
||||||
leftMargin: 15
|
leftMargin: 15
|
||||||
}
|
}
|
||||||
Repeater{
|
FluRadioButton{
|
||||||
id:repeater
|
text:"Radio Button_1"
|
||||||
property int selecIndex : 0
|
}
|
||||||
model: 3
|
FluRadioButton{
|
||||||
delegate: FluRadioButton{
|
text:"Radio Button_2"
|
||||||
checked : repeater.selecIndex===index
|
}
|
||||||
text:"Radio Button_"+index
|
FluRadioButton{
|
||||||
clickListener:function() {
|
text:"Radio Button_3"
|
||||||
repeater.selecIndex = index
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,6 @@ FluScrollablePage{
|
|||||||
Image{
|
Image{
|
||||||
source: "qrc:/example/res/image/banner_1.jpg"
|
source: "qrc:/example/res/image/banner_1.jpg"
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
sourceSize: Qt.size(400,300)
|
|
||||||
fillMode:Image.PreserveAspectCrop
|
fillMode:Image.PreserveAspectCrop
|
||||||
}
|
}
|
||||||
Image{
|
Image{
|
||||||
|
@ -7,7 +7,8 @@ import FluentUI
|
|||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
pageMode: FluNavigationView.SingleTask
|
launchMode: FluPage.SingleTask
|
||||||
|
animDisabled: true
|
||||||
|
|
||||||
ListModel{
|
ListModel{
|
||||||
id:model_header
|
id:model_header
|
||||||
@ -17,7 +18,6 @@ FluScrollablePage{
|
|||||||
desc:"The latest FluentUI controls and styles for your applications."
|
desc:"The latest FluentUI controls and styles for your applications."
|
||||||
url:"https://github.com/zhuzichu520/FluentUI"
|
url:"https://github.com/zhuzichu520/FluentUI"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Item{
|
Item{
|
||||||
|
48
example/qml/page/T_Image.qml
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Window
|
||||||
|
import QtQuick.Controls
|
||||||
|
import FluentUI
|
||||||
|
import "qrc:///example/qml/component"
|
||||||
|
|
||||||
|
FluScrollablePage{
|
||||||
|
|
||||||
|
title:"Image"
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 260
|
||||||
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
|
Column{
|
||||||
|
spacing: 15
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left:parent.left
|
||||||
|
}
|
||||||
|
FluImage{
|
||||||
|
width: 384
|
||||||
|
height: 240
|
||||||
|
source: "https://gitee.com/zhu-zichu/zhu-zichu/raw/74f075efe2f8d3c3bb7ba3c2259e403450e4050b/image/banner_4.jpg"
|
||||||
|
onStatusChanged:{
|
||||||
|
if(status === Image.Error){
|
||||||
|
showError("图片加载失败,请重新加载")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
clickErrorListener: function(){
|
||||||
|
source = "https://gitee.com/zhu-zichu/zhu-zichu/raw/74f075efe2f8d3c3bb7ba3c2259e403450e4050b/image/banner_1.jpg"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluImage{
|
||||||
|
width: 400
|
||||||
|
height: 300
|
||||||
|
source: "https://gitee.com/zhu-zichu/zhu-zichu/raw/74f075efe2f8d3c3bb7ba3c2259e403450e4050b/image/banner_1.jpg"
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -12,7 +12,7 @@ FluScrollablePage{
|
|||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
height: 200
|
height: 240
|
||||||
paddings: 10
|
paddings: 10
|
||||||
ColumnLayout{
|
ColumnLayout{
|
||||||
spacing: 14
|
spacing: 14
|
||||||
@ -44,6 +44,12 @@ FluScrollablePage{
|
|||||||
showSuccess("这是一个Success样式的InfoBar这是一个Success样式的InfoBar")
|
showSuccess("这是一个Success样式的InfoBar这是一个Success样式的InfoBar")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FluButton{
|
||||||
|
text:"Loading"
|
||||||
|
onClicked: {
|
||||||
|
showLoading()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
|
@ -16,7 +16,19 @@ FluScrollablePage{
|
|||||||
Action { text: qsTr("Open...") }
|
Action { text: qsTr("Open...") }
|
||||||
Action { text: qsTr("Save") }
|
Action { text: qsTr("Save") }
|
||||||
FluMenuSeparator { }
|
FluMenuSeparator { }
|
||||||
Action { text: qsTr("Quit") }
|
Action {
|
||||||
|
text: qsTr("Quit")
|
||||||
|
onTriggered: {
|
||||||
|
showError("Quit")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Action {
|
||||||
|
text: qsTr("Disable")
|
||||||
|
enabled:false
|
||||||
|
onTriggered: {
|
||||||
|
showError("Disable")
|
||||||
|
}
|
||||||
|
}
|
||||||
FluMenuSeparator { }
|
FluMenuSeparator { }
|
||||||
Action { text: qsTr("Check");checkable: true;checked: true}
|
Action { text: qsTr("Check");checkable: true;checked: true}
|
||||||
FluMenu{
|
FluMenu{
|
||||||
@ -104,6 +116,10 @@ menu.popup()
|
|||||||
Action { text: qsTr("Save") }
|
Action { text: qsTr("Save") }
|
||||||
FluMenuSeparator { }
|
FluMenuSeparator { }
|
||||||
Action { text: qsTr("Quit") }
|
Action { text: qsTr("Quit") }
|
||||||
|
Action {
|
||||||
|
text: qsTr("Disable")
|
||||||
|
enabled:false
|
||||||
|
}
|
||||||
FluMenu{
|
FluMenu{
|
||||||
title: "Save As..."
|
title: "Save As..."
|
||||||
Action { text: qsTr("Doc") }
|
Action { text: qsTr("Doc") }
|
||||||
|
49
example/qml/page/T_Pagination.qml
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Window
|
||||||
|
import QtQuick.Controls
|
||||||
|
import "qrc:///example/qml/component"
|
||||||
|
import FluentUI
|
||||||
|
|
||||||
|
FluScrollablePage{
|
||||||
|
|
||||||
|
title:"Pagination"
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 200
|
||||||
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
|
ColumnLayout{
|
||||||
|
spacing: 20
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
FluPagination{
|
||||||
|
pageCurrent: 1
|
||||||
|
pageButtonCount: 5
|
||||||
|
itemCount: 5000
|
||||||
|
}
|
||||||
|
FluPagination{
|
||||||
|
pageCurrent: 2
|
||||||
|
itemCount: 5000
|
||||||
|
pageButtonCount: 7
|
||||||
|
}
|
||||||
|
FluPagination{
|
||||||
|
pageCurrent: 3
|
||||||
|
itemCount: 5000
|
||||||
|
pageButtonCount: 9
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluPagination{
|
||||||
|
pageCurrent: 1
|
||||||
|
itemCount: 1000
|
||||||
|
pageButtonCount: 9
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -76,5 +76,4 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
'
|
'
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,34 +12,22 @@ FluScrollablePage{
|
|||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
height: 260
|
height: 110
|
||||||
paddings: 10
|
paddings: 10
|
||||||
|
|
||||||
ColumnLayout{
|
ColumnLayout{
|
||||||
spacing: 20
|
spacing: 10
|
||||||
anchors{
|
anchors{
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
left: parent.left
|
left: parent.left
|
||||||
}
|
}
|
||||||
|
FluText{
|
||||||
|
text: "indeterminate = true"
|
||||||
|
}
|
||||||
FluProgressBar{
|
FluProgressBar{
|
||||||
}
|
}
|
||||||
FluProgressRing{
|
FluProgressRing{
|
||||||
}
|
}
|
||||||
FluProgressBar{
|
|
||||||
id:progress_bar
|
|
||||||
indeterminate: false
|
|
||||||
}
|
|
||||||
FluProgressRing{
|
|
||||||
id:progress_ring
|
|
||||||
indeterminate: false
|
|
||||||
}
|
|
||||||
FluSlider{
|
|
||||||
value:50
|
|
||||||
onValueChanged:{
|
|
||||||
var progress = value/100
|
|
||||||
progress_bar.progress = progress
|
|
||||||
progress_ring.progress = progress
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
@ -48,20 +36,65 @@ FluScrollablePage{
|
|||||||
code:'FluProgressBar{
|
code:'FluProgressBar{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FluProgressRing{
|
FluProgressRing{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
'
|
||||||
|
}
|
||||||
|
|
||||||
FluProgressBar{
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: 20
|
||||||
|
height: 230
|
||||||
|
paddings: 10
|
||||||
|
|
||||||
|
ColumnLayout{
|
||||||
|
spacing: 10
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
FluText{
|
||||||
|
text: "indeterminate = false"
|
||||||
|
}
|
||||||
|
FluProgressBar{
|
||||||
|
indeterminate: false
|
||||||
|
progress: slider.value/100
|
||||||
|
}
|
||||||
|
FluProgressRing{
|
||||||
|
indeterminate: false
|
||||||
|
progress: slider.value/100
|
||||||
|
}
|
||||||
|
FluProgressBar{
|
||||||
|
indeterminate: false
|
||||||
|
progressVisible: true
|
||||||
|
progress: slider.value/100
|
||||||
|
}
|
||||||
|
FluProgressRing{
|
||||||
|
indeterminate: false
|
||||||
|
progressVisible: true
|
||||||
|
progress: slider.value/100
|
||||||
|
}
|
||||||
|
FluSlider{
|
||||||
|
id:slider
|
||||||
|
Component.onCompleted: {
|
||||||
|
value = 50
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluProgressBar{
|
||||||
indeterminate: false
|
indeterminate: false
|
||||||
}
|
}
|
||||||
|
|
||||||
FluProgressRing{
|
FluProgressRing{
|
||||||
indeterminate: false
|
indeterminate: false
|
||||||
}'
|
progressVisible: true
|
||||||
|
}
|
||||||
|
'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
101
example/qml/page/T_RadioButton.qml
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Window
|
||||||
|
import QtQuick.Controls
|
||||||
|
import FluentUI
|
||||||
|
import "qrc:///example/qml/component"
|
||||||
|
|
||||||
|
FluScrollablePage{
|
||||||
|
|
||||||
|
title:"RadioButton"
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 68
|
||||||
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
|
Row{
|
||||||
|
spacing: 30
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
FluRadioButton{
|
||||||
|
disabled: radio_button_switch.checked
|
||||||
|
}
|
||||||
|
FluRadioButton{
|
||||||
|
disabled: radio_button_switch.checked
|
||||||
|
text:"Right"
|
||||||
|
}
|
||||||
|
FluRadioButton{
|
||||||
|
disabled: radio_button_switch.checked
|
||||||
|
text:"Left"
|
||||||
|
textRight: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluToggleSwitch{
|
||||||
|
id:radio_button_switch
|
||||||
|
anchors{
|
||||||
|
right: parent.right
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
text:"Disabled"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluRadioButton{
|
||||||
|
text:"Text"
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 100
|
||||||
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
|
FluRadioButtons{
|
||||||
|
spacing: 8
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
FluRadioButton{
|
||||||
|
disabled: radio_button_switch2.checked
|
||||||
|
text:"Radio Button_1"
|
||||||
|
}
|
||||||
|
FluRadioButton{
|
||||||
|
disabled: radio_button_switch2.checked
|
||||||
|
text:"Radio Button_2"
|
||||||
|
}
|
||||||
|
FluRadioButton{
|
||||||
|
disabled: radio_button_switch2.checked
|
||||||
|
text:"Radio Button_3"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluToggleSwitch{
|
||||||
|
id:radio_button_switch2
|
||||||
|
anchors{
|
||||||
|
right: parent.right
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
text:"Disabled"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluRadioButtons{
|
||||||
|
spacing: 8
|
||||||
|
FluRadioButton{
|
||||||
|
text:"Radio Button_1"
|
||||||
|
}
|
||||||
|
FluRadioButton{
|
||||||
|
text:"Radio Button_2"
|
||||||
|
}
|
||||||
|
FluRadioButton{
|
||||||
|
text:"Radio Button_3"
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -12,7 +12,7 @@ FluScrollablePage{
|
|||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
height: 480
|
height: 460
|
||||||
paddings: 10
|
paddings: 10
|
||||||
|
|
||||||
Column{
|
Column{
|
||||||
|
@ -5,8 +5,10 @@ import QtQuick.Controls
|
|||||||
import FluentUI
|
import FluentUI
|
||||||
import "qrc:///example/qml/component"
|
import "qrc:///example/qml/component"
|
||||||
|
|
||||||
FluRemoteLoader{
|
FluPage{
|
||||||
property int pageMode: FluNavigationView.SingleTop
|
launchMode: FluPage.SingleTop
|
||||||
property string url: ''
|
FluRemoteLoader{
|
||||||
source: "https://zhu-zichu.gitee.io/T_RemoteLoader.qml"
|
anchors.fill: parent
|
||||||
|
source: "https://zhu-zichu.gitee.io/T_RemoteLoader.qml"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,11 +13,11 @@ FluScrollablePage{
|
|||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
height: 136
|
height: 128
|
||||||
paddings: 10
|
paddings: 10
|
||||||
|
|
||||||
ColumnLayout{
|
ColumnLayout{
|
||||||
spacing: 10
|
spacing: 5
|
||||||
anchors{
|
anchors{
|
||||||
top: parent.top
|
top: parent.top
|
||||||
left: parent.left
|
left: parent.left
|
||||||
@ -43,16 +43,15 @@ FluScrollablePage{
|
|||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
height: 168
|
height: 160
|
||||||
paddings: 10
|
paddings: 10
|
||||||
|
|
||||||
ColumnLayout{
|
ColumnLayout{
|
||||||
spacing: 10
|
spacing: 5
|
||||||
anchors{
|
anchors{
|
||||||
top: parent.top
|
top: parent.top
|
||||||
left: parent.left
|
left: parent.left
|
||||||
}
|
}
|
||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
text:lang.navigation_view_display_mode
|
text:lang.navigation_view_display_mode
|
||||||
font: FluTextStyle.BodyStrong
|
font: FluTextStyle.BodyStrong
|
||||||
|
@ -26,7 +26,6 @@ FluScrollablePage{
|
|||||||
}'
|
}'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
height: 200
|
height: 200
|
||||||
|
@ -5,164 +5,36 @@ import QtQuick.Window
|
|||||||
import FluentUI
|
import FluentUI
|
||||||
import "qrc:///example/qml/component"
|
import "qrc:///example/qml/component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluContentPage{
|
||||||
|
|
||||||
title:"TableView"
|
title:"TableView"
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
const columns = [
|
loadData(1,1000)
|
||||||
{
|
|
||||||
title: '姓名',
|
|
||||||
dataIndex: 'name',
|
|
||||||
width:100,
|
|
||||||
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '年龄',
|
|
||||||
dataIndex: 'item_age',
|
|
||||||
width:100,
|
|
||||||
minimumWidth:100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '住址',
|
|
||||||
dataIndex: 'address',
|
|
||||||
width:200
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '别名',
|
|
||||||
dataIndex: 'nickname',
|
|
||||||
width:100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '操作',
|
|
||||||
dataIndex: 'action',
|
|
||||||
width:120
|
|
||||||
},
|
|
||||||
];
|
|
||||||
table_view.columns = columns
|
|
||||||
loadData(1,10)
|
|
||||||
}
|
|
||||||
|
|
||||||
Component{
|
|
||||||
id:com_age
|
|
||||||
Item{
|
|
||||||
id:item_age
|
|
||||||
property var ageArr: [100,300,500,1000]
|
|
||||||
height: 60
|
|
||||||
FluComboBox{
|
|
||||||
width: 80
|
|
||||||
anchors{
|
|
||||||
verticalCenter: parent.verticalCenter
|
|
||||||
left: parent.left
|
|
||||||
leftMargin: 10
|
|
||||||
}
|
|
||||||
model: ListModel {
|
|
||||||
ListElement { text: 100 }
|
|
||||||
ListElement { text: 300 }
|
|
||||||
ListElement { text: 500 }
|
|
||||||
ListElement { text: 1000 }
|
|
||||||
}
|
|
||||||
Component.onCompleted: {
|
|
||||||
currentIndex=ageArr.findIndex((element) => element === dataModel.age)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Component{
|
Component{
|
||||||
id:com_action
|
id:com_action
|
||||||
Item{
|
Item{
|
||||||
height: 60
|
RowLayout{
|
||||||
Row{
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
spacing: 10
|
FluButton{
|
||||||
FluFilledButton{
|
text:"删除"
|
||||||
text:"编辑"
|
onClicked: {
|
||||||
horizontalPadding: 6
|
table_view.closeEditor()
|
||||||
onClicked:{
|
tableModel.removeRow(row)
|
||||||
showError(JSON.stringify(dataObject))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluFilledButton{
|
FluFilledButton{
|
||||||
text:"删除"
|
text:"编辑"
|
||||||
horizontalPadding: 6
|
onClicked: {
|
||||||
onClicked:{
|
showSuccess(JSON.stringify(tableModel.getRow(row)))
|
||||||
table_view.remove(dataModel.index)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluText{
|
|
||||||
Layout.topMargin: 20
|
|
||||||
text:"此TableView适用于小数据量,带分页的表格,大数据量请使用TableView2。"
|
|
||||||
}
|
|
||||||
|
|
||||||
FluTableView{
|
|
||||||
id:table_view
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.topMargin: 20
|
|
||||||
pageCurrent:1
|
|
||||||
pageCount:10
|
|
||||||
itemCount: 1000
|
|
||||||
onRequestPage:
|
|
||||||
(page,count)=> {
|
|
||||||
loadData(page,count)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CodeExpander{
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.topMargin: 10
|
|
||||||
code:'FluTableView{
|
|
||||||
id:table_view
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.topMargin: 20
|
|
||||||
pageCurrent:1
|
|
||||||
pageCount:10
|
|
||||||
itemCount: 1000
|
|
||||||
onRequestPage:
|
|
||||||
(page,count)=> {
|
|
||||||
loadData(page,count)
|
|
||||||
}
|
|
||||||
Component.onCompleted: {
|
|
||||||
const columns = [
|
|
||||||
{
|
|
||||||
title: "姓名",
|
|
||||||
dataIndex: "name",
|
|
||||||
width:100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "年龄",
|
|
||||||
dataIndex: "age",
|
|
||||||
width:100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "住址",
|
|
||||||
dataIndex: "address",
|
|
||||||
width:200
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "别名",
|
|
||||||
dataIndex: "nickname",
|
|
||||||
width:100
|
|
||||||
}
|
|
||||||
];
|
|
||||||
table_view.columns = columns
|
|
||||||
const dataSource = [
|
|
||||||
{
|
|
||||||
name: "孙悟空”,
|
|
||||||
age: 500,
|
|
||||||
address:"钟灵毓秀的花果山,如神仙仙境的水帘洞",
|
|
||||||
nickname:"齐天大圣"
|
|
||||||
}
|
|
||||||
];
|
|
||||||
table_view.dataSource = columns
|
|
||||||
}
|
|
||||||
}'
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadData(page,count){
|
function loadData(page,count){
|
||||||
var numbers = [100, 300, 500, 1000];
|
var numbers = [100, 300, 500, 1000];
|
||||||
function getRandomAge() {
|
function getRandomAge() {
|
||||||
@ -188,13 +60,118 @@ FluScrollablePage{
|
|||||||
for(var i=0;i<count;i++){
|
for(var i=0;i<count;i++){
|
||||||
dataSource.push({
|
dataSource.push({
|
||||||
name: getRandomName(),
|
name: getRandomName(),
|
||||||
item_age: com_age,
|
|
||||||
age:getRandomAge(),
|
age:getRandomAge(),
|
||||||
address: getRandomAddresses(),
|
address: getRandomAddresses(),
|
||||||
nickname: getRandomNickname(),
|
nickname: getRandomNickname(),
|
||||||
|
longstring:"你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好你好",
|
||||||
|
height:42,
|
||||||
|
minimumHeight:42,
|
||||||
|
maximumHeight:300,
|
||||||
action:com_action
|
action:com_action
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
table_view.dataSource = dataSource
|
table_view.dataSource = dataSource
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component{
|
||||||
|
id:com_combobox
|
||||||
|
FluComboBox {
|
||||||
|
anchors.fill: parent
|
||||||
|
focus: true
|
||||||
|
currentIndex: display
|
||||||
|
editable: true
|
||||||
|
model: ListModel {
|
||||||
|
ListElement { text: 100 }
|
||||||
|
ListElement { text: 300 }
|
||||||
|
ListElement { text: 500 }
|
||||||
|
ListElement { text: 1000 }
|
||||||
|
}
|
||||||
|
Component.onCompleted: {
|
||||||
|
currentIndex=[100,300,500,1000].findIndex((element) => element === Number(display))
|
||||||
|
selectAll()
|
||||||
|
}
|
||||||
|
onCommit: {
|
||||||
|
display = editText
|
||||||
|
tableView.closeEditor()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FluTableView{
|
||||||
|
id:table_view
|
||||||
|
anchors{
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
top: parent.top
|
||||||
|
bottom: gagination.top
|
||||||
|
}
|
||||||
|
anchors.topMargin: 20
|
||||||
|
columnSource:[
|
||||||
|
{
|
||||||
|
title: '姓名',
|
||||||
|
dataIndex: 'name',
|
||||||
|
width:100,
|
||||||
|
minimumWidth:80,
|
||||||
|
maximumWidth:200,
|
||||||
|
readOnly:true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '年龄',
|
||||||
|
dataIndex: 'age',
|
||||||
|
editDelegate:com_combobox,
|
||||||
|
width:100,
|
||||||
|
minimumWidth:100,
|
||||||
|
maximumWidth:100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '住址',
|
||||||
|
dataIndex: 'address',
|
||||||
|
width:200,
|
||||||
|
minimumWidth:100,
|
||||||
|
maximumWidth:250
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '别名',
|
||||||
|
dataIndex: 'nickname',
|
||||||
|
width:100,
|
||||||
|
minimumWidth:80,
|
||||||
|
maximumWidth:200
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '长字符串',
|
||||||
|
dataIndex: 'longstring',
|
||||||
|
width:200,
|
||||||
|
minimumWidth:100,
|
||||||
|
maximumWidth:300
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
dataIndex: 'action',
|
||||||
|
width:160,
|
||||||
|
minimumWidth:160,
|
||||||
|
maximumWidth:160
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
FluPagination{
|
||||||
|
id:gagination
|
||||||
|
anchors{
|
||||||
|
bottom: parent.bottom
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
pageCurrent: 1
|
||||||
|
itemCount: 100000
|
||||||
|
pageButtonCount: 7
|
||||||
|
__itemPerPage: 1000
|
||||||
|
onRequestPage:
|
||||||
|
(page,count)=> {
|
||||||
|
table_view.closeEditor()
|
||||||
|
loadData(page,count)
|
||||||
|
table_view.resetPosition()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,107 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Controls
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import QtQuick.Window
|
|
||||||
import FluentUI
|
|
||||||
import "qrc:///example/qml/component"
|
|
||||||
|
|
||||||
FluContentPage{
|
|
||||||
|
|
||||||
title:"TableView2"
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
loadData(1,2000)
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadData(page,count){
|
|
||||||
var numbers = [100, 300, 500, 1000];
|
|
||||||
function getRandomAge() {
|
|
||||||
var randomIndex = Math.floor(Math.random() * numbers.length);
|
|
||||||
return numbers[randomIndex];
|
|
||||||
}
|
|
||||||
var names = ["孙悟空", "猪八戒", "沙和尚", "唐僧","白骨夫人","金角大王","熊山君","黄风怪","银角大王"];
|
|
||||||
function getRandomName(){
|
|
||||||
var randomIndex = Math.floor(Math.random() * names.length);
|
|
||||||
return names[randomIndex];
|
|
||||||
}
|
|
||||||
var nicknames = ["复海大圣","混天大圣","移山大圣","通风大圣","驱神大圣","齐天大圣","平天大圣"]
|
|
||||||
function getRandomNickname(){
|
|
||||||
var randomIndex = Math.floor(Math.random() * nicknames.length);
|
|
||||||
return nicknames[randomIndex];
|
|
||||||
}
|
|
||||||
var addresses = ["傲来国界花果山水帘洞","傲来国界坎源山脏水洞","大唐国界黑风山黑风洞","大唐国界黄风岭黄风洞","大唐国界骷髅山白骨洞","宝象国界碗子山波月洞","宝象国界平顶山莲花洞","宝象国界压龙山压龙洞","乌鸡国界号山枯松涧火云洞","乌鸡国界衡阳峪黑水河河神府"]
|
|
||||||
function getRandomAddresses(){
|
|
||||||
var randomIndex = Math.floor(Math.random() * addresses.length);
|
|
||||||
return addresses[randomIndex];
|
|
||||||
}
|
|
||||||
const dataSource = []
|
|
||||||
for(var i=0;i<count;i++){
|
|
||||||
dataSource.push({
|
|
||||||
name: getRandomName(),
|
|
||||||
age:getRandomAge(),
|
|
||||||
address: getRandomAddresses(),
|
|
||||||
nickname: getRandomNickname()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
table_view.dataSource = dataSource
|
|
||||||
}
|
|
||||||
|
|
||||||
Component{
|
|
||||||
id:com_combobox
|
|
||||||
|
|
||||||
FluComboBox {
|
|
||||||
anchors.fill: parent
|
|
||||||
currentIndex: display
|
|
||||||
editable: true
|
|
||||||
model: ListModel {
|
|
||||||
ListElement { text: 100 }
|
|
||||||
ListElement { text: 300 }
|
|
||||||
ListElement { text: 500 }
|
|
||||||
ListElement { text: 1000 }
|
|
||||||
}
|
|
||||||
Component.onCompleted: {
|
|
||||||
currentIndex=[100,300,500,1000].findIndex((element) => element === Number(display))
|
|
||||||
selectAll()
|
|
||||||
}
|
|
||||||
TableView.onCommit: {
|
|
||||||
display = editText
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FluTableView2{
|
|
||||||
id:table_view
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.topMargin: 20
|
|
||||||
columnSource:[
|
|
||||||
{
|
|
||||||
title: '姓名',
|
|
||||||
dataIndex: 'name',
|
|
||||||
width:100,
|
|
||||||
minimumWidth:50
|
|
||||||
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '年龄',
|
|
||||||
dataIndex: 'age',
|
|
||||||
editDelegate:com_combobox,
|
|
||||||
width:100,
|
|
||||||
minimumWidth:100,
|
|
||||||
maximumWidth: 100
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '住址',
|
|
||||||
dataIndex: 'address',
|
|
||||||
width:200
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '别名',
|
|
||||||
dataIndex: 'nickname',
|
|
||||||
width:100,
|
|
||||||
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -7,8 +7,9 @@ import "qrc:///example/qml/component"
|
|||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"TextBox"
|
launchMode: FluPage.SingleInstance
|
||||||
|
|
||||||
|
title:"TextBox"
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
height: 68
|
height: 68
|
||||||
@ -165,6 +166,41 @@ FluScrollablePage{
|
|||||||
}'
|
}'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 68
|
||||||
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
|
|
||||||
|
FluSpinBox{
|
||||||
|
Layout.topMargin: 20
|
||||||
|
disabled: spin_box_switch.checked
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row{
|
||||||
|
spacing: 5
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
|
FluToggleSwitch{
|
||||||
|
id:spin_box_switch
|
||||||
|
Layout.alignment: Qt.AlignRight
|
||||||
|
text:"Disabled"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluSpinBox{
|
||||||
|
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
function generateRandomNames(numNames) {
|
function generateRandomNames(numNames) {
|
||||||
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||||
|
@ -12,7 +12,7 @@ FluScrollablePage{
|
|||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
height: 210
|
height: 270
|
||||||
paddings: 10
|
paddings: 10
|
||||||
ColumnLayout{
|
ColumnLayout{
|
||||||
spacing:0
|
spacing:0
|
||||||
@ -72,6 +72,17 @@ FluScrollablePage{
|
|||||||
FluTheme.nativeText = !FluTheme.nativeText
|
FluTheme.nativeText = !FluTheme.nativeText
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FluText{
|
||||||
|
text:"开启动画效果"
|
||||||
|
Layout.topMargin: 20
|
||||||
|
}
|
||||||
|
FluToggleSwitch{
|
||||||
|
Layout.topMargin: 5
|
||||||
|
checked: FluTheme.enableAnimation
|
||||||
|
onClicked: {
|
||||||
|
FluTheme.enableAnimation = !FluTheme.enableAnimation
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CodeExpander{
|
CodeExpander{
|
||||||
|
@ -8,7 +8,7 @@ import "qrc:///example/qml/component"
|
|||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
title:"TimePicker"
|
title:"TimePicker"
|
||||||
|
launchMode: FluPage.SingleInstance
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
@ -27,6 +27,9 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
|
|
||||||
FluTimePicker{
|
FluTimePicker{
|
||||||
|
onCurrentChanged: {
|
||||||
|
showSuccess(current.toLocaleTimeString(Qt.locale("de_DE")))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -53,11 +56,14 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
text:"hourFormat=FluTimePicker.H"
|
text:"hourFormat=FluTimePicker.HH"
|
||||||
}
|
}
|
||||||
|
|
||||||
FluTimePicker{
|
FluTimePicker{
|
||||||
hourFormat:FluTimePicker.HH
|
hourFormat:FluTimePicker.HH
|
||||||
|
onCurrentChanged: {
|
||||||
|
showSuccess(current.toLocaleTimeString(Qt.locale("de_DE")))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,12 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
FluToggleSwitch{
|
FluToggleSwitch{
|
||||||
disabled: toggle_switch.checked
|
disabled: toggle_switch.checked
|
||||||
|
text:"Right"
|
||||||
|
}
|
||||||
|
FluToggleSwitch{
|
||||||
|
disabled: toggle_switch.checked
|
||||||
|
text:"Left"
|
||||||
|
textRight: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluToggleSwitch{
|
FluToggleSwitch{
|
||||||
|
85
example/qml/window/HotloadWindow.qml
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import FluentUI
|
||||||
|
import example
|
||||||
|
import "qrc:///example/qml/component"
|
||||||
|
|
||||||
|
CustomWindow {
|
||||||
|
|
||||||
|
id:window
|
||||||
|
title:"热加载"
|
||||||
|
width: 800
|
||||||
|
height: 600
|
||||||
|
minimumWidth: 520
|
||||||
|
minimumHeight: 200
|
||||||
|
launchMode: FluWindow.SingleTask
|
||||||
|
FileWatcher{
|
||||||
|
id:watcher
|
||||||
|
onFileChanged: {
|
||||||
|
loader.reload()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluArea{
|
||||||
|
anchors.fill: parent
|
||||||
|
FluRemoteLoader{
|
||||||
|
id:loader
|
||||||
|
anchors.fill: parent
|
||||||
|
statusMode: FluStatusView.Success
|
||||||
|
lazy: true
|
||||||
|
errorItem: Item{
|
||||||
|
FluText{
|
||||||
|
text:loader.itemLodaer().sourceComponent.errorString()
|
||||||
|
color:"red"
|
||||||
|
anchors.fill: parent
|
||||||
|
wrapMode: Text.WrapAnywhere
|
||||||
|
padding: 20
|
||||||
|
verticalAlignment: Qt.AlignVCenter
|
||||||
|
horizontalAlignment: Qt.AlignHCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluText{
|
||||||
|
text:"拖入qml文件"
|
||||||
|
font.pixelSize: 26
|
||||||
|
anchors.centerIn: parent
|
||||||
|
visible: !loader.itemLodaer().item && loader.statusMode === FluStatusView.Success
|
||||||
|
}
|
||||||
|
Rectangle{
|
||||||
|
radius: 4
|
||||||
|
anchors.fill: parent
|
||||||
|
color: "#33333333"
|
||||||
|
visible: drop_area.containsDrag
|
||||||
|
}
|
||||||
|
DropArea{
|
||||||
|
id:drop_area
|
||||||
|
anchors.fill: parent
|
||||||
|
onEntered:
|
||||||
|
(event)=>{
|
||||||
|
if(!event.hasUrls){
|
||||||
|
event.accepted = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (event.urls.length !== 1) {
|
||||||
|
event.accepted = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var url = event.urls[0].toString()
|
||||||
|
var fileExtension = url.substring(url.lastIndexOf(".") + 1)
|
||||||
|
if (fileExtension !== "qml") {
|
||||||
|
event.accepted = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
onDropped:
|
||||||
|
(event)=>{
|
||||||
|
var path = event.urls[0].toString()
|
||||||
|
loader.source = path
|
||||||
|
watcher.path = path
|
||||||
|
loader.reload()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -4,6 +4,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import Qt.labs.platform
|
import Qt.labs.platform
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import example
|
||||||
import "qrc:///example/qml/component"
|
import "qrc:///example/qml/component"
|
||||||
import "qrc:///example/qml/global"
|
import "qrc:///example/qml/global"
|
||||||
|
|
||||||
@ -15,15 +16,19 @@ CustomWindow {
|
|||||||
height: 640
|
height: 640
|
||||||
closeDestory:false
|
closeDestory:false
|
||||||
minimumWidth: 520
|
minimumWidth: 520
|
||||||
minimumHeight: 460
|
minimumHeight: 200
|
||||||
appBarVisible: false
|
appBarVisible: false
|
||||||
launchMode: FluWindow.SingleTask
|
launchMode: FluWindow.SingleTask
|
||||||
|
|
||||||
closeFunc:function(event){
|
closeFunc:function(event){
|
||||||
close_app.open()
|
dialog_close.open()
|
||||||
event.accepted = false
|
event.accepted = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
FluTools.setQuitOnLastWindowClosed(false)
|
||||||
|
}
|
||||||
|
|
||||||
Connections{
|
Connections{
|
||||||
target: appInfo
|
target: appInfo
|
||||||
function onActiveWindow(){
|
function onActiveWindow(){
|
||||||
@ -58,7 +63,7 @@ CustomWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
FluContentDialog{
|
FluContentDialog{
|
||||||
id:close_app
|
id:dialog_close
|
||||||
title:"退出"
|
title:"退出"
|
||||||
message:"确定要退出程序吗?"
|
message:"确定要退出程序吗?"
|
||||||
negativeText:"最小化"
|
negativeText:"最小化"
|
||||||
@ -94,7 +99,7 @@ CustomWindow {
|
|||||||
when: flipable.flipped
|
when: flipable.flipped
|
||||||
}
|
}
|
||||||
transitions: Transition {
|
transitions: Transition {
|
||||||
NumberAnimation { target: flipable; property: "flipAngle"; duration: 1000 ; easing.type: Easing.OutQuad}
|
NumberAnimation { target: flipable; property: "flipAngle"; duration: 1000 ; easing.type: Easing.OutCubic}
|
||||||
}
|
}
|
||||||
back: Item{
|
back: Item{
|
||||||
anchors.fill: flipable
|
anchors.fill: flipable
|
||||||
@ -112,6 +117,12 @@ CustomWindow {
|
|||||||
}
|
}
|
||||||
Row{
|
Row{
|
||||||
z:8
|
z:8
|
||||||
|
anchors{
|
||||||
|
top: parent.top
|
||||||
|
left: parent.left
|
||||||
|
topMargin: FluTools.isMacos() ? 20 : 5
|
||||||
|
leftMargin: 5
|
||||||
|
}
|
||||||
FluIconButton{
|
FluIconButton{
|
||||||
iconSource: FluentIcons.ChromeBack
|
iconSource: FluentIcons.ChromeBack
|
||||||
width: 30
|
width: 30
|
||||||
@ -134,6 +145,7 @@ CustomWindow {
|
|||||||
|
|
||||||
FluRemoteLoader{
|
FluRemoteLoader{
|
||||||
id:loader
|
id:loader
|
||||||
|
lazy: true
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
// source: "http://localhost:9000/RemoteComponent.qml"
|
// source: "http://localhost:9000/RemoteComponent.qml"
|
||||||
source: "https://zhu-zichu.gitee.io/RemoteComponent.qml"
|
source: "https://zhu-zichu.gitee.io/RemoteComponent.qml"
|
||||||
@ -160,19 +172,17 @@ CustomWindow {
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
z:999
|
z:999
|
||||||
|
//Stack模式,每次切换都会将页面压入栈中,随着栈的页面增多,消耗的内存也越多,内存消耗多就会卡顿,这时候就需要按返回将页面pop掉,释放内存。该模式可以配合FluPage中的launchMode属性,设置页面的启动模式
|
||||||
|
// pageMode: FluNavigationView.Stack
|
||||||
|
//NoStack模式,每次切换都会销毁之前的页面然后创建一个新的页面,只需消耗少量内存(推荐)
|
||||||
|
// pageMode: FluNavigationView.NoStack
|
||||||
items: ItemsOriginal
|
items: ItemsOriginal
|
||||||
footerItems:ItemsFooter
|
footerItems:ItemsFooter
|
||||||
topPadding:FluTools.isMacos() ? 20 : 5
|
topPadding:FluTools.isMacos() ? 20 : 5
|
||||||
displayMode:MainEvent.displayMode
|
displayMode:MainEvent.displayMode
|
||||||
logo: "qrc:/example/res/image/favicon.ico"
|
logo: "qrc:/example/res/image/favicon.ico"
|
||||||
title:"FluentUI"
|
title:"FluentUI"
|
||||||
Behavior on rotation {
|
onLogoClicked:{
|
||||||
NumberAnimation{
|
|
||||||
duration: 167
|
|
||||||
}
|
|
||||||
}
|
|
||||||
transformOrigin: Item.Center
|
|
||||||
onLoginClicked:{
|
|
||||||
clickCount += 1
|
clickCount += 1
|
||||||
if(clickCount === 1){
|
if(clickCount === 1){
|
||||||
loader.reload()
|
loader.reload()
|
||||||
@ -200,54 +210,12 @@ CustomWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Image{
|
CircularReveal{
|
||||||
id:img_cache
|
id:reveal
|
||||||
visible: false
|
target:window.contentItem
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
}
|
onImageChanged: {
|
||||||
|
changeDark()
|
||||||
Canvas{
|
|
||||||
id:canvas
|
|
||||||
anchors.fill: parent
|
|
||||||
property int centerX: canvas.width / 2
|
|
||||||
property int centerY: canvas.height / 2
|
|
||||||
property real radius: 0
|
|
||||||
property int maxRadius: 0
|
|
||||||
property url imageUrl
|
|
||||||
Behavior on radius{
|
|
||||||
id:anim_radius
|
|
||||||
NumberAnimation {
|
|
||||||
target: canvas
|
|
||||||
property: "radius"
|
|
||||||
duration: 666
|
|
||||||
easing.type: Easing.OutCubic
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onRadiusChanged: {
|
|
||||||
canvas.requestPaint()
|
|
||||||
}
|
|
||||||
onPaint: {
|
|
||||||
var ctx = canvas.getContext("2d");
|
|
||||||
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
||||||
ctx.clearRect(0, 0, canvasSize.width, canvasSize.height);
|
|
||||||
ctx.save()
|
|
||||||
if(img_cache.source.toString().length!==0){
|
|
||||||
try{
|
|
||||||
ctx.drawImage(img_cache, 0, 0, canvasSize.width, canvasSize.height, 0, 0, canvasSize.width, canvasSize.height)
|
|
||||||
}catch(e){
|
|
||||||
img_cache.source = ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
clearArc(ctx, centerX, centerY, radius)
|
|
||||||
ctx.restore()
|
|
||||||
}
|
|
||||||
function clearArc(ctx,x, y, radius, startAngle, endAngle) {
|
|
||||||
ctx.beginPath()
|
|
||||||
ctx.globalCompositeOperation = 'destination-out'
|
|
||||||
ctx.fillStyle = 'black'
|
|
||||||
ctx.arc(x, y, radius, 0, 2*Math.PI);
|
|
||||||
ctx.fill();
|
|
||||||
ctx.closePath();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,32 +224,23 @@ CustomWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleDarkChanged(button){
|
function handleDarkChanged(button){
|
||||||
var changeDark = function(){
|
if(FluTools.isMacos() || !FluTheme.enableAnimation){
|
||||||
if(FluTheme.dark){
|
changeDark()
|
||||||
FluTheme.darkMode = FluDarkMode.Light
|
}else{
|
||||||
}else{
|
|
||||||
FluTheme.darkMode = FluDarkMode.Dark
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(FluTools.isWin()){
|
|
||||||
var target = window.contentItem
|
var target = window.contentItem
|
||||||
var pos = button.mapToItem(target,0,0)
|
var pos = button.mapToItem(target,0,0)
|
||||||
var mouseX = pos.x
|
var mouseX = pos.x
|
||||||
var mouseY = pos.y
|
var mouseY = pos.y
|
||||||
canvas.maxRadius = Math.max(distance(mouseX,mouseY,0,0),distance(mouseX,mouseY,target.width,0),distance(mouseX,mouseY,0,target.height),distance(mouseX,mouseY,target.width,target.height))
|
var radius = Math.max(distance(mouseX,mouseY,0,0),distance(mouseX,mouseY,target.width,0),distance(mouseX,mouseY,0,target.height),distance(mouseX,mouseY,target.width,target.height))
|
||||||
target.grabToImage(function(result) {
|
reveal.start(reveal.width*Screen.devicePixelRatio,reveal.height*Screen.devicePixelRatio,Qt.point(mouseX,mouseY),radius)
|
||||||
img_cache.source = result.url
|
}
|
||||||
canvas.requestPaint()
|
}
|
||||||
changeDark()
|
|
||||||
canvas.centerX = mouseX
|
function changeDark(){
|
||||||
canvas.centerY = mouseY
|
if(FluTheme.dark){
|
||||||
anim_radius.enabled = false
|
FluTheme.darkMode = FluDarkMode.Light
|
||||||
canvas.radius = 0
|
|
||||||
anim_radius.enabled = true
|
|
||||||
canvas.radius = canvas.maxRadius
|
|
||||||
},canvas.canvasSize)
|
|
||||||
}else{
|
}else{
|
||||||
changeDark()
|
FluTheme.darkMode = FluDarkMode.Dark
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
47
example/src/component/CircularReveal.cpp
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
#include "CircularReveal.h"
|
||||||
|
#include <QGuiApplication>
|
||||||
|
#include <QQuickItemGrabResult>
|
||||||
|
#include <QPainterPath>
|
||||||
|
|
||||||
|
CircularReveal::CircularReveal(QQuickItem* parent) : QQuickPaintedItem(parent)
|
||||||
|
{
|
||||||
|
setVisible(false);
|
||||||
|
_anim = new QPropertyAnimation(this, "radius", this);
|
||||||
|
_anim->setDuration(333);
|
||||||
|
_anim->setEasingCurve(QEasingCurve::OutCubic);
|
||||||
|
connect(_anim, &QPropertyAnimation::finished,this,[=](){
|
||||||
|
setVisible(false);
|
||||||
|
});
|
||||||
|
connect(this,&CircularReveal::radiusChanged,this,[=](){
|
||||||
|
update();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void CircularReveal::paint(QPainter* painter)
|
||||||
|
{
|
||||||
|
painter->save();
|
||||||
|
painter->eraseRect(boundingRect());
|
||||||
|
painter->drawImage(QRect(0, 0, static_cast<int>(width()), static_cast<int>(height())), _source);
|
||||||
|
QPainterPath path;
|
||||||
|
path.moveTo(_center.x(),_center.y());
|
||||||
|
path.addEllipse(QPointF(_center.x(),_center.y()), _radius, _radius);
|
||||||
|
painter->setCompositionMode(QPainter::CompositionMode_Clear);
|
||||||
|
painter->fillPath(path, Qt::black);
|
||||||
|
painter->restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CircularReveal::start(int w,int h,const QPoint& center,int radius){
|
||||||
|
_anim->setStartValue(0);
|
||||||
|
_anim->setEndValue(radius);
|
||||||
|
_center = center;
|
||||||
|
_grabResult = _target->grabToImage(QSize(w,h));
|
||||||
|
connect(_grabResult.data(), &QQuickItemGrabResult::ready, this, &CircularReveal::handleGrabResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CircularReveal::handleGrabResult(){
|
||||||
|
_grabResult.data()->image().swap(_source);
|
||||||
|
update();
|
||||||
|
setVisible(true);
|
||||||
|
Q_EMIT imageChanged();
|
||||||
|
_anim->start();
|
||||||
|
}
|
28
example/src/component/CircularReveal.h
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#ifndef CIRCULARREVEAL_H
|
||||||
|
#define CIRCULARREVEAL_H
|
||||||
|
|
||||||
|
#include <QQuickItem>
|
||||||
|
#include <QQuickPaintedItem>
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QPropertyAnimation>
|
||||||
|
#include "src/stdafx.h"
|
||||||
|
|
||||||
|
class CircularReveal : public QQuickPaintedItem
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PROPERTY_AUTO(QQuickItem*,target)
|
||||||
|
Q_PROPERTY_AUTO(int,radius)
|
||||||
|
public:
|
||||||
|
CircularReveal(QQuickItem* parent = nullptr);
|
||||||
|
void paint(QPainter* painter) override;
|
||||||
|
Q_INVOKABLE void start(int w,int h,const QPoint& center,int radius);
|
||||||
|
Q_SIGNAL void imageChanged();
|
||||||
|
Q_SLOT void handleGrabResult();
|
||||||
|
private:
|
||||||
|
QImage _source;
|
||||||
|
QPropertyAnimation* _anim;
|
||||||
|
QPoint _center;
|
||||||
|
QSharedPointer<QQuickItemGrabResult> _grabResult;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CIRCULARREVEAL_H
|
24
example/src/component/FileWatcher.cpp
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#include "FileWatcher.h"
|
||||||
|
|
||||||
|
FileWatcher::FileWatcher(QObject *parent)
|
||||||
|
: QObject{parent}
|
||||||
|
{
|
||||||
|
connect(&_watcher, &QFileSystemWatcher::fileChanged, this, [=](const QString &path){
|
||||||
|
Q_EMIT fileChanged();
|
||||||
|
clean();
|
||||||
|
_watcher.addPath(_path);
|
||||||
|
});
|
||||||
|
connect(this,&FileWatcher::pathChanged,this,[=](){
|
||||||
|
clean();
|
||||||
|
_watcher.addPath(_path.replace("file:///",""));
|
||||||
|
});
|
||||||
|
if(!_path.isEmpty()){
|
||||||
|
_watcher.addPath(_path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileWatcher::clean(){
|
||||||
|
foreach (const QString &item, _watcher.files()) {
|
||||||
|
_watcher.removePath(item);
|
||||||
|
}
|
||||||
|
}
|
21
example/src/component/FileWatcher.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#ifndef FILEWATCHER_H
|
||||||
|
#define FILEWATCHER_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QFileSystemWatcher>
|
||||||
|
#include "src/stdafx.h"
|
||||||
|
|
||||||
|
class FileWatcher : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PROPERTY_AUTO(QString,path);
|
||||||
|
public:
|
||||||
|
explicit FileWatcher(QObject *parent = nullptr);
|
||||||
|
Q_SIGNAL void fileChanged();
|
||||||
|
private:
|
||||||
|
void clean();
|
||||||
|
private:
|
||||||
|
QFileSystemWatcher _watcher;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FILEWATCHER_H
|
@ -6,11 +6,13 @@
|
|||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <FramelessHelper/Quick/framelessquickmodule.h>
|
#include <FramelessHelper/Quick/framelessquickmodule.h>
|
||||||
#include <FramelessHelper/Core/private/framelessconfig_p.h>
|
#include <FramelessHelper/Core/private/framelessconfig_p.h>
|
||||||
|
#include "src/component/CircularReveal.h"
|
||||||
|
#include "src/component/FileWatcher.h"
|
||||||
#include "AppInfo.h"
|
#include "AppInfo.h"
|
||||||
|
|
||||||
FRAMELESSHELPER_USE_NAMESPACE
|
FRAMELESSHELPER_USE_NAMESPACE
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
//将样式设置为Basic,不然会导致组件显示异常
|
//将样式设置为Basic,不然会导致组件显示异常
|
||||||
qputenv("QT_QUICK_CONTROLS_STYLE","Basic");
|
qputenv("QT_QUICK_CONTROLS_STYLE","Basic");
|
||||||
@ -34,9 +36,13 @@ int main(int argc, char *argv[])
|
|||||||
if(!appInfo->isOwnerProcess(&ipc)){
|
if(!appInfo->isOwnerProcess(&ipc)){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
app.setQuitOnLastWindowClosed(false);
|
|
||||||
QQmlApplicationEngine engine;
|
QQmlApplicationEngine engine;
|
||||||
FramelessHelper::Quick::registerTypes(&engine);
|
FramelessHelper::Quick::registerTypes(&engine);
|
||||||
|
#ifdef FLUENTUI_BUILD_STATIC_LIB
|
||||||
|
engine.addImportPath("qrc:/"); // 让静态资源可以被QML引擎搜索到
|
||||||
|
#endif
|
||||||
|
qmlRegisterType<CircularReveal>("example", 1, 0, "CircularReveal");
|
||||||
|
qmlRegisterType<FileWatcher>("example", 1, 0, "FileWatcher");
|
||||||
appInfo->init(&engine);
|
appInfo->init(&engine);
|
||||||
const QUrl url(QStringLiteral("qrc:/example/qml/App.qml"));
|
const QUrl url(QStringLiteral("qrc:/example/qml/App.qml"));
|
||||||
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
|
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
|
||||||
|
@ -1,22 +1,28 @@
|
|||||||
cmake_minimum_required(VERSION 3.20)
|
cmake_minimum_required(VERSION 3.20)
|
||||||
|
|
||||||
project(fluentuiplugin LANGUAGES CXX)
|
if (FLUENTUI_BUILD_STATIC_LIB)
|
||||||
|
project(fluentui LANGUAGES CXX)
|
||||||
|
else()
|
||||||
|
project(fluentuiplugin LANGUAGES CXX)
|
||||||
|
endif()
|
||||||
#配置通用编译
|
#配置通用编译
|
||||||
set(CMAKE_AUTOMOC ON)
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE)
|
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#设置QML插件输出目录->D:\Qt\6.4.3\msvc2019_64\qml\FluentUI
|
|
||||||
set(QML_PLUGIN_DIRECTORY ${CMAKE_PREFIX_PATH}/qml/FluentUI)
|
|
||||||
|
|
||||||
#设置版本号
|
#设置版本号
|
||||||
add_definitions(-DVERSION=1,3,5,0)
|
add_definitions(-DVERSION=1,3,7,4)
|
||||||
|
|
||||||
find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml)
|
find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml)
|
||||||
qt_standard_project_setup()
|
|
||||||
|
if(QT_VERSION VERSION_GREATER_EQUAL "6.3")
|
||||||
|
qt_standard_project_setup()
|
||||||
|
else()
|
||||||
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
set(CMAKE_AUTORCC ON)
|
||||||
|
set(CMAKE_AUTOUIC ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
#遍历所有Cpp文件
|
#遍历所有Cpp文件
|
||||||
file(GLOB_RECURSE CPP_FILES *.cpp *.h)
|
file(GLOB_RECURSE CPP_FILES *.cpp *.h)
|
||||||
@ -33,7 +39,7 @@ foreach(filepath ${QML_PATHS})
|
|||||||
endforeach(filepath)
|
endforeach(filepath)
|
||||||
|
|
||||||
#遍历所有资源文件
|
#遍历所有资源文件
|
||||||
file(GLOB_RECURSE RES_PATHS *.png *.jpg *.svg *.ico *.ttf *.webp)
|
file(GLOB_RECURSE RES_PATHS *.png *.jpg *.svg *.ico *.ttf *.webp qmldir)
|
||||||
foreach(filepath ${RES_PATHS})
|
foreach(filepath ${RES_PATHS})
|
||||||
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
||||||
list(APPEND resource_files ${filename})
|
list(APPEND resource_files ${filename})
|
||||||
@ -46,26 +52,44 @@ foreach(filepath IN LISTS qml_files resource_files)
|
|||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
#添加qml模块
|
#添加qml模块
|
||||||
qt_add_library(fluentuiplugin SHARED)
|
if (FLUENTUI_BUILD_STATIC_LIB)
|
||||||
qt_add_qml_module(fluentuiplugin
|
set(LIB_TYPE "STATIC")
|
||||||
#没有下面这行代码就会生成fluentuiplugin.dll与fluentuipluginplugin.dll两个动态库
|
else()
|
||||||
PLUGIN_TARGET fluentuiplugin
|
set(LIB_TYPE "SHARED")
|
||||||
OUTPUT_DIRECTORY ${QML_PLUGIN_DIRECTORY}
|
endif()
|
||||||
VERSION 1.0
|
qt_add_library(${PROJECT_NAME} ${LIB_TYPE})
|
||||||
URI "FluentUI"
|
if (FLUENTUI_BUILD_STATIC_LIB)
|
||||||
#修改qmltypes文件名称。默认fluentuiplugin.qmltypes,使用默认名称有时候import FluentUI会爆红,所以修改成plugins.qmltypes
|
qt_add_qml_module(${PROJECT_NAME}
|
||||||
TYPEINFO "plugins.qmltypes"
|
#在静态库编译中使用PLUGIN_TARGET会导致链接失败
|
||||||
SOURCES ${sources_files} fluentui.rc
|
OUTPUT_DIRECTORY ${FLUENTUI_QML_PLUGIN_DIRECTORY}
|
||||||
QML_FILES ${qml_files}
|
VERSION 1.0
|
||||||
RESOURCES ${resource_files}
|
URI "FluentUI"
|
||||||
)
|
TYPEINFO "plugins.qmltypes"
|
||||||
|
SOURCES ${sources_files} fluentui.rc
|
||||||
|
QML_FILES ${qml_files}
|
||||||
|
RESOURCES ${resource_files}
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
qt_add_qml_module(${PROJECT_NAME}
|
||||||
|
#没有下面这行代码就会生成fluentuiplugin.dll与fluentuipluginplugin.dll两个动态库
|
||||||
|
PLUGIN_TARGET fluentuiplugin
|
||||||
|
OUTPUT_DIRECTORY ${FLUENTUI_QML_PLUGIN_DIRECTORY}
|
||||||
|
VERSION 1.0
|
||||||
|
URI "FluentUI"
|
||||||
|
#修改qmltypes文件名称。默认fluentuiplugin.qmltypes,使用默认名称有时候import FluentUI会爆红,所以修改成plugins.qmltypes
|
||||||
|
TYPEINFO "plugins.qmltypes"
|
||||||
|
SOURCES ${sources_files} fluentui.rc
|
||||||
|
QML_FILES ${qml_files}
|
||||||
|
RESOURCES ${resource_files}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
#链接库
|
#链接库
|
||||||
target_link_libraries(fluentuiplugin PUBLIC
|
target_link_libraries(${PROJECT_NAME} PUBLIC
|
||||||
Qt::Core
|
Qt::CorePrivate
|
||||||
Qt::Quick
|
Qt::QuickPrivate
|
||||||
Qt::Qml
|
Qt::QmlPrivate
|
||||||
)
|
)
|
||||||
|
|
||||||
#安装
|
#安装
|
||||||
install(DIRECTORY ${QML_PLUGIN_DIRECTORY} DESTINATION ${CMAKE_INSTALL_PREFIX}/imports)
|
install(DIRECTORY ${FLUENTUI_QML_PLUGIN_DIRECTORY} DESTINATION ${CMAKE_INSTALL_PREFIX}/imports)
|
||||||
|
@ -7,9 +7,9 @@
|
|||||||
namespace Fluent_DarkMode {
|
namespace Fluent_DarkMode {
|
||||||
Q_NAMESPACE
|
Q_NAMESPACE
|
||||||
enum Fluent_DarkModeType {
|
enum Fluent_DarkModeType {
|
||||||
System = 0x0,
|
System = 0x0,
|
||||||
Light = 0x1,
|
Light = 0x1,
|
||||||
Dark = 0x2,
|
Dark = 0x2,
|
||||||
};
|
};
|
||||||
Q_ENUM_NS(Fluent_DarkModeType)
|
Q_ENUM_NS(Fluent_DarkModeType)
|
||||||
QML_NAMED_ELEMENT(FluDarkMode)
|
QML_NAMED_ELEMENT(FluDarkMode)
|
||||||
|
@ -38,13 +38,13 @@ void FluApp::run(){
|
|||||||
|
|
||||||
void FluApp::navigate(const QString& route,const QJsonObject& argument,FluRegister* fluRegister){
|
void FluApp::navigate(const QString& route,const QJsonObject& argument,FluRegister* fluRegister){
|
||||||
if(!routes().contains(route)){
|
if(!routes().contains(route)){
|
||||||
qErrnoWarning("没有找到当前路由");
|
qCritical()<<"No route found "<<route;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QQmlEngine *engine = qmlEngine(appWindow);
|
QQmlEngine *engine = qmlEngine(appWindow);
|
||||||
QQmlComponent component(engine, routes().value(route).toString());
|
QQmlComponent component(engine, routes().value(route).toString());
|
||||||
if (component.isError()) {
|
if (component.isError()) {
|
||||||
qWarning() << component.errors();
|
qCritical() << component.errors();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QVariantMap properties;
|
QVariantMap properties;
|
||||||
@ -109,3 +109,11 @@ QJsonArray FluApp::awesomelist(const QString& keyword)
|
|||||||
void FluApp::closeApp(){
|
void FluApp::closeApp(){
|
||||||
qApp->exit(0);
|
qApp->exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FluApp::deleteWindow(QQuickWindow* window){
|
||||||
|
if(window){
|
||||||
|
wnds.remove(window->winId());
|
||||||
|
window->deleteLater();
|
||||||
|
window = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -73,6 +73,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
Q_INVOKABLE void closeApp();
|
Q_INVOKABLE void closeApp();
|
||||||
|
|
||||||
|
Q_INVOKABLE void deleteWindow(QQuickWindow* window);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief wnds
|
* @brief wnds
|
||||||
|
@ -12,7 +12,7 @@ FluTextStyle::FluTextStyle(QObject *parent)
|
|||||||
Body(body);
|
Body(body);
|
||||||
|
|
||||||
QFont bodyStrong;
|
QFont bodyStrong;
|
||||||
bodyStrong.setPixelSize(14);
|
bodyStrong.setPixelSize(13);
|
||||||
bodyStrong.setBold(true);
|
bodyStrong.setBold(true);
|
||||||
BodyStrong(bodyStrong);
|
BodyStrong(bodyStrong);
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ FluTheme::FluTheme(QObject *parent)
|
|||||||
});
|
});
|
||||||
primaryColor(FluColors::getInstance()->Blue());
|
primaryColor(FluColors::getInstance()->Blue());
|
||||||
nativeText(false);
|
nativeText(false);
|
||||||
|
enableAnimation(false);
|
||||||
darkMode(Fluent_DarkMode::Fluent_DarkModeType::Light);
|
darkMode(Fluent_DarkMode::Fluent_DarkModeType::Light);
|
||||||
_systemDark = systemDark();
|
_systemDark = systemDark();
|
||||||
qApp->installEventFilter(this);
|
qApp->installEventFilter(this);
|
||||||
|
@ -32,6 +32,11 @@ class FluTheme : public QObject
|
|||||||
*/
|
*/
|
||||||
Q_PROPERTY_AUTO(bool,nativeText);
|
Q_PROPERTY_AUTO(bool,nativeText);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 是否开启动画效果
|
||||||
|
*/
|
||||||
|
Q_PROPERTY_AUTO(bool,enableAnimation);
|
||||||
|
|
||||||
QML_NAMED_ELEMENT(FluTheme)
|
QML_NAMED_ELEMENT(FluTheme)
|
||||||
QML_SINGLETON
|
QML_SINGLETON
|
||||||
private:
|
private:
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
|
#include <QCursor>
|
||||||
|
|
||||||
FluTools* FluTools::m_instance = nullptr;
|
FluTools* FluTools::m_instance = nullptr;
|
||||||
|
|
||||||
@ -63,6 +64,33 @@ bool FluTools::isWin(){
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int FluTools::qtMajor(){
|
||||||
|
const QString qtVersion = QString::fromLatin1(qVersion());
|
||||||
|
const QStringList versionParts = qtVersion.split('.');
|
||||||
|
return versionParts[0].toInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
int FluTools::qtMinor(){
|
||||||
|
const QString qtVersion = QString::fromLatin1(qVersion());
|
||||||
|
const QStringList versionParts = qtVersion.split('.');
|
||||||
|
return versionParts[1].toInt();
|
||||||
|
}
|
||||||
|
|
||||||
void FluTools::setQuitOnLastWindowClosed(bool val){
|
void FluTools::setQuitOnLastWindowClosed(bool val){
|
||||||
qApp->setQuitOnLastWindowClosed(val);
|
qApp->setQuitOnLastWindowClosed(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FluTools::setOverrideCursor(Qt::CursorShape shape){
|
||||||
|
qApp->setOverrideCursor(QCursor(shape));
|
||||||
|
}
|
||||||
|
|
||||||
|
void FluTools::restoreOverrideCursor(){
|
||||||
|
qApp->restoreOverrideCursor();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FluTools::deleteItem(QObject *p){
|
||||||
|
if(p){
|
||||||
|
delete p;
|
||||||
|
p = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -50,6 +50,15 @@ public:
|
|||||||
|
|
||||||
Q_INVOKABLE void setQuitOnLastWindowClosed(bool val);
|
Q_INVOKABLE void setQuitOnLastWindowClosed(bool val);
|
||||||
|
|
||||||
|
Q_INVOKABLE int qtMajor();
|
||||||
|
|
||||||
|
Q_INVOKABLE int qtMinor();
|
||||||
|
|
||||||
|
Q_INVOKABLE void setOverrideCursor(Qt::CursorShape shape);
|
||||||
|
|
||||||
|
Q_INVOKABLE void restoreOverrideCursor();
|
||||||
|
|
||||||
|
Q_INVOKABLE void deleteItem(QObject *p);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FLUTOOLS_H
|
#endif // FLUTOOLS_H
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#include "WindowHelper.h"
|
#include "WindowHelper.h"
|
||||||
|
|
||||||
#include "FluRegister.h"
|
#include "FluRegister.h"
|
||||||
#include "FluApp.h"
|
|
||||||
|
|
||||||
WindowHelper::WindowHelper(QObject *parent)
|
WindowHelper::WindowHelper(QObject *parent)
|
||||||
: QObject{parent}
|
: QObject{parent}
|
||||||
@ -19,10 +18,3 @@ QVariant WindowHelper::createRegister(QQuickWindow* window,const QString& path){
|
|||||||
p->path(path);
|
p->path(path);
|
||||||
return QVariant::fromValue(p);
|
return QVariant::fromValue(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowHelper::deleteWindow(){
|
|
||||||
if(this->window){
|
|
||||||
FluApp::getInstance()->wnds.remove(this->window->winId());
|
|
||||||
this->window->deleteLater();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -24,11 +24,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
Q_INVOKABLE void initWindow(QQuickWindow* window);
|
Q_INVOKABLE void initWindow(QQuickWindow* window);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief deleteWindow 销毁窗口,释放资源,QML中的Window close并不会销毁窗口,只是把窗口隐藏了
|
|
||||||
*/
|
|
||||||
Q_INVOKABLE void deleteWindow();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief createRegister 创建一个FluRegsiter对象,在FluWindow中registerForWindowResult方法调用
|
* @brief createRegister 创建一个FluRegsiter对象,在FluWindow中registerForWindowResult方法调用
|
||||||
* @param window
|
* @param window
|
||||||
|
@ -19,6 +19,9 @@ Rectangle{
|
|||||||
property color closeNormalColor: Qt.rgba(0,0,0,0)
|
property color closeNormalColor: Qt.rgba(0,0,0,0)
|
||||||
property color closeHoverColor: Qt.rgba(251/255,115/255,115/255,1)
|
property color closeHoverColor: Qt.rgba(251/255,115/255,115/255,1)
|
||||||
property bool showDark: false
|
property bool showDark: false
|
||||||
|
property bool showClose: true
|
||||||
|
property bool showMinimize: true
|
||||||
|
property bool showMaximize: true
|
||||||
property bool titleVisible: true
|
property bool titleVisible: true
|
||||||
property bool isMac: FluTools.isMacos()
|
property bool isMac: FluTools.isMacos()
|
||||||
property color borerlessColor : FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
property color borerlessColor : FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
||||||
@ -76,20 +79,16 @@ Rectangle{
|
|||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
height: root.height
|
height: root.height
|
||||||
spacing: 0
|
spacing: 0
|
||||||
RowLayout{
|
FluToggleSwitch{
|
||||||
|
id:btn_dark
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
Layout.rightMargin: 5
|
Layout.rightMargin: 5
|
||||||
visible: showDark
|
visible: showDark
|
||||||
spacing: 5
|
text:darkText
|
||||||
FluText{
|
textColor:root.textColor
|
||||||
text:darkText
|
checked: FluTheme.dark
|
||||||
color:root.textColor
|
textRight: false
|
||||||
}
|
clickListener:()=> darkClickListener(btn_dark)
|
||||||
FluToggleSwitch{
|
|
||||||
id:btn_dark
|
|
||||||
checked: FluTheme.dark
|
|
||||||
clickListener:()=> darkClickListener(btn_dark)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
FluIconButton{
|
FluIconButton{
|
||||||
id:btn_minimize
|
id:btn_minimize
|
||||||
@ -100,7 +99,7 @@ Rectangle{
|
|||||||
iconSize: 11
|
iconSize: 11
|
||||||
text:minimizeText
|
text:minimizeText
|
||||||
radius: 0
|
radius: 0
|
||||||
visible: !isMac
|
visible: !isMac && showMinimize
|
||||||
iconColor: root.textColor
|
iconColor: root.textColor
|
||||||
color: hovered ? minimizeHoverColor : minimizeNormalColor
|
color: hovered ? minimizeHoverColor : minimizeNormalColor
|
||||||
onClicked: minClickListener()
|
onClicked: minClickListener()
|
||||||
@ -112,7 +111,7 @@ Rectangle{
|
|||||||
iconSource : d.isRestore ? FluentIcons.ChromeRestore : FluentIcons.ChromeMaximize
|
iconSource : d.isRestore ? FluentIcons.ChromeRestore : FluentIcons.ChromeMaximize
|
||||||
color: hovered ? maximizeHoverColor : maximizeNormalColor
|
color: hovered ? maximizeHoverColor : maximizeNormalColor
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
visible: d.resizable && !isMac
|
visible: d.resizable && !isMac && showMaximize
|
||||||
radius: 0
|
radius: 0
|
||||||
iconColor: root.textColor
|
iconColor: root.textColor
|
||||||
text:d.isRestore?restoreText:maximizeText
|
text:d.isRestore?restoreText:maximizeText
|
||||||
@ -126,7 +125,7 @@ Rectangle{
|
|||||||
text:closeText
|
text:closeText
|
||||||
width: 40
|
width: 40
|
||||||
height: 30
|
height: 30
|
||||||
visible: !isMac
|
visible: !isMac && showClose
|
||||||
radius: 0
|
radius: 0
|
||||||
iconSize: 10
|
iconSize: 10
|
||||||
iconColor: hovered ? Qt.rgba(1,1,1,1) : root.textColor
|
iconColor: hovered ? Qt.rgba(1,1,1,1) : root.textColor
|
||||||
|
@ -22,33 +22,29 @@ FluTextBox{
|
|||||||
id:control_popup
|
id:control_popup
|
||||||
y:control.height
|
y:control.height
|
||||||
focus: false
|
focus: false
|
||||||
|
// modal: true
|
||||||
|
// Overlay.modal: Item{}
|
||||||
|
|
||||||
|
padding: 0
|
||||||
enter: Transition {
|
enter: Transition {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
property: "opacity"
|
property: "opacity"
|
||||||
from:0
|
from:0
|
||||||
to:1
|
to:1
|
||||||
duration: 83
|
duration: FluTheme.enableAnimation ? 83 : 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onVisibleChanged: {
|
contentItem: FluRectangle{
|
||||||
if(visible){
|
radius: [4,4,4,4]
|
||||||
list_view.currentIndex = -1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
background: Rectangle{
|
|
||||||
id:container
|
|
||||||
width: control.width
|
|
||||||
radius: 4
|
|
||||||
FluShadow{
|
FluShadow{
|
||||||
radius: 4
|
radius: 4
|
||||||
}
|
}
|
||||||
color: FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1)
|
color: FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1)
|
||||||
height: 38*Math.min(Math.max(list_view.count,1),8)
|
|
||||||
ListView{
|
ListView{
|
||||||
id:list_view
|
id:list_view
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
clip: true
|
clip: true
|
||||||
currentIndex: -1
|
boundsBehavior: ListView.StopAtBounds
|
||||||
ScrollBar.vertical: FluScrollBar {}
|
ScrollBar.vertical: FluScrollBar {}
|
||||||
header: Item{
|
header: Item{
|
||||||
width: control.width
|
width: control.width
|
||||||
@ -63,53 +59,39 @@ FluTextBox{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delegate:Control{
|
delegate:FluControl{
|
||||||
|
id:item_control
|
||||||
|
height: 38
|
||||||
width: control.width
|
width: control.width
|
||||||
padding:10
|
onClicked:{
|
||||||
|
handleClick(modelData)
|
||||||
|
}
|
||||||
background: Rectangle{
|
background: Rectangle{
|
||||||
|
FluFocusRectangle{
|
||||||
|
visible: item_control.activeFocus
|
||||||
|
radius:4
|
||||||
|
}
|
||||||
color: {
|
color: {
|
||||||
if(list_view.currentIndex === index){
|
|
||||||
return FluTheme.dark ? Qt.rgba(63/255,60/255,61/255,1) : Qt.rgba(237/255,237/255,242/255,1)
|
|
||||||
}
|
|
||||||
if(hovered){
|
if(hovered){
|
||||||
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(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)
|
return FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(0,0,0,0)
|
||||||
}
|
}
|
||||||
MouseArea{
|
|
||||||
id:mouse_area
|
|
||||||
anchors.fill: parent
|
|
||||||
Connections{
|
|
||||||
target: control
|
|
||||||
function onHandleClicked(){
|
|
||||||
if((list_view.currentIndex === index)){
|
|
||||||
handleClick(modelData)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onClicked: handleClick(modelData)
|
|
||||||
}
|
|
||||||
Rectangle{
|
|
||||||
width: 3
|
|
||||||
color:FluTheme.primaryColor.dark
|
|
||||||
visible: list_view.currentIndex === index
|
|
||||||
radius: 3
|
|
||||||
height: 20
|
|
||||||
anchors{
|
|
||||||
left: parent.left
|
|
||||||
verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
contentItem: FluText{
|
contentItem: FluText{
|
||||||
text:modelData.title
|
text:modelData.title
|
||||||
anchors{
|
leftPadding: 10
|
||||||
verticalCenter: parent.verticalCenter
|
rightPadding: 10
|
||||||
}
|
verticalAlignment : Qt.AlignVCenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
background: Item{
|
||||||
|
id:container
|
||||||
|
implicitWidth: control.width
|
||||||
|
implicitHeight: 38*Math.min(Math.max(list_view.count,1),8)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
onTextChanged: {
|
onTextChanged: {
|
||||||
loadData()
|
loadData()
|
||||||
|
@ -33,7 +33,7 @@ Item {
|
|||||||
properties: "opacity"
|
properties: "opacity"
|
||||||
from: 1
|
from: 1
|
||||||
to: 0
|
to: 0
|
||||||
duration: 83
|
duration: FluTheme.enableAnimation ? 83 : 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
add: Transition {
|
add: Transition {
|
||||||
@ -41,7 +41,7 @@ Item {
|
|||||||
properties: "opacity"
|
properties: "opacity"
|
||||||
from: 0
|
from: 0
|
||||||
to: 1
|
to: 1
|
||||||
duration: 83
|
duration: FluTheme.enableAnimation ? 83 : 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delegate: Item{
|
delegate: Item{
|
||||||
|
@ -11,7 +11,7 @@ Button {
|
|||||||
property color disableColor: FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(252/255,252/255,252/255,1)
|
property color disableColor: FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(252/255,252/255,252/255,1)
|
||||||
property color textColor: {
|
property color textColor: {
|
||||||
if(FluTheme.dark){
|
if(FluTheme.dark){
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return Qt.rgba(131/255,131/255,131/255,1)
|
return Qt.rgba(131/255,131/255,131/255,1)
|
||||||
}
|
}
|
||||||
if(pressed){
|
if(pressed){
|
||||||
@ -19,7 +19,7 @@ Button {
|
|||||||
}
|
}
|
||||||
return Qt.rgba(1,1,1,1)
|
return Qt.rgba(1,1,1,1)
|
||||||
}else{
|
}else{
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return Qt.rgba(160/255,160/255,160/255,1)
|
return Qt.rgba(160/255,160/255,160/255,1)
|
||||||
}
|
}
|
||||||
if(pressed){
|
if(pressed){
|
||||||
@ -44,7 +44,7 @@ Button {
|
|||||||
border.width: 1
|
border.width: 1
|
||||||
radius: 4
|
radius: 4
|
||||||
color:{
|
color:{
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return disableColor
|
return disableColor
|
||||||
}
|
}
|
||||||
return hovered ? hoverColor :normalColor
|
return hovered ? hoverColor :normalColor
|
||||||
|
@ -65,7 +65,7 @@ Rectangle {
|
|||||||
property: "opacity"
|
property: "opacity"
|
||||||
from:0
|
from:0
|
||||||
to:1
|
to:1
|
||||||
duration: 83
|
duration: FluTheme.enableAnimation ? 83 : 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exit:Transition {
|
exit:Transition {
|
||||||
@ -73,7 +73,7 @@ Rectangle {
|
|||||||
property: "opacity"
|
property: "opacity"
|
||||||
from:1
|
from:1
|
||||||
to:0
|
to:0
|
||||||
duration: 83
|
duration: FluTheme.enableAnimation ? 83 : 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
contentItem: Item{
|
contentItem: Item{
|
||||||
|
@ -243,8 +243,6 @@ Item {
|
|||||||
}
|
}
|
||||||
FluTextButton{
|
FluTextButton{
|
||||||
id:title
|
id:title
|
||||||
leftPadding: 0
|
|
||||||
rightPadding: 0
|
|
||||||
anchors{
|
anchors{
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
left: parent.left
|
left: parent.left
|
||||||
|
@ -19,6 +19,10 @@ Button {
|
|||||||
property color checkedPreesedColor: FluTheme.dark ? Qt.darker(checkedColor,1.3) : Qt.lighter(checkedColor,1.3)
|
property color checkedPreesedColor: FluTheme.dark ? Qt.darker(checkedColor,1.3) : Qt.lighter(checkedColor,1.3)
|
||||||
property color checkedDisableColor: FluTheme.dark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1)
|
property color checkedDisableColor: FluTheme.dark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1)
|
||||||
property color disableColor: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(253/255,253/255,253/255,1)
|
property color disableColor: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(253/255,253/255,253/255,1)
|
||||||
|
property real size: 18
|
||||||
|
property alias textColor: btn_text.textColor
|
||||||
|
property bool textRight: true
|
||||||
|
property real textSpacing: 6
|
||||||
property var clickListener : function(){
|
property var clickListener : function(){
|
||||||
checked = !checked
|
checked = !checked
|
||||||
}
|
}
|
||||||
@ -39,13 +43,14 @@ Button {
|
|||||||
Accessible.onPressAction: control.clicked()
|
Accessible.onPressAction: control.clicked()
|
||||||
focusPolicy:Qt.TabFocus
|
focusPolicy:Qt.TabFocus
|
||||||
contentItem: RowLayout{
|
contentItem: RowLayout{
|
||||||
spacing: 4
|
spacing: control.textSpacing
|
||||||
|
layoutDirection:control.textRight ? Qt.LeftToRight : Qt.RightToLeft
|
||||||
Rectangle{
|
Rectangle{
|
||||||
width: 20
|
width: control.size
|
||||||
height: 20
|
height: control.size
|
||||||
radius: 4
|
radius: 4
|
||||||
border.color: {
|
border.color: {
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return borderDisableColor
|
return borderDisableColor
|
||||||
}
|
}
|
||||||
if(checked){
|
if(checked){
|
||||||
@ -62,7 +67,7 @@ Button {
|
|||||||
border.width: 1
|
border.width: 1
|
||||||
color: {
|
color: {
|
||||||
if(checked){
|
if(checked){
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return checkedDisableColor
|
return checkedDisableColor
|
||||||
}
|
}
|
||||||
if(pressed){
|
if(pressed){
|
||||||
@ -73,7 +78,7 @@ Button {
|
|||||||
}
|
}
|
||||||
return checkedColor
|
return checkedColor
|
||||||
}
|
}
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return disableColor
|
return disableColor
|
||||||
}
|
}
|
||||||
if(hovered){
|
if(hovered){
|
||||||
@ -82,6 +87,7 @@ Button {
|
|||||||
return normalColor
|
return normalColor
|
||||||
}
|
}
|
||||||
Behavior on color {
|
Behavior on color {
|
||||||
|
enabled: FluTheme.enableAnimation
|
||||||
ColorAnimation{
|
ColorAnimation{
|
||||||
duration: 83
|
duration: 83
|
||||||
}
|
}
|
||||||
@ -93,6 +99,7 @@ Button {
|
|||||||
visible: checked
|
visible: checked
|
||||||
iconColor: FluTheme.dark ? Qt.rgba(0,0,0,1) : Qt.rgba(1,1,1,1)
|
iconColor: FluTheme.dark ? Qt.rgba(0,0,0,1) : Qt.rgba(1,1,1,1)
|
||||||
Behavior on visible {
|
Behavior on visible {
|
||||||
|
enabled: FluTheme.enableAnimation
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 83
|
duration: 83
|
||||||
}
|
}
|
||||||
@ -100,8 +107,9 @@ Button {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluText{
|
FluText{
|
||||||
|
id:btn_text
|
||||||
text: control.text
|
text: control.text
|
||||||
Layout.leftMargin: 5
|
Layout.alignment: Qt.AlignVCenter
|
||||||
visible: text !== ""
|
visible: text !== ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ Button{
|
|||||||
property: "opacity"
|
property: "opacity"
|
||||||
from:0
|
from:0
|
||||||
to:1
|
to:1
|
||||||
duration: 83
|
duration: FluTheme.enableAnimation ? 83 : 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ Button{
|
|||||||
property: "opacity"
|
property: "opacity"
|
||||||
from:1
|
from:1
|
||||||
to:0
|
to:0
|
||||||
duration: 83
|
duration: FluTheme.enableAnimation ? 83 : 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function showPopup() {
|
function showPopup() {
|
||||||
|
@ -6,6 +6,7 @@ import QtQuick.Templates as T
|
|||||||
|
|
||||||
ComboBox {
|
ComboBox {
|
||||||
id: control
|
id: control
|
||||||
|
signal commit
|
||||||
property bool disabled: false
|
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)
|
property color normalColor: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(254/255,254/255,254/255,1)
|
||||||
property color hoverColor: FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
|
property color hoverColor: FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
|
||||||
@ -15,7 +16,7 @@ ComboBox {
|
|||||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||||
implicitContentHeight + topPadding + bottomPadding,
|
implicitContentHeight + topPadding + bottomPadding,
|
||||||
implicitIndicatorHeight + topPadding + bottomPadding)
|
implicitIndicatorHeight + topPadding + bottomPadding)
|
||||||
|
font: FluTextStyle.Body
|
||||||
leftPadding: padding + (!control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing)
|
leftPadding: padding + (!control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing)
|
||||||
rightPadding: padding + (control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing)
|
rightPadding: padding + (control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing)
|
||||||
enabled: !disabled
|
enabled: !disabled
|
||||||
@ -23,8 +24,8 @@ ComboBox {
|
|||||||
width: ListView.view.width
|
width: ListView.view.width
|
||||||
text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
|
text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
|
||||||
palette.text: control.palette.text
|
palette.text: control.palette.text
|
||||||
|
font: control.font
|
||||||
palette.highlightedText: control.palette.highlightedText
|
palette.highlightedText: control.palette.highlightedText
|
||||||
font.bold: control.currentIndex === index
|
|
||||||
highlighted: control.highlightedIndex === index
|
highlighted: control.highlightedIndex === index
|
||||||
hoverEnabled: control.hoverEnabled
|
hoverEnabled: control.hoverEnabled
|
||||||
}
|
}
|
||||||
@ -39,16 +40,17 @@ ComboBox {
|
|||||||
}
|
}
|
||||||
contentItem: T.TextField {
|
contentItem: T.TextField {
|
||||||
property bool disabled: !control.editable
|
property bool disabled: !control.editable
|
||||||
leftPadding: !control.mirrored ? 12 : control.editable && activeFocus ? 3 : 1
|
leftPadding: !control.mirrored ? 10 : control.editable && activeFocus ? 3 : 1
|
||||||
rightPadding: control.mirrored ? 12 : control.editable && activeFocus ? 3 : 1
|
rightPadding: control.mirrored ? 10 : control.editable && activeFocus ? 3 : 1
|
||||||
topPadding: 6 - control.padding
|
topPadding: 6 - control.padding
|
||||||
bottomPadding: 6 - control.padding
|
bottomPadding: 6 - control.padding
|
||||||
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
||||||
selectionColor: FluTheme.primaryColor.lightest
|
selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6)
|
||||||
|
selectedTextColor: color
|
||||||
text: control.editable ? control.editText : control.displayText
|
text: control.editable ? control.editText : control.displayText
|
||||||
enabled: control.editable
|
enabled: control.editable
|
||||||
autoScroll: control.editable
|
autoScroll: control.editable
|
||||||
font:FluTextStyle.Body
|
font:control.font
|
||||||
readOnly: control.down
|
readOnly: control.down
|
||||||
color: FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1)
|
color: FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1)
|
||||||
inputMethodHints: control.inputMethodHints
|
inputMethodHints: control.inputMethodHints
|
||||||
@ -58,17 +60,24 @@ ComboBox {
|
|||||||
leftInset:1
|
leftInset:1
|
||||||
topInset:1
|
topInset:1
|
||||||
bottomInset:1
|
bottomInset:1
|
||||||
focus: true
|
|
||||||
rightInset:1
|
rightInset:1
|
||||||
background: FluTextBoxBackground{
|
background: FluTextBoxBackground{
|
||||||
border.width: 0
|
border.width: 0
|
||||||
inputItem: contentItem
|
inputItem: contentItem
|
||||||
}
|
}
|
||||||
|
Component.onCompleted: {
|
||||||
|
forceActiveFocus()
|
||||||
|
}
|
||||||
|
Keys.onEnterPressed: (event)=> handleCommit(event)
|
||||||
|
Keys.onReturnPressed:(event)=> handleCommit(event)
|
||||||
|
function handleCommit(event){
|
||||||
|
control.commit()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
implicitWidth: 140
|
implicitWidth: 140
|
||||||
implicitHeight: 28
|
implicitHeight: 32
|
||||||
border.color: FluTheme.dark ? "#505050" : "#DFDFDF"
|
border.color: FluTheme.dark ? "#505050" : "#DFDFDF"
|
||||||
border.width: 1
|
border.width: 1
|
||||||
visible: !control.flat || control.down
|
visible: !control.flat || control.down
|
||||||
@ -105,7 +114,7 @@ ComboBox {
|
|||||||
property: "opacity"
|
property: "opacity"
|
||||||
from:0
|
from:0
|
||||||
to:1
|
to:1
|
||||||
duration: 83
|
duration: FluTheme.enableAnimation ? 83 : 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exit:Transition {
|
exit:Transition {
|
||||||
@ -113,7 +122,7 @@ ComboBox {
|
|||||||
property: "opacity"
|
property: "opacity"
|
||||||
from:1
|
from:1
|
||||||
to:0
|
to:0
|
||||||
duration: 83
|
duration: FluTheme.enableAnimation ? 83 : 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
background:Rectangle{
|
background:Rectangle{
|
||||||
|
@ -11,6 +11,7 @@ FluPopup {
|
|||||||
property string neutralText: "Neutral"
|
property string neutralText: "Neutral"
|
||||||
property string negativeText: "Negative"
|
property string negativeText: "Negative"
|
||||||
property string positiveText: "Positive"
|
property string positiveText: "Positive"
|
||||||
|
property int delayTime: 100
|
||||||
signal neutralClicked
|
signal neutralClicked
|
||||||
signal negativeClicked
|
signal negativeClicked
|
||||||
signal positiveClicked
|
signal positiveClicked
|
||||||
@ -88,7 +89,8 @@ FluPopup {
|
|||||||
text: neutralText
|
text: neutralText
|
||||||
onClicked: {
|
onClicked: {
|
||||||
popup.close()
|
popup.close()
|
||||||
neutralClicked()
|
timer_delay.targetFlags = FluContentDialog.NeutralButton
|
||||||
|
timer_delay.restart()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluButton{
|
FluButton{
|
||||||
@ -99,7 +101,8 @@ FluPopup {
|
|||||||
text: negativeText
|
text: negativeText
|
||||||
onClicked: {
|
onClicked: {
|
||||||
popup.close()
|
popup.close()
|
||||||
negativeClicked()
|
timer_delay.targetFlags = FluContentDialog.NegativeButton
|
||||||
|
timer_delay.restart()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluFilledButton{
|
FluFilledButton{
|
||||||
@ -110,10 +113,27 @@ FluPopup {
|
|||||||
text: positiveText
|
text: positiveText
|
||||||
onClicked: {
|
onClicked: {
|
||||||
popup.close()
|
popup.close()
|
||||||
positiveClicked()
|
timer_delay.targetFlags = FluContentDialog.PositiveButton
|
||||||
|
timer_delay.restart()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Timer{
|
||||||
|
property int targetFlags
|
||||||
|
id:timer_delay
|
||||||
|
interval: popup.delayTime
|
||||||
|
onTriggered: {
|
||||||
|
if(targetFlags === FluContentDialog.NegativeButton){
|
||||||
|
negativeClicked()
|
||||||
|
}
|
||||||
|
if(targetFlags === FluContentDialog.NeutralButton){
|
||||||
|
neutralClicked()
|
||||||
|
}
|
||||||
|
if(targetFlags === FluContentDialog.PositiveButton){
|
||||||
|
positiveClicked()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,15 +4,13 @@ import QtQuick.Window
|
|||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
Item {
|
FluPage {
|
||||||
property alias title: text_title.text
|
property alias title: text_title.text
|
||||||
default property alias content: container.data
|
default property alias content: container.data
|
||||||
property int leftPadding: 10
|
property int leftPadding: 10
|
||||||
property int topPadding: 0
|
property int topPadding: 0
|
||||||
property int rightPadding: 10
|
property int rightPadding: 10
|
||||||
property int bottomPadding: 10
|
property int bottomPadding: 10
|
||||||
property int pageMode: FluNavigationView.SingleTop
|
|
||||||
property string url: ''
|
|
||||||
id:control
|
id:control
|
||||||
FluText{
|
FluText{
|
||||||
id:text_title
|
id:text_title
|
||||||
|
@ -14,15 +14,19 @@ TextEdit {
|
|||||||
leftPadding: 0
|
leftPadding: 0
|
||||||
rightPadding: 0
|
rightPadding: 0
|
||||||
topPadding: 0
|
topPadding: 0
|
||||||
|
selectByMouse: true
|
||||||
|
selectedTextColor: color
|
||||||
bottomPadding: 0
|
bottomPadding: 0
|
||||||
selectionColor: FluTheme.primaryColor.lightest
|
selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6)
|
||||||
font:FluTextStyle.Body
|
font:FluTextStyle.Body
|
||||||
onSelectedTextChanged: {
|
onSelectedTextChanged: {
|
||||||
control.forceActiveFocus()
|
control.forceActiveFocus()
|
||||||
}
|
}
|
||||||
TapHandler {
|
MouseArea{
|
||||||
|
anchors.fill: parent
|
||||||
|
cursorShape: Qt.IBeamCursor
|
||||||
acceptedButtons: Qt.RightButton
|
acceptedButtons: Qt.RightButton
|
||||||
onTapped: control.echoMode !== TextInput.Password && menu.popup()
|
onClicked: control.echoMode !== TextInput.Password && menu.popup()
|
||||||
}
|
}
|
||||||
FluTextBoxMenu{
|
FluTextBoxMenu{
|
||||||
id:menu
|
id:menu
|
||||||
|
@ -8,11 +8,9 @@ Rectangle {
|
|||||||
property color dividerColor: FluTheme.dark ? Qt.rgba(77/255,77/255,77/255,1) : Qt.rgba(239/255,239/255,239/255,1)
|
property color dividerColor: FluTheme.dark ? Qt.rgba(77/255,77/255,77/255,1) : Qt.rgba(239/255,239/255,239/255,1)
|
||||||
property color hoverColor: FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
|
property color hoverColor: FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
|
||||||
property color normalColor: FluTheme.dark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(254/255,254/255,254/255,1)
|
property color normalColor: FluTheme.dark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(254/255,254/255,254/255,1)
|
||||||
property var window : Window.window
|
|
||||||
property bool showYear: true
|
property bool showYear: true
|
||||||
property bool changeFlag: true
|
property var current
|
||||||
readonly property var rowData: ["","",""]
|
id:control
|
||||||
id:root
|
|
||||||
color: {
|
color: {
|
||||||
if(mouse_area.containsMouse){
|
if(mouse_area.containsMouse){
|
||||||
return hoverColor
|
return hoverColor
|
||||||
@ -24,6 +22,13 @@ Rectangle {
|
|||||||
radius: 4
|
radius: 4
|
||||||
border.width: 1
|
border.width: 1
|
||||||
border.color: dividerColor
|
border.color: dividerColor
|
||||||
|
Item{
|
||||||
|
id:d
|
||||||
|
property var window: Window.window
|
||||||
|
property bool changeFlag: true
|
||||||
|
property var rowData: ["","",""]
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
MouseArea{
|
MouseArea{
|
||||||
id:mouse_area
|
id:mouse_area
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
@ -96,7 +101,7 @@ Rectangle {
|
|||||||
property: "opacity"
|
property: "opacity"
|
||||||
from:0
|
from:0
|
||||||
to:1
|
to:1
|
||||||
duration: 83
|
duration: FluTheme.enableAnimation ? 83 : 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exit:Transition {
|
exit:Transition {
|
||||||
@ -104,7 +109,7 @@ Rectangle {
|
|||||||
property: "opacity"
|
property: "opacity"
|
||||||
from:1
|
from:1
|
||||||
to:0
|
to:0
|
||||||
duration: 83
|
duration: FluTheme.enableAnimation ? 83 : 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
background:Item{
|
background:Item{
|
||||||
@ -317,8 +322,19 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
text: "确定"
|
text: "确定"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
changeFlag = false
|
d.changeFlag = false
|
||||||
popup.close()
|
popup.close()
|
||||||
|
const year = text_year.text
|
||||||
|
const month = text_month.text
|
||||||
|
const day = text_day.text
|
||||||
|
const date = new Date()
|
||||||
|
date.setFullYear(parseInt(year));
|
||||||
|
date.setMonth(parseInt(month) - 1);
|
||||||
|
date.setDate(parseInt(day));
|
||||||
|
date.setHours(0);
|
||||||
|
date.setMinutes(0);
|
||||||
|
date.setSeconds(0);
|
||||||
|
current = date
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -326,10 +342,10 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
y:35
|
y:35
|
||||||
function showPopup() {
|
function showPopup() {
|
||||||
changeFlag = true
|
d.changeFlag = true
|
||||||
rowData[0] = text_year.text
|
d.rowData[0] = text_year.text
|
||||||
rowData[1] = text_month.text
|
d.rowData[1] = text_month.text
|
||||||
rowData[2] = text_day.text
|
d.rowData[2] = text_day.text
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
var year = text_year.text === "年"? now.getFullYear() : Number(text_year.text);
|
var year = text_year.text === "年"? now.getFullYear() : Number(text_year.text);
|
||||||
var month = text_month.text === "月"? now.getMonth() + 1 : Number(text_month.text);
|
var month = text_month.text === "月"? now.getMonth() + 1 : Number(text_month.text);
|
||||||
@ -342,21 +358,21 @@ Rectangle {
|
|||||||
list_view_3.model = generateMonthDaysArray(year,month)
|
list_view_3.model = generateMonthDaysArray(year,month)
|
||||||
list_view_3.currentIndex = list_view_3.model.indexOf(day)
|
list_view_3.currentIndex = list_view_3.model.indexOf(day)
|
||||||
text_day.text = day
|
text_day.text = day
|
||||||
var pos = root.mapToItem(null, 0, 0)
|
var pos = control.mapToItem(null, 0, 0)
|
||||||
if(window.height>pos.y+root.height+container.height){
|
if(d.window.height>pos.y+control.height+container.height){
|
||||||
popup.y = root.height
|
popup.y = control.height
|
||||||
} else if(pos.y>container.height){
|
} else if(pos.y>container.height){
|
||||||
popup.y = -container.height
|
popup.y = -container.height
|
||||||
} else {
|
} else {
|
||||||
popup.y = window.height-(pos.y+container.height)
|
popup.y = d.window.height-(pos.y+container.height)
|
||||||
}
|
}
|
||||||
popup.open()
|
popup.open()
|
||||||
}
|
}
|
||||||
onClosed: {
|
onClosed: {
|
||||||
if(changeFlag){
|
if(d.changeFlag){
|
||||||
text_year.text = rowData[0]
|
text_year.text = d.rowData[0]
|
||||||
text_month.text = rowData[1]
|
text_month.text = d.rowData[1]
|
||||||
text_day.text = rowData[2]
|
text_day.text = d.rowData[2]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,5 +3,5 @@ import QtQuick.Window
|
|||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
color: FluTheme.dark ? Qt.rgba(60/255,60/255,60/255,1) : Qt.rgba(210/255,210/255,210/255,1)
|
color: FluTheme.dark ? Qt.rgba(80/255,80/255,80/255,1) : Qt.rgba(210/255,210/255,210/255,1)
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ Button {
|
|||||||
property color disableColor: FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(252/255,252/255,252/255,1)
|
property color disableColor: FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(252/255,252/255,252/255,1)
|
||||||
property color textColor: {
|
property color textColor: {
|
||||||
if(FluTheme.dark){
|
if(FluTheme.dark){
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return Qt.rgba(131/255,131/255,131/255,1)
|
return Qt.rgba(131/255,131/255,131/255,1)
|
||||||
}
|
}
|
||||||
if(pressed){
|
if(pressed){
|
||||||
@ -20,7 +20,7 @@ Button {
|
|||||||
}
|
}
|
||||||
return Qt.rgba(1,1,1,1)
|
return Qt.rgba(1,1,1,1)
|
||||||
}else{
|
}else{
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return Qt.rgba(160/255,160/255,160/255,1)
|
return Qt.rgba(160/255,160/255,160/255,1)
|
||||||
}
|
}
|
||||||
if(pressed){
|
if(pressed){
|
||||||
@ -51,7 +51,7 @@ Button {
|
|||||||
radius:8
|
radius:8
|
||||||
}
|
}
|
||||||
color:{
|
color:{
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return disableColor
|
return disableColor
|
||||||
}
|
}
|
||||||
return hovered ? hoverColor :normalColor
|
return hovered ? hoverColor :normalColor
|
||||||
@ -75,9 +75,9 @@ Button {
|
|||||||
color: control.textColor
|
color: control.textColor
|
||||||
}
|
}
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if(items && menu.count !==0){
|
if(menu.count !==0){
|
||||||
var pos = control.mapToItem(null, 0, 0)
|
var pos = control.mapToItem(null, 0, 0)
|
||||||
var containerHeight = menu.height
|
var containerHeight = menu.count*36
|
||||||
if(window.height>pos.y+control.height+containerHeight){
|
if(window.height>pos.y+control.height+containerHeight){
|
||||||
menu.y = control.height
|
menu.y = control.height
|
||||||
}else if(pos.y>containerHeight){
|
}else if(pos.y>containerHeight){
|
||||||
@ -90,6 +90,7 @@ Button {
|
|||||||
}
|
}
|
||||||
FluMenu{
|
FluMenu{
|
||||||
id:menu
|
id:menu
|
||||||
|
modal:true
|
||||||
width: control.width
|
width: control.width
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,10 +9,8 @@ Item {
|
|||||||
property int contentHeight : 300
|
property int contentHeight : 300
|
||||||
default property alias content: container.data
|
default property alias content: container.data
|
||||||
id:control
|
id:control
|
||||||
height: layout_header.height + container.height
|
implicitHeight: Math.max((layout_header.height + container.height),layout_header.height)
|
||||||
width: 400
|
implicitWidth: 400
|
||||||
implicitWidth: width
|
|
||||||
implicitHeight: height
|
|
||||||
Rectangle{
|
Rectangle{
|
||||||
id:layout_header
|
id:layout_header
|
||||||
width: parent.width
|
width: parent.width
|
||||||
@ -56,32 +54,69 @@ Item {
|
|||||||
iconSource:FluentIcons.ChevronUp
|
iconSource:FluentIcons.ChevronUp
|
||||||
iconSize: 15
|
iconSize: 15
|
||||||
Behavior on rotation {
|
Behavior on rotation {
|
||||||
|
enabled: FluTheme.enableAnimation
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 167
|
duration: 167
|
||||||
|
easing.type: Easing.OutCubic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Rectangle{
|
Item{
|
||||||
id:container
|
|
||||||
width: parent.width
|
|
||||||
clip: true
|
|
||||||
anchors{
|
anchors{
|
||||||
top: layout_header.bottom
|
top: layout_header.bottom
|
||||||
topMargin: -1
|
topMargin: -1
|
||||||
left: layout_header.left
|
left: layout_header.left
|
||||||
}
|
}
|
||||||
radius: 4
|
width: parent.width
|
||||||
color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
|
clip: true
|
||||||
border.color: FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1)
|
visible: contentHeight+container.y !== 0
|
||||||
height: expand ? contentHeight : 0
|
height: contentHeight+container.y
|
||||||
Behavior on height {
|
Rectangle{
|
||||||
NumberAnimation{
|
id:container
|
||||||
duration: 167
|
width: parent.width
|
||||||
easing.type: Easing.BezierSpline
|
height: parent.height
|
||||||
easing.bezierCurve: expand ? [ 0, 0, 0, 1 ] : [ 1, 0, 0, 0 ]
|
radius: 4
|
||||||
}
|
color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
|
||||||
|
border.color: FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1)
|
||||||
|
y: -contentHeight
|
||||||
|
states: [
|
||||||
|
State{
|
||||||
|
name:"expand"
|
||||||
|
when: control.expand
|
||||||
|
PropertyChanges {
|
||||||
|
target: container
|
||||||
|
y:0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
State{
|
||||||
|
name:"collapsed"
|
||||||
|
when: !control.expand
|
||||||
|
PropertyChanges {
|
||||||
|
target: container
|
||||||
|
y:-contentHeight
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
transitions: [
|
||||||
|
Transition {
|
||||||
|
to:"expand"
|
||||||
|
NumberAnimation {
|
||||||
|
properties: "y"
|
||||||
|
duration: FluTheme.enableAnimation ? 167 : 0
|
||||||
|
easing.type: Easing.OutCubic
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Transition {
|
||||||
|
to:"collapsed"
|
||||||
|
NumberAnimation {
|
||||||
|
properties: "y"
|
||||||
|
duration: FluTheme.enableAnimation ? 167 : 0
|
||||||
|
easing.type: Easing.OutCubic
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ Button {
|
|||||||
property color pressedColor: FluTheme.dark ? Qt.darker(normalColor,1.2) : Qt.lighter(normalColor,1.2)
|
property color pressedColor: FluTheme.dark ? Qt.darker(normalColor,1.2) : Qt.lighter(normalColor,1.2)
|
||||||
property color textColor: {
|
property color textColor: {
|
||||||
if(FluTheme.dark){
|
if(FluTheme.dark){
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return Qt.rgba(173/255,173/255,173/255,1)
|
return Qt.rgba(173/255,173/255,173/255,1)
|
||||||
}
|
}
|
||||||
return Qt.rgba(0,0,0,1)
|
return Qt.rgba(0,0,0,1)
|
||||||
@ -38,7 +38,7 @@ Button {
|
|||||||
radius:4
|
radius:4
|
||||||
}
|
}
|
||||||
color:{
|
color:{
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return disableColor
|
return disableColor
|
||||||
}
|
}
|
||||||
if(pressed){
|
if(pressed){
|
||||||
|
@ -9,12 +9,12 @@ Button {
|
|||||||
property bool disabled: false
|
property bool disabled: false
|
||||||
property int radius:4
|
property int radius:4
|
||||||
property string contentDescription: ""
|
property string contentDescription: ""
|
||||||
property color hoverColor: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(0,0,0,0.03)
|
property color hoverColor: FluTheme.dark ? Qt.rgba(1,1,1,0.03) : Qt.rgba(0,0,0,0.03)
|
||||||
property color pressedColor: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(0,0,0,0.06)
|
property color pressedColor: FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06)
|
||||||
property color normalColor: FluTheme.dark ? Qt.rgba(0,0,0,0) : Qt.rgba(0,0,0,0)
|
property color normalColor: FluTheme.dark ? Qt.rgba(0,0,0,0) : Qt.rgba(0,0,0,0)
|
||||||
property color disableColor: FluTheme.dark ? Qt.rgba(0,0,0,0) : Qt.rgba(0,0,0,0)
|
property color disableColor: FluTheme.dark ? Qt.rgba(0,0,0,0) : Qt.rgba(0,0,0,0)
|
||||||
property color color: {
|
property color color: {
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return disableColor
|
return disableColor
|
||||||
}
|
}
|
||||||
if(pressed){
|
if(pressed){
|
||||||
@ -24,12 +24,12 @@ Button {
|
|||||||
}
|
}
|
||||||
property color iconColor: {
|
property color iconColor: {
|
||||||
if(FluTheme.dark){
|
if(FluTheme.dark){
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return Qt.rgba(130/255,130/255,130/255,1)
|
return Qt.rgba(130/255,130/255,130/255,1)
|
||||||
}
|
}
|
||||||
return Qt.rgba(1,1,1,1)
|
return Qt.rgba(1,1,1,1)
|
||||||
}else{
|
}else{
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return Qt.rgba(161/255,161/255,161/255,1)
|
return Qt.rgba(161/255,161/255,161/255,1)
|
||||||
}
|
}
|
||||||
return Qt.rgba(0,0,0,1)
|
return Qt.rgba(0,0,0,1)
|
||||||
|
48
src/imports/FluentUI/Controls/FluImage.qml
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import FluentUI
|
||||||
|
|
||||||
|
Image {
|
||||||
|
property string errorButtonText: "重新加载"
|
||||||
|
property var clickErrorListener : function(){
|
||||||
|
image.source = ""
|
||||||
|
image.source = control.source
|
||||||
|
}
|
||||||
|
property Component errorItem : com_error
|
||||||
|
property Component loadingItem: com_loading
|
||||||
|
id: control
|
||||||
|
Loader{
|
||||||
|
anchors.fill: parent
|
||||||
|
sourceComponent: {
|
||||||
|
if(control.status === Image.Loading){
|
||||||
|
return com_loading
|
||||||
|
}else if(control.status == Image.Error){
|
||||||
|
return com_error
|
||||||
|
}else{
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Component{
|
||||||
|
id:com_loading
|
||||||
|
Rectangle{
|
||||||
|
color: FluTheme.dark ? Qt.rgba(1,1,1,0.03) : Qt.rgba(0,0,0,0.03)
|
||||||
|
FluProgressRing{
|
||||||
|
anchors.centerIn: parent
|
||||||
|
visible: control.status === Image.Loading
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Component{
|
||||||
|
id:com_error
|
||||||
|
Rectangle{
|
||||||
|
color: FluTheme.dark ? Qt.rgba(1,1,1,0.03) : Qt.rgba(0,0,0,0.03)
|
||||||
|
FluFilledButton{
|
||||||
|
text: control.errorButtonText
|
||||||
|
anchors.centerIn: parent
|
||||||
|
visible: control.status === Image.Error
|
||||||
|
onClicked: clickErrorListener()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -49,7 +49,11 @@ FluObject {
|
|||||||
spacing: 20
|
spacing: 20
|
||||||
width: parent.width
|
width: parent.width
|
||||||
move: Transition {
|
move: Transition {
|
||||||
NumberAnimation { properties: "y"; easing.type: Easing.OutBack; duration: 300 }
|
NumberAnimation {
|
||||||
|
properties: "y"
|
||||||
|
easing.type: Easing.OutCubic
|
||||||
|
duration: FluTheme.enableAnimation ? 333 : 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
onChildrenChanged: if(children.length === 0) destroy();
|
onChildrenChanged: if(children.length === 0) destroy();
|
||||||
function getLastloader(){
|
function getLastloader(){
|
||||||
@ -89,9 +93,10 @@ FluObject {
|
|||||||
scale: item ? 1 : 0;
|
scale: item ? 1 : 0;
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
Behavior on scale {
|
Behavior on scale {
|
||||||
|
enabled: FluTheme.enableAnimation
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
easing.type: Easing.OutBack;
|
easing.type: Easing.OutCubic
|
||||||
duration: 100
|
duration: 167
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sourceComponent:itemcomponent ? itemcomponent : mcontrol.fluent_sytle;
|
sourceComponent:itemcomponent ? itemcomponent : mcontrol.fluent_sytle;
|
||||||
|
@ -31,7 +31,6 @@ Item{
|
|||||||
var y = 0;
|
var y = 0;
|
||||||
var w = control.width;
|
var w = control.width;
|
||||||
var h = control.height;
|
var h = control.height;
|
||||||
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
||||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||||
ctx.save();
|
ctx.save();
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
|
@ -5,34 +5,32 @@ import QtQuick.Templates as T
|
|||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
T.Menu {
|
T.Menu {
|
||||||
|
property bool enableAnimation: true
|
||||||
id: control
|
id: control
|
||||||
|
|
||||||
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||||
contentWidth + leftPadding + rightPadding)
|
contentWidth + leftPadding + rightPadding)
|
||||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||||
contentHeight + topPadding + bottomPadding)
|
contentHeight + topPadding + bottomPadding)
|
||||||
|
|
||||||
margins: 0
|
margins: 0
|
||||||
overlap: 1
|
overlap: 1
|
||||||
spacing: 0
|
spacing: 0
|
||||||
delegate: FluMenuItem { }
|
delegate: FluMenuItem { }
|
||||||
enter: Transition {
|
enter: Transition {
|
||||||
reversible: true
|
NumberAnimation {
|
||||||
NumberAnimation {
|
property: "opacity"
|
||||||
property: "opacity"
|
from:0
|
||||||
from:0
|
to:1
|
||||||
to:1
|
duration: FluTheme.enableAnimation && control.enableAnimation ? 83 : 0
|
||||||
duration: 83
|
}
|
||||||
}
|
}
|
||||||
}
|
exit:Transition {
|
||||||
exit:Transition {
|
NumberAnimation {
|
||||||
NumberAnimation {
|
property: "opacity"
|
||||||
property: "opacity"
|
from:1
|
||||||
from:1
|
to:0
|
||||||
to:0
|
duration: FluTheme.enableAnimation && control.enableAnimation ? 83 : 0
|
||||||
duration: 83
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
contentItem: ListView {
|
contentItem: ListView {
|
||||||
implicitHeight: contentHeight
|
implicitHeight: contentHeight
|
||||||
model: control.contentModel
|
model: control.contentModel
|
||||||
@ -43,22 +41,18 @@ T.Menu {
|
|||||||
currentIndex: control.currentIndex
|
currentIndex: control.currentIndex
|
||||||
ScrollIndicator.vertical: ScrollIndicator {}
|
ScrollIndicator.vertical: ScrollIndicator {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
implicitWidth: 150
|
implicitWidth: 150
|
||||||
implicitHeight: 40
|
implicitHeight: 36
|
||||||
color:FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(240/255,240/255,240/255,1)
|
color:FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(240/255,240/255,240/255,1)
|
||||||
border.color: FluTheme.dark ? Window.active ? Qt.rgba(55/255,55/255,55/255,1):Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1)
|
border.color: FluTheme.dark ? Window.active ? Qt.rgba(55/255,55/255,55/255,1):Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1)
|
||||||
border.width: 1
|
border.width: 1
|
||||||
radius: 5
|
radius: 5
|
||||||
FluShadow{}
|
FluShadow{}
|
||||||
}
|
}
|
||||||
|
|
||||||
T.Overlay.modal: Rectangle {
|
T.Overlay.modal: Rectangle {
|
||||||
color: Color.transparent(control.palette.shadow, 0.5)
|
color: Color.transparent(control.palette.shadow, 0.5)
|
||||||
}
|
}
|
||||||
|
|
||||||
T.Overlay.modeless: Rectangle {
|
T.Overlay.modeless: Rectangle {
|
||||||
color: Color.transparent(control.palette.shadow, 0.12)
|
color: Color.transparent(control.palette.shadow, 0.12)
|
||||||
}
|
}
|
||||||
|
@ -4,21 +4,17 @@ import QtQuick.Controls.impl
|
|||||||
|
|
||||||
T.MenuBar {
|
T.MenuBar {
|
||||||
id: control
|
id: control
|
||||||
|
|
||||||
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||||
contentWidth + leftPadding + rightPadding)
|
contentWidth + leftPadding + rightPadding)
|
||||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||||
contentHeight + topPadding + bottomPadding)
|
contentHeight + topPadding + bottomPadding)
|
||||||
|
|
||||||
delegate: FluMenuBarItem { }
|
delegate: FluMenuBarItem { }
|
||||||
|
|
||||||
contentItem: Row {
|
contentItem: Row {
|
||||||
spacing: control.spacing
|
spacing: control.spacing
|
||||||
Repeater {
|
Repeater {
|
||||||
model: control.contentModel
|
model: control.contentModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
background: Item {
|
background: Item {
|
||||||
implicitHeight: 30
|
implicitHeight: 30
|
||||||
}
|
}
|
||||||
|
@ -4,28 +4,45 @@ import QtQuick.Controls.impl
|
|||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
T.MenuBarItem {
|
T.MenuBarItem {
|
||||||
|
property bool disabled: false
|
||||||
|
property color textColor: {
|
||||||
|
if(FluTheme.dark){
|
||||||
|
if(disabled){
|
||||||
|
return Qt.rgba(131/255,131/255,131/255,1)
|
||||||
|
}
|
||||||
|
if(pressed){
|
||||||
|
return Qt.rgba(162/255,162/255,162/255,1)
|
||||||
|
}
|
||||||
|
return Qt.rgba(1,1,1,1)
|
||||||
|
}else{
|
||||||
|
if(disabled){
|
||||||
|
return Qt.rgba(160/255,160/255,160/255,1)
|
||||||
|
}
|
||||||
|
if(pressed){
|
||||||
|
return Qt.rgba(96/255,96/255,96/255,1)
|
||||||
|
}
|
||||||
|
return Qt.rgba(0,0,0,1)
|
||||||
|
}
|
||||||
|
}
|
||||||
id: control
|
id: control
|
||||||
|
enabled: !disabled
|
||||||
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||||
implicitContentWidth + leftPadding + rightPadding)
|
implicitContentWidth + leftPadding + rightPadding)
|
||||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||||
implicitContentHeight + topPadding + bottomPadding,
|
implicitContentHeight + topPadding + bottomPadding,
|
||||||
implicitIndicatorHeight + topPadding + bottomPadding)
|
implicitIndicatorHeight + topPadding + bottomPadding)
|
||||||
|
|
||||||
spacing: 6
|
spacing: 6
|
||||||
padding: 6
|
padding: 6
|
||||||
leftPadding: 12
|
leftPadding: 12
|
||||||
rightPadding: 16
|
rightPadding: 16
|
||||||
|
|
||||||
icon.width: 24
|
icon.width: 24
|
||||||
icon.height: 24
|
icon.height: 24
|
||||||
icon.color: control.palette.buttonText
|
icon.color: control.palette.buttonText
|
||||||
|
|
||||||
contentItem: FluText {
|
contentItem: FluText {
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
text: control.text
|
text: control.text
|
||||||
|
color:control.textColor
|
||||||
}
|
}
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
implicitWidth: 30
|
implicitWidth: 30
|
||||||
implicitHeight: 30
|
implicitHeight: 30
|
||||||
|
@ -5,64 +5,82 @@ import QtQuick.Templates as T
|
|||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
T.MenuItem {
|
T.MenuItem {
|
||||||
|
property color textColor: {
|
||||||
|
if(FluTheme.dark){
|
||||||
|
if(!enabled){
|
||||||
|
return Qt.rgba(131/255,131/255,131/255,1)
|
||||||
|
}
|
||||||
|
if(pressed){
|
||||||
|
return Qt.rgba(162/255,162/255,162/255,1)
|
||||||
|
}
|
||||||
|
return Qt.rgba(1,1,1,1)
|
||||||
|
}else{
|
||||||
|
if(!enabled){
|
||||||
|
return Qt.rgba(160/255,160/255,160/255,1)
|
||||||
|
}
|
||||||
|
if(pressed){
|
||||||
|
return Qt.rgba(96/255,96/255,96/255,1)
|
||||||
|
}
|
||||||
|
return Qt.rgba(0,0,0,1)
|
||||||
|
}
|
||||||
|
}
|
||||||
id: control
|
id: control
|
||||||
|
|
||||||
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||||
implicitContentWidth + leftPadding + rightPadding)
|
implicitContentWidth + leftPadding + rightPadding)
|
||||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||||
implicitContentHeight + topPadding + bottomPadding,
|
implicitContentHeight + topPadding + bottomPadding,
|
||||||
implicitIndicatorHeight + topPadding + bottomPadding)
|
implicitIndicatorHeight + topPadding + bottomPadding)
|
||||||
|
|
||||||
padding: 6
|
padding: 6
|
||||||
spacing: 6
|
spacing: 6
|
||||||
|
|
||||||
icon.width: 24
|
icon.width: 24
|
||||||
icon.height: 24
|
icon.height: 24
|
||||||
icon.color: control.palette.windowText
|
icon.color: control.palette.windowText
|
||||||
|
|
||||||
height: visible ? implicitHeight : 0
|
height: visible ? implicitHeight : 0
|
||||||
|
|
||||||
contentItem: FluText {
|
contentItem: FluText {
|
||||||
readonly property real arrowPadding: control.subMenu && control.arrow ? control.arrow.width + control.spacing : 0
|
readonly property real arrowPadding: control.subMenu && control.arrow ? control.arrow.width + control.spacing : 0
|
||||||
readonly property real indicatorPadding: control.checkable && control.indicator ? control.indicator.width + control.spacing : 0
|
readonly property real indicatorPadding: control.checkable && control.indicator ? control.indicator.width + control.spacing : 0
|
||||||
leftPadding: !control.mirrored ? indicatorPadding : arrowPadding
|
leftPadding: (!control.mirrored ? indicatorPadding : arrowPadding)+5
|
||||||
rightPadding: control.mirrored ? indicatorPadding : arrowPadding
|
rightPadding: (control.mirrored ? indicatorPadding : arrowPadding)+5
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
text: control.text
|
text: control.text
|
||||||
}
|
color: control.textColor
|
||||||
|
|
||||||
|
}
|
||||||
indicator: FluIcon {
|
indicator: FluIcon {
|
||||||
x: control.mirrored ? control.width - width - control.rightPadding : control.leftPadding
|
x: control.mirrored ? control.width - width - control.rightPadding : control.leftPadding
|
||||||
y: control.topPadding + (control.availableHeight - height) / 2
|
y: control.topPadding + (control.availableHeight - height) / 2
|
||||||
visible: control.checked
|
visible: control.checked
|
||||||
iconSource: FluentIcons.CheckMark
|
iconSource: FluentIcons.CheckMark
|
||||||
}
|
}
|
||||||
|
|
||||||
arrow: FluIcon {
|
arrow: FluIcon {
|
||||||
x: control.mirrored ? control.leftPadding : control.width - width - control.rightPadding
|
x: control.mirrored ? control.leftPadding : control.width - width - control.rightPadding
|
||||||
y: control.topPadding + (control.availableHeight - height) / 2
|
y: control.topPadding + (control.availableHeight - height) / 2
|
||||||
visible: control.subMenu
|
visible: control.subMenu
|
||||||
iconSource: FluentIcons.ChevronRightMed
|
iconSource: FluentIcons.ChevronRightMed
|
||||||
}
|
}
|
||||||
|
background: Item {
|
||||||
background: Rectangle {
|
|
||||||
implicitWidth: 150
|
implicitWidth: 150
|
||||||
implicitHeight: 40
|
implicitHeight: 36
|
||||||
x: 1
|
x: 1
|
||||||
y: 1
|
y: 1
|
||||||
width: control.width - 2
|
width: control.width - 2
|
||||||
height: control.height - 2
|
height: control.height - 2
|
||||||
color:{
|
Rectangle{
|
||||||
if(FluTheme.dark){
|
anchors.fill: parent
|
||||||
if(control.highlighted){
|
anchors.margins: 3
|
||||||
return Qt.rgba(1,1,1,0.06)
|
radius: 4
|
||||||
|
color:{
|
||||||
|
if(FluTheme.dark){
|
||||||
|
if(control.highlighted){
|
||||||
|
return Qt.rgba(1,1,1,0.06)
|
||||||
|
}
|
||||||
|
return Qt.rgba(0,0,0,0)
|
||||||
|
}else{
|
||||||
|
if(control.highlighted){
|
||||||
|
return Qt.rgba(0,0,0,0.06)
|
||||||
|
}
|
||||||
|
return Qt.rgba(0,0,0,0)
|
||||||
}
|
}
|
||||||
return Qt.rgba(0,0,0,0)
|
|
||||||
}else{
|
|
||||||
if(control.highlighted){
|
|
||||||
return Qt.rgba(0,0,0,0.03)
|
|
||||||
}
|
|
||||||
return Qt.rgba(0,0,0,0)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,15 +5,12 @@ import FluentUI
|
|||||||
|
|
||||||
T.MenuSeparator {
|
T.MenuSeparator {
|
||||||
id: control
|
id: control
|
||||||
|
|
||||||
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||||
implicitContentWidth + leftPadding + rightPadding)
|
implicitContentWidth + leftPadding + rightPadding)
|
||||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||||
implicitContentHeight + topPadding + bottomPadding)
|
implicitContentHeight + topPadding + bottomPadding)
|
||||||
|
|
||||||
padding: 0
|
padding: 0
|
||||||
verticalPadding: 0
|
verticalPadding: 0
|
||||||
|
|
||||||
contentItem: Rectangle {
|
contentItem: Rectangle {
|
||||||
implicitWidth: 188
|
implicitWidth: 188
|
||||||
implicitHeight: 1
|
implicitHeight: 1
|
||||||
|
@ -4,6 +4,7 @@ import QtQuick.Controls.Basic
|
|||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
TextArea{
|
TextArea{
|
||||||
|
signal commit
|
||||||
property bool disabled: false
|
property bool disabled: false
|
||||||
property color normalColor: FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1)
|
property color normalColor: FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1)
|
||||||
property color disableColor: FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)
|
property color disableColor: FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)
|
||||||
@ -14,17 +15,20 @@ TextArea{
|
|||||||
width: 300
|
width: 300
|
||||||
enabled: !disabled
|
enabled: !disabled
|
||||||
color: {
|
color: {
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return disableColor
|
return disableColor
|
||||||
}
|
}
|
||||||
return normalColor
|
return normalColor
|
||||||
}
|
}
|
||||||
font:FluTextStyle.Body
|
font:FluTextStyle.Body
|
||||||
wrapMode: Text.WrapAnywhere
|
wrapMode: Text.WrapAnywhere
|
||||||
|
padding: 8
|
||||||
|
leftPadding: padding+2
|
||||||
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
||||||
selectionColor: FluTheme.primaryColor.lightest
|
selectedTextColor: color
|
||||||
|
selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6)
|
||||||
placeholderTextColor: {
|
placeholderTextColor: {
|
||||||
if(disabled){
|
if(!enabled){
|
||||||
return placeholderDisableColor
|
return placeholderDisableColor
|
||||||
}
|
}
|
||||||
if(focus){
|
if(focus){
|
||||||
@ -34,9 +38,23 @@ TextArea{
|
|||||||
}
|
}
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
background: FluTextBoxBackground{ inputItem: control }
|
background: FluTextBoxBackground{ inputItem: control }
|
||||||
TapHandler {
|
Keys.onEnterPressed: (event)=> d.handleCommit(event)
|
||||||
|
Keys.onReturnPressed:(event)=> d.handleCommit(event)
|
||||||
|
QtObject{
|
||||||
|
id:d
|
||||||
|
function handleCommit(event){
|
||||||
|
if(event.modifiers & Qt.ControlModifier){
|
||||||
|
insert(control.cursorPosition, "\n")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
control.commit()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MouseArea{
|
||||||
|
anchors.fill: parent
|
||||||
|
cursorShape: Qt.IBeamCursor
|
||||||
acceptedButtons: Qt.RightButton
|
acceptedButtons: Qt.RightButton
|
||||||
onTapped: control.echoMode !== TextInput.Password && menu.popup()
|
onClicked: control.echoMode !== TextInput.Password && menu.popup()
|
||||||
}
|
}
|
||||||
FluTextBoxMenu{
|
FluTextBoxMenu{
|
||||||
id:menu
|
id:menu
|
||||||
|
@ -12,26 +12,27 @@ Item {
|
|||||||
Minimal = 2,
|
Minimal = 2,
|
||||||
Auto = 3
|
Auto = 3
|
||||||
}
|
}
|
||||||
enum PageModeFlag{
|
enum PageMode {
|
||||||
Standard = 0,
|
Stack = 0,
|
||||||
SingleTask = 1,
|
NoStack = 1
|
||||||
SingleTop = 2
|
|
||||||
}
|
}
|
||||||
property url logo
|
property url logo
|
||||||
property string title: ""
|
property string title: ""
|
||||||
property FluObject items
|
property FluObject items
|
||||||
property FluObject footerItems
|
property FluObject footerItems
|
||||||
property bool dontPageAnimation: false
|
|
||||||
property int displayMode: FluNavigationView.Auto
|
property int displayMode: FluNavigationView.Auto
|
||||||
property Component autoSuggestBox
|
property Component autoSuggestBox
|
||||||
property Component actionItem
|
property Component actionItem
|
||||||
property int topPadding: 0
|
property int topPadding: 0
|
||||||
signal loginClicked
|
property int navWidth: 300
|
||||||
|
property int pageMode: FluNavigationView.Stack
|
||||||
|
signal logoClicked
|
||||||
id:control
|
id:control
|
||||||
QtObject{
|
QtObject{
|
||||||
id:d
|
id:d
|
||||||
|
property bool animDisabled:false
|
||||||
property var stackItems: []
|
property var stackItems: []
|
||||||
property int displayMode: FluNavigationView.Open
|
property int displayMode: control.displayMode
|
||||||
property bool enableNavigationPanel: false
|
property bool enableNavigationPanel: false
|
||||||
property bool isCompact: d.displayMode === FluNavigationView.Compact
|
property bool isCompact: d.displayMode === FluNavigationView.Compact
|
||||||
property bool isMinimal: d.displayMode === FluNavigationView.Minimal
|
property bool isMinimal: d.displayMode === FluNavigationView.Minimal
|
||||||
@ -42,21 +43,21 @@ Item {
|
|||||||
collapseAll()
|
collapseAll()
|
||||||
}
|
}
|
||||||
function handleItems(){
|
function handleItems(){
|
||||||
var idx = 0
|
var _idx = 0
|
||||||
var data = []
|
var data = []
|
||||||
if(items){
|
if(items){
|
||||||
for(var i=0;i<items.children.length;i++){
|
for(var i=0;i<items.children.length;i++){
|
||||||
var item = items.children[i]
|
var item = items.children[i]
|
||||||
item.idx = idx
|
item._idx = _idx
|
||||||
data.push(item)
|
data.push(item)
|
||||||
idx++
|
_idx++
|
||||||
if(item instanceof FluPaneItemExpander){
|
if(item instanceof FluPaneItemExpander){
|
||||||
for(var j=0;j<item.children.length;j++){
|
for(var j=0;j<item.children.length;j++){
|
||||||
var itemChild = item.children[j]
|
var itemChild = item.children[j]
|
||||||
itemChild.parent = item
|
itemChild.parent = item
|
||||||
itemChild.idx = idx
|
itemChild._idx = _idx
|
||||||
data.push(itemChild)
|
data.push(itemChild)
|
||||||
idx++
|
_idx++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,10 +66,10 @@ Item {
|
|||||||
for(var k=0;k<footerItems.children.length;k++){
|
for(var k=0;k<footerItems.children.length;k++){
|
||||||
var itemFooter = footerItems.children[k]
|
var itemFooter = footerItems.children[k]
|
||||||
if (comEmpty.status === Component.Ready) {
|
if (comEmpty.status === Component.Ready) {
|
||||||
var objEmpty = comEmpty.createObject(items,{idx:idx});
|
var objEmpty = comEmpty.createObject(items,{_idx:_idx});
|
||||||
itemFooter.idx = idx;
|
itemFooter._idx = _idx;
|
||||||
data.push(objEmpty)
|
data.push(objEmpty)
|
||||||
idx++
|
_idx++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -89,6 +90,14 @@ Item {
|
|||||||
return FluNavigationView.Open
|
return FluNavigationView.Open
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
timer_anim_delay.restart()
|
||||||
|
}
|
||||||
|
Timer{
|
||||||
|
id:timer_anim_delay
|
||||||
|
interval: 200
|
||||||
|
onTriggered: {
|
||||||
|
d.animDisabled = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Connections{
|
Connections{
|
||||||
target: d
|
target: d
|
||||||
@ -117,13 +126,6 @@ Item {
|
|||||||
}
|
}
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
Behavior on height {
|
|
||||||
NumberAnimation{
|
|
||||||
duration: 167
|
|
||||||
easing.type: Easing.BezierSpline
|
|
||||||
easing.bezierCurve: [ 0, 0, 0, 1 ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Component{
|
Component{
|
||||||
@ -136,10 +138,9 @@ Item {
|
|||||||
return 30
|
return 30
|
||||||
}
|
}
|
||||||
Behavior on height {
|
Behavior on height {
|
||||||
|
enabled: FluTheme.enableAnimation && d.animDisabled
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 167
|
duration: 83
|
||||||
easing.type: Easing.BezierSpline
|
|
||||||
easing.bezierCurve: [ 0, 0, 0, 1 ]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
width: layout_list.width
|
width: layout_list.width
|
||||||
@ -204,7 +205,6 @@ Item {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle{
|
Rectangle{
|
||||||
radius: 4
|
radius: 4
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@ -216,7 +216,7 @@ Item {
|
|||||||
visible: {
|
visible: {
|
||||||
for(var i=0;i<model.children.length;i++){
|
for(var i=0;i<model.children.length;i++){
|
||||||
var item = model.children[i]
|
var item = model.children[i]
|
||||||
if(item.idx === nav_list.currentIndex && !model.isExpand){
|
if(item._idx === nav_list.currentIndex && !model.isExpand){
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -226,7 +226,6 @@ Item {
|
|||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluIcon{
|
FluIcon{
|
||||||
id:item_icon_expand
|
id:item_icon_expand
|
||||||
rotation: model.isExpand?0:180
|
rotation: model.isExpand?0:180
|
||||||
@ -244,14 +243,16 @@ Item {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
Behavior on rotation {
|
Behavior on rotation {
|
||||||
|
enabled: FluTheme.enableAnimation && d.animDisabled
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 83
|
duration: 167
|
||||||
|
easing.type: Easing.OutCubic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
color: {
|
color: {
|
||||||
if(FluTheme.dark){
|
if(FluTheme.dark){
|
||||||
if((nav_list.currentIndex === idx)&&type===0){
|
if((nav_list.currentIndex === _idx)&&type===0){
|
||||||
return Qt.rgba(1,1,1,0.06)
|
return Qt.rgba(1,1,1,0.06)
|
||||||
}
|
}
|
||||||
if(item_control.hovered){
|
if(item_control.hovered){
|
||||||
@ -259,7 +260,7 @@ Item {
|
|||||||
}
|
}
|
||||||
return Qt.rgba(0,0,0,0)
|
return Qt.rgba(0,0,0,0)
|
||||||
}else{
|
}else{
|
||||||
if(nav_list.currentIndex === idx&&type===0){
|
if(nav_list.currentIndex === _idx&&type===0){
|
||||||
return Qt.rgba(0,0,0,0.06)
|
return Qt.rgba(0,0,0,0.06)
|
||||||
}
|
}
|
||||||
if(item_control.hovered){
|
if(item_control.hovered){
|
||||||
@ -329,10 +330,9 @@ Item {
|
|||||||
id:com_panel_item
|
id:com_panel_item
|
||||||
Item{
|
Item{
|
||||||
Behavior on height {
|
Behavior on height {
|
||||||
|
enabled: FluTheme.enableAnimation && d.animDisabled
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 167
|
duration: 83
|
||||||
easing.type: Easing.BezierSpline
|
|
||||||
easing.bezierCurve: [ 0, 0, 0, 1 ]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
clip: true
|
clip: true
|
||||||
@ -366,7 +366,7 @@ Item {
|
|||||||
if(model.tapFunc){
|
if(model.tapFunc){
|
||||||
model.tapFunc()
|
model.tapFunc()
|
||||||
}else{
|
}else{
|
||||||
nav_list.currentIndex = idx
|
nav_list.currentIndex = _idx
|
||||||
layout_footer.currentIndex = -1
|
layout_footer.currentIndex = -1
|
||||||
model.tap()
|
model.tap()
|
||||||
if(d.isMinimal || d.isCompact){
|
if(d.isMinimal || d.isCompact){
|
||||||
@ -377,8 +377,8 @@ Item {
|
|||||||
if(model.tapFunc){
|
if(model.tapFunc){
|
||||||
model.tapFunc()
|
model.tapFunc()
|
||||||
}else{
|
}else{
|
||||||
nav_list.currentIndex = nav_list.count-layout_footer.count+idx
|
nav_list.currentIndex = nav_list.count-layout_footer.count+_idx
|
||||||
layout_footer.currentIndex = idx
|
layout_footer.currentIndex = _idx
|
||||||
model.tap()
|
model.tap()
|
||||||
if(d.isMinimal || d.isCompact){
|
if(d.isMinimal || d.isCompact){
|
||||||
d.enableNavigationPanel = false
|
d.enableNavigationPanel = false
|
||||||
@ -392,11 +392,11 @@ Item {
|
|||||||
color: {
|
color: {
|
||||||
if(FluTheme.dark){
|
if(FluTheme.dark){
|
||||||
if(type===0){
|
if(type===0){
|
||||||
if(nav_list.currentIndex === idx){
|
if(nav_list.currentIndex === _idx){
|
||||||
return Qt.rgba(1,1,1,0.06)
|
return Qt.rgba(1,1,1,0.06)
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if(nav_list.currentIndex === (nav_list.count-layout_footer.count+idx)){
|
if(nav_list.currentIndex === (nav_list.count-layout_footer.count+_idx)){
|
||||||
return Qt.rgba(1,1,1,0.06)
|
return Qt.rgba(1,1,1,0.06)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -406,11 +406,11 @@ Item {
|
|||||||
return Qt.rgba(0,0,0,0)
|
return Qt.rgba(0,0,0,0)
|
||||||
}else{
|
}else{
|
||||||
if(type===0){
|
if(type===0){
|
||||||
if(nav_list.currentIndex === idx){
|
if(nav_list.currentIndex === _idx){
|
||||||
return Qt.rgba(0,0,0,0.06)
|
return Qt.rgba(0,0,0,0.06)
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if(nav_list.currentIndex === (nav_list.count-layout_footer.count+idx)){
|
if(nav_list.currentIndex === (nav_list.count-layout_footer.count+_idx)){
|
||||||
return Qt.rgba(0,0,0,0.06)
|
return Qt.rgba(0,0,0,0.06)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -490,7 +490,7 @@ Item {
|
|||||||
}
|
}
|
||||||
Connections{
|
Connections{
|
||||||
target: d
|
target: d
|
||||||
function onIsCompactAndNotPanelChanged(){
|
function onIsCompactAndNotPanelChanged(){
|
||||||
if(item_dot_loader.item){
|
if(item_dot_loader.item){
|
||||||
item_dot_loader.item.isDot = d.isCompactAndNotPanel
|
item_dot_loader.item.isDot = d.isCompactAndNotPanel
|
||||||
}
|
}
|
||||||
@ -520,18 +520,40 @@ Item {
|
|||||||
Layout.preferredWidth: 30
|
Layout.preferredWidth: 30
|
||||||
Layout.preferredHeight: 30
|
Layout.preferredHeight: 30
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
disabled: nav_swipe.depth <= 1
|
disabled: {
|
||||||
|
return d.stackItems.length <= 1
|
||||||
|
}
|
||||||
iconSize: 13
|
iconSize: 13
|
||||||
onClicked: {
|
onClicked: {
|
||||||
nav_swipe.pop()
|
d.stackItems = d.stackItems.slice(0, -1)
|
||||||
d.stackItems.pop()
|
|
||||||
var item = d.stackItems[d.stackItems.length-1]
|
var item = d.stackItems[d.stackItems.length-1]
|
||||||
if(item.idx<(nav_list.count - layout_footer.count)){
|
if(item._idx<(nav_list.count - layout_footer.count)){
|
||||||
layout_footer.currentIndex = -1
|
layout_footer.currentIndex = -1
|
||||||
}else{
|
}else{
|
||||||
layout_footer.currentIndex = item.idx-(nav_list.count-layout_footer.count)
|
layout_footer.currentIndex = item._idx-(nav_list.count-layout_footer.count)
|
||||||
|
}
|
||||||
|
nav_list.currentIndex = item._idx
|
||||||
|
if(pageMode === FluNavigationView.Stack){
|
||||||
|
var nav_stack = loader_content.item.navStack()
|
||||||
|
var nav_stack2 = loader_content.item.navStack2()
|
||||||
|
nav_stack.pop()
|
||||||
|
if(nav_stack.currentItem.launchMode === FluPage.SingleInstance){
|
||||||
|
var url = nav_stack.currentItem.url
|
||||||
|
var pageIndex = -1
|
||||||
|
for(var i=0;i<nav_stack2.children.length;i++){
|
||||||
|
var obj = nav_stack2.children[i]
|
||||||
|
if(obj.url === url){
|
||||||
|
pageIndex = i
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(pageIndex !== -1){
|
||||||
|
nav_stack2.currentIndex = pageIndex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else if(pageMode === FluNavigationView.NoStack){
|
||||||
|
loader_content.setSource(item._ext.url,item._ext.argument)
|
||||||
}
|
}
|
||||||
nav_list.currentIndex = item.idx
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluIconButton{
|
FluIconButton{
|
||||||
@ -548,15 +570,16 @@ Item {
|
|||||||
visible: opacity
|
visible: opacity
|
||||||
opacity: d.isMinimal
|
opacity: d.isMinimal
|
||||||
Behavior on opacity{
|
Behavior on opacity{
|
||||||
|
enabled: FluTheme.enableAnimation && d.animDisabled
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 83
|
duration: 83
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Behavior on Layout.preferredWidth {
|
Behavior on Layout.preferredWidth {
|
||||||
|
enabled: FluTheme.enableAnimation && d.animDisabled
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 167
|
duration: 167
|
||||||
easing.type: Easing.BezierSpline
|
easing.type: Easing.OutCubic
|
||||||
easing.bezierCurve: [ 0, 0, 0, 1 ]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -576,7 +599,7 @@ Item {
|
|||||||
MouseArea{
|
MouseArea{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: {
|
onClicked: {
|
||||||
loginClicked()
|
logoClicked()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -603,7 +626,39 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Item{
|
|
||||||
|
Component{
|
||||||
|
id:com_stack_content
|
||||||
|
Item{
|
||||||
|
StackView{
|
||||||
|
id:nav_stack
|
||||||
|
anchors.fill: parent
|
||||||
|
clip: true
|
||||||
|
visible: !nav_stack2.visible
|
||||||
|
popEnter : Transition{}
|
||||||
|
popExit : Transition {}
|
||||||
|
pushEnter: Transition {}
|
||||||
|
pushExit : Transition{}
|
||||||
|
replaceEnter : Transition{}
|
||||||
|
replaceExit : Transition{}
|
||||||
|
}
|
||||||
|
StackLayout{
|
||||||
|
id:nav_stack2
|
||||||
|
anchors.fill: nav_stack
|
||||||
|
clip: true
|
||||||
|
visible: nav_stack.currentItem?.launchMode === FluPage.SingleInstance
|
||||||
|
}
|
||||||
|
function navStack(){
|
||||||
|
return nav_stack
|
||||||
|
}
|
||||||
|
function navStack2(){
|
||||||
|
return nav_stack2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Loader{
|
||||||
|
id:loader_content
|
||||||
anchors{
|
anchors{
|
||||||
left: parent.left
|
left: parent.left
|
||||||
top: nav_app_bar.bottom
|
top: nav_app_bar.bottom
|
||||||
@ -616,45 +671,17 @@ Item {
|
|||||||
if(d.isCompact){
|
if(d.isCompact){
|
||||||
return 50
|
return 50
|
||||||
}
|
}
|
||||||
return 300
|
return control.navWidth
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Behavior on anchors.leftMargin {
|
Behavior on anchors.leftMargin {
|
||||||
|
enabled: FluTheme.enableAnimation && d.animDisabled
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 167
|
duration: 167
|
||||||
easing.type: Easing.BezierSpline
|
easing.type: Easing.OutCubic
|
||||||
easing.bezierCurve: [ 0, 0, 0, 1 ]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StackView{
|
sourceComponent: com_stack_content
|
||||||
id:nav_swipe
|
|
||||||
anchors.fill: parent
|
|
||||||
clip: true
|
|
||||||
popEnter : Transition{}
|
|
||||||
popExit : Transition {
|
|
||||||
NumberAnimation {
|
|
||||||
properties: "y"
|
|
||||||
from: 0
|
|
||||||
to: nav_swipe.height
|
|
||||||
duration: dontPageAnimation ? 0 : 167
|
|
||||||
easing.type: Easing.BezierSpline
|
|
||||||
easing.bezierCurve: [ 1, 0, 0, 0 ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pushEnter: Transition {
|
|
||||||
NumberAnimation {
|
|
||||||
properties: "y";
|
|
||||||
from: nav_swipe.height;
|
|
||||||
to: 0
|
|
||||||
duration: dontPageAnimation ? 0 : 167
|
|
||||||
easing.type: Easing.BezierSpline
|
|
||||||
easing.bezierCurve: [ 0, 0, 0, 1 ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pushExit : Transition{}
|
|
||||||
replaceEnter : Transition{}
|
|
||||||
replaceExit : Transition{}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
MouseArea{
|
MouseArea{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@ -671,7 +698,7 @@ Item {
|
|||||||
if(d.isCompactAndNotPanel){
|
if(d.isCompactAndNotPanel){
|
||||||
return 50
|
return 50
|
||||||
}
|
}
|
||||||
return 300
|
return control.navWidth
|
||||||
}
|
}
|
||||||
anchors{
|
anchors{
|
||||||
top: parent.top
|
top: parent.top
|
||||||
@ -685,20 +712,19 @@ Item {
|
|||||||
}
|
}
|
||||||
return "transparent"
|
return "transparent"
|
||||||
}
|
}
|
||||||
clip: true
|
|
||||||
x: visible ? 0 : -width
|
x: visible ? 0 : -width
|
||||||
Behavior on width {
|
Behavior on width {
|
||||||
|
enabled: FluTheme.enableAnimation && d.animDisabled
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 167
|
duration: 167
|
||||||
easing.type: Easing.BezierSpline
|
easing.type: Easing.OutCubic
|
||||||
easing.bezierCurve: [ 0, 0, 0, 1 ]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Behavior on x {
|
Behavior on x {
|
||||||
|
enabled: FluTheme.enableAnimation && d.animDisabled
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 167
|
duration: 167
|
||||||
easing.type: Easing.BezierSpline
|
easing.type: Easing.OutCubic
|
||||||
easing.bezierCurve: [ 0, 0, 0, 1 ]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
visible: {
|
visible: {
|
||||||
@ -707,7 +733,7 @@ Item {
|
|||||||
return d.isMinimalAndPanel ? true : false
|
return d.isMinimalAndPanel ? true : false
|
||||||
}
|
}
|
||||||
FluAcrylic {
|
FluAcrylic {
|
||||||
sourceItem:nav_swipe
|
sourceItem:loader_content
|
||||||
anchors.fill: layout_list
|
anchors.fill: layout_list
|
||||||
color: {
|
color: {
|
||||||
if(d.isMinimalAndPanel || d.isCompactAndPanel){
|
if(d.isMinimalAndPanel || d.isCompactAndPanel){
|
||||||
@ -758,27 +784,8 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ListView{
|
Flickable{
|
||||||
id:nav_list
|
id:layout_flickable
|
||||||
clip: true
|
|
||||||
ScrollBar.vertical: FluScrollBar {}
|
|
||||||
model:d.handleItems()
|
|
||||||
highlightMoveDuration: 150
|
|
||||||
highlight: Item{
|
|
||||||
clip: true
|
|
||||||
Rectangle{
|
|
||||||
height: 18
|
|
||||||
radius: 1.5
|
|
||||||
color: FluTheme.primaryColor.dark
|
|
||||||
width: 3
|
|
||||||
anchors{
|
|
||||||
verticalCenter: parent.verticalCenter
|
|
||||||
left: parent.left
|
|
||||||
leftMargin: 6
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
currentIndex: -1
|
|
||||||
anchors{
|
anchors{
|
||||||
top: layout_header.bottom
|
top: layout_header.bottom
|
||||||
topMargin: 6
|
topMargin: 6
|
||||||
@ -786,29 +793,58 @@ Item {
|
|||||||
right: parent.right
|
right: parent.right
|
||||||
bottom: layout_footer.top
|
bottom: layout_footer.top
|
||||||
}
|
}
|
||||||
delegate: Loader{
|
boundsBehavior: ListView.StopAtBounds
|
||||||
property var model: modelData
|
clip: true
|
||||||
property var idx: index
|
contentHeight: nav_list.contentHeight
|
||||||
property int type: 0
|
ScrollBar.vertical: FluScrollBar {}
|
||||||
sourceComponent: {
|
ListView{
|
||||||
if(modelData instanceof FluPaneItem){
|
id:nav_list
|
||||||
return com_panel_item
|
clip: true
|
||||||
|
anchors.fill: parent
|
||||||
|
model:d.handleItems()
|
||||||
|
boundsBehavior: ListView.StopAtBounds
|
||||||
|
highlightMoveDuration: FluTheme.enableAnimation && d.animDisabled ? 167 : 0
|
||||||
|
highlight: Item{
|
||||||
|
clip: true
|
||||||
|
Rectangle{
|
||||||
|
height: 18
|
||||||
|
radius: 1.5
|
||||||
|
color: FluTheme.primaryColor.dark
|
||||||
|
width: 3
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left: parent.left
|
||||||
|
leftMargin: 6
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(modelData instanceof FluPaneItemHeader){
|
}
|
||||||
return com_panel_item_header
|
currentIndex: -1
|
||||||
}
|
|
||||||
if(modelData instanceof FluPaneItemSeparator){
|
delegate: Loader{
|
||||||
return com_panel_item_separatorr
|
property var model: modelData
|
||||||
}
|
property var _idx: index
|
||||||
if(modelData instanceof FluPaneItemExpander){
|
property int type: 0
|
||||||
return com_panel_item_expander
|
sourceComponent: {
|
||||||
}
|
if(modelData instanceof FluPaneItem){
|
||||||
if(modelData instanceof FluPaneItemEmpty){
|
return com_panel_item
|
||||||
return com_panel_item_empty
|
}
|
||||||
|
if(modelData instanceof FluPaneItemHeader){
|
||||||
|
return com_panel_item_header
|
||||||
|
}
|
||||||
|
if(modelData instanceof FluPaneItemSeparator){
|
||||||
|
return com_panel_item_separatorr
|
||||||
|
}
|
||||||
|
if(modelData instanceof FluPaneItemExpander){
|
||||||
|
return com_panel_item_expander
|
||||||
|
}
|
||||||
|
if(modelData instanceof FluPaneItemEmpty){
|
||||||
|
return com_panel_item_empty
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ListView{
|
ListView{
|
||||||
id:layout_footer
|
id:layout_footer
|
||||||
clip: true
|
clip: true
|
||||||
@ -816,6 +852,7 @@ Item {
|
|||||||
height: childrenRect.height
|
height: childrenRect.height
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
interactive: false
|
interactive: false
|
||||||
|
boundsBehavior: ListView.StopAtBounds
|
||||||
currentIndex: -1
|
currentIndex: -1
|
||||||
model: {
|
model: {
|
||||||
if(footerItems){
|
if(footerItems){
|
||||||
@ -839,7 +876,7 @@ Item {
|
|||||||
}
|
}
|
||||||
delegate: Loader{
|
delegate: Loader{
|
||||||
property var model: modelData
|
property var model: modelData
|
||||||
property var idx: index
|
property var _idx: index
|
||||||
property int type: 1
|
property int type: 1
|
||||||
sourceComponent: {
|
sourceComponent: {
|
||||||
if(modelData instanceof FluPaneItem){
|
if(modelData instanceof FluPaneItem){
|
||||||
@ -872,7 +909,7 @@ Item {
|
|||||||
if(!d.isCompact){
|
if(!d.isCompact){
|
||||||
control_popup.close()
|
control_popup.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
padding: 0
|
padding: 0
|
||||||
focus: true
|
focus: true
|
||||||
@ -887,14 +924,21 @@ Item {
|
|||||||
delegate:Button{
|
delegate:Button{
|
||||||
id:item_button
|
id:item_button
|
||||||
width: 180
|
width: 180
|
||||||
padding:10
|
height: 38
|
||||||
focusPolicy:Qt.TabFocus
|
focusPolicy:Qt.TabFocus
|
||||||
background: Rectangle{
|
background: Rectangle{
|
||||||
color: {
|
color: {
|
||||||
if(hovered){
|
if(FluTheme.dark){
|
||||||
return FluTheme.dark ? Qt.rgba(63/255,60/255,61/255,1) : Qt.rgba(237/255,237/255,242/255,1)
|
if(item_button.hovered){
|
||||||
|
return Qt.rgba(1,1,1,0.06)
|
||||||
|
}
|
||||||
|
return Qt.rgba(0,0,0,0)
|
||||||
|
}else{
|
||||||
|
if(item_button.hovered){
|
||||||
|
return Qt.rgba(0,0,0,0.03)
|
||||||
|
}
|
||||||
|
return Qt.rgba(0,0,0,0)
|
||||||
}
|
}
|
||||||
return FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(0,0,0,0)
|
|
||||||
}
|
}
|
||||||
FluFocusRectangle{
|
FluFocusRectangle{
|
||||||
visible: item_button.activeFocus
|
visible: item_button.activeFocus
|
||||||
@ -921,6 +965,7 @@ Item {
|
|||||||
text:modelData.title
|
text:modelData.title
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
rightPadding: item_dot_loader.width
|
rightPadding: item_dot_loader.width
|
||||||
|
verticalAlignment: Qt.AlignVCenter
|
||||||
anchors{
|
anchors{
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
@ -930,7 +975,7 @@ Item {
|
|||||||
modelData.tapFunc()
|
modelData.tapFunc()
|
||||||
}else{
|
}else{
|
||||||
modelData.tap()
|
modelData.tap()
|
||||||
nav_list.currentIndex = idx
|
nav_list.currentIndex = _idx
|
||||||
layout_footer.currentIndex = -1
|
layout_footer.currentIndex = -1
|
||||||
if(d.isMinimal || d.isCompact){
|
if(d.isMinimal || d.isCompact){
|
||||||
d.enableNavigationPanel = false
|
d.enableNavigationPanel = false
|
||||||
@ -949,7 +994,6 @@ Item {
|
|||||||
radius: 4
|
radius: 4
|
||||||
}
|
}
|
||||||
color: FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1)
|
color: FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1)
|
||||||
|
|
||||||
}
|
}
|
||||||
function showPopup(pos,model){
|
function showPopup(pos,model){
|
||||||
control_popup.x = pos.x
|
control_popup.x = pos.x
|
||||||
@ -958,6 +1002,13 @@ Item {
|
|||||||
control_popup.open()
|
control_popup.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Component{
|
||||||
|
id:com_placeholder
|
||||||
|
Item{
|
||||||
|
property int launchMode: FluPage.SingleInstance
|
||||||
|
property string url
|
||||||
|
}
|
||||||
|
}
|
||||||
function collapseAll(){
|
function collapseAll(){
|
||||||
for(var i=0;i<nav_list.model.length;i++){
|
for(var i=0;i<nav_list.model.length;i++){
|
||||||
var item = nav_list.model[i]
|
var item = nav_list.model[i]
|
||||||
@ -976,41 +1027,90 @@ Item {
|
|||||||
function getItems(){
|
function getItems(){
|
||||||
return nav_list.model
|
return nav_list.model
|
||||||
}
|
}
|
||||||
function push(url,argument={}){
|
|
||||||
let page = nav_swipe.find(function(item) {
|
|
||||||
return item.url === url;
|
|
||||||
})
|
|
||||||
if(page){
|
|
||||||
switch(page.pageMode)
|
|
||||||
{
|
|
||||||
case FluNavigationView.SingleTask:
|
|
||||||
while(nav_swipe.currentItem !== page)
|
|
||||||
{
|
|
||||||
nav_swipe.pop()
|
|
||||||
d.stackItems.pop()
|
|
||||||
}
|
|
||||||
return
|
|
||||||
case FluNavigationView.SingleTop:
|
|
||||||
if (nav_swipe.currentItem.url === url){
|
|
||||||
return
|
|
||||||
}
|
|
||||||
break
|
|
||||||
case FluNavigationView.Standard:
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
}
|
|
||||||
nav_swipe.push(url,Object.assign(argument,{url:url}))
|
|
||||||
d.stackItems.push(nav_list.model[nav_list.currentIndex])
|
|
||||||
}
|
|
||||||
function getCurrentIndex(){
|
function getCurrentIndex(){
|
||||||
return nav_list.currentIndex
|
return nav_list.currentIndex
|
||||||
}
|
}
|
||||||
function getCurrentUrl(){
|
function getCurrentUrl(){
|
||||||
if(nav_swipe.currentItem){
|
if(pageMode === FluNavigationView.Stack){
|
||||||
return nav_swipe.currentItem.url
|
var nav_stack = loader_content.item.navStack()
|
||||||
|
if(nav_stack.currentItem){
|
||||||
|
return nav_stack.currentItem.url
|
||||||
|
}
|
||||||
|
}else if(pageMode === FluNavigationView.NoStack){
|
||||||
|
return loader_content.source.toString()
|
||||||
}
|
}
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
function push(url,argument={}){
|
||||||
|
function stackPush(){
|
||||||
|
var nav_stack = loader_content.item.navStack()
|
||||||
|
var nav_stack2 = loader_content.item.navStack2()
|
||||||
|
var page = nav_stack.find(function(item) {
|
||||||
|
return item.url === url;
|
||||||
|
})
|
||||||
|
if(page){
|
||||||
|
switch(page.launchMode)
|
||||||
|
{
|
||||||
|
case FluPage.SingleTask:
|
||||||
|
while(nav_stack.currentItem !== page)
|
||||||
|
{
|
||||||
|
nav_stack.pop()
|
||||||
|
d.stackItems = d.stackItems.slice(0, -1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
case FluPage.SingleTop:
|
||||||
|
if (nav_stack.currentItem.url === url){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case FluPage.Standard:
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var pageIndex = -1
|
||||||
|
for(var i=0;i<nav_stack2.children.length;i++){
|
||||||
|
var item = nav_stack2.children[i]
|
||||||
|
if(item.url === url){
|
||||||
|
pageIndex = i
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var options = Object.assign(argument,{url:url})
|
||||||
|
if(pageIndex!==-1){
|
||||||
|
nav_stack2.currentIndex = pageIndex
|
||||||
|
nav_stack.push(com_placeholder,options)
|
||||||
|
}else{
|
||||||
|
var comp = Qt.createComponent(url)
|
||||||
|
if (comp.status === Component.Ready) {
|
||||||
|
var obj = comp.createObject(nav_stack,options)
|
||||||
|
if(obj.launchMode === FluPage.SingleInstance){
|
||||||
|
nav_stack.push(com_placeholder,options)
|
||||||
|
nav_stack2.children.push(obj)
|
||||||
|
nav_stack2.currentIndex = nav_stack2.count - 1
|
||||||
|
}else{
|
||||||
|
nav_stack.push(obj)
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
console.error(comp.errorString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
d.stackItems = d.stackItems.concat(nav_list.model[nav_list.currentIndex])
|
||||||
|
}
|
||||||
|
function noStackPush(){
|
||||||
|
if(loader_content.source.toString() === url){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
loader_content.setSource(url,argument)
|
||||||
|
var obj = nav_list.model[nav_list.currentIndex]
|
||||||
|
obj._ext = {url:url,argument:argument}
|
||||||
|
d.stackItems = d.stackItems.concat(obj)
|
||||||
|
}
|
||||||
|
if(pageMode === FluNavigationView.Stack){
|
||||||
|
stackPush()
|
||||||
|
}else if(pageMode === FluNavigationView.NoStack){
|
||||||
|
noStackPush()
|
||||||
|
}
|
||||||
|
}
|
||||||
function startPageByItem(data){
|
function startPageByItem(data){
|
||||||
var items = getItems()
|
var items = getItems()
|
||||||
for(var i=0;i<items.length;i++){
|
for(var i=0;i<items.length;i++){
|
||||||
|
@ -3,6 +3,6 @@ import QtQuick.Controls
|
|||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
default property list<QtObject> children;
|
default property list<QtObject> children
|
||||||
id:flu_object;
|
id:control
|
||||||
}
|
}
|
||||||
|
40
src/imports/FluentUI/Controls/FluPage.qml
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Window
|
||||||
|
import FluentUI
|
||||||
|
|
||||||
|
Item {
|
||||||
|
enum LaunchMode{
|
||||||
|
Standard = 0,
|
||||||
|
SingleTask = 1,
|
||||||
|
SingleTop = 2,
|
||||||
|
SingleInstance = 3
|
||||||
|
}
|
||||||
|
property int launchMode: FluPage.SingleTop
|
||||||
|
property bool animDisabled: false
|
||||||
|
property string url : ""
|
||||||
|
id: control
|
||||||
|
opacity: visible
|
||||||
|
visible: false
|
||||||
|
StackView.onRemoved: destroy()
|
||||||
|
Behavior on opacity{
|
||||||
|
enabled: !animDisabled && FluTheme.enableAnimation
|
||||||
|
NumberAnimation{
|
||||||
|
duration: 167
|
||||||
|
}
|
||||||
|
}
|
||||||
|
transform: Translate {
|
||||||
|
y: control.visible ? 0 : 80
|
||||||
|
Behavior on y{
|
||||||
|
enabled: !animDisabled && FluTheme.enableAnimation
|
||||||
|
NumberAnimation{
|
||||||
|
duration: 167
|
||||||
|
easing.type: Easing.OutCubic
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Component.onCompleted: {
|
||||||
|
visible = true
|
||||||
|
}
|
||||||
|
}
|
@ -9,9 +9,9 @@ Item {
|
|||||||
property string nextText: "下一页>"
|
property string nextText: "下一页>"
|
||||||
property int pageCurrent: 0
|
property int pageCurrent: 0
|
||||||
property int itemCount: 0
|
property int itemCount: 0
|
||||||
|
property int pageButtonCount: 5
|
||||||
property int pageCount: itemCount>0?Math.ceil(itemCount/__itemPerPage):0
|
property int pageCount: itemCount>0?Math.ceil(itemCount/__itemPerPage):0
|
||||||
property int __itemPerPage: 10
|
property int __itemPerPage: 10
|
||||||
property int pageButtonCount: 5
|
|
||||||
property int __pageButtonHalf: Math.floor(pageButtonCount/2)+1
|
property int __pageButtonHalf: Math.floor(pageButtonCount/2)+1
|
||||||
id: control
|
id: control
|
||||||
implicitHeight: 40
|
implicitHeight: 40
|
||||||
@ -34,7 +34,6 @@ Item {
|
|||||||
FluToggleButton{
|
FluToggleButton{
|
||||||
property int pageNumber:1
|
property int pageNumber:1
|
||||||
visible: control.pageCount>0
|
visible: control.pageCount>0
|
||||||
enabled: control.pageCurrent>1
|
|
||||||
checked: pageNumber === control.pageCurrent
|
checked: pageNumber === control.pageCurrent
|
||||||
text:String(pageNumber)
|
text:String(pageNumber)
|
||||||
clickListener:function() {
|
clickListener:function() {
|
||||||
|
@ -4,7 +4,8 @@ import FluentUI
|
|||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
readonly property string key : FluTools.uuid()
|
readonly property string key : FluTools.uuid()
|
||||||
readonly property int flag : 0
|
property int _idx
|
||||||
|
property var _ext
|
||||||
property string title
|
property string title
|
||||||
property int order : 0
|
property int order : 0
|
||||||
property int icon
|
property int icon
|
||||||
@ -15,7 +16,6 @@ QtObject {
|
|||||||
property string desc
|
property string desc
|
||||||
property var image
|
property var image
|
||||||
property var parent
|
property var parent
|
||||||
property int idx
|
|
||||||
property int count: 0
|
property int count: 0
|
||||||
signal tap
|
signal tap
|
||||||
property var tapFunc
|
property var tapFunc
|
||||||
|