Compare commits
86 Commits
Author | SHA1 | Date | |
---|---|---|---|
9f9d9da601 | |||
6d24cbf37c | |||
d2929ad701 | |||
689843fbef | |||
c6db001b74 | |||
3ec0841b44 | |||
b3d1568de4 | |||
2511c5dba8 | |||
3049be128f | |||
3291b3a882 | |||
d5744a39bd | |||
882606b2f6 | |||
aba33c4d1f | |||
51aef3f3ec | |||
221afeea58 | |||
c19f5d4c48 | |||
d2eb72cc5b | |||
420a9b2bbb | |||
59dacd8fae | |||
7489a4bcbe | |||
6dd859dd1d | |||
98363542d3 | |||
5b836a4d82 | |||
7dcb65f7b6 | |||
60c2ebee56 | |||
88fed82260 | |||
cb94db8a97 | |||
88008e16be | |||
f2db544be0 | |||
6db8c4d4ac | |||
4ab78bbaba | |||
11b2b04cb9 | |||
9f2e066a9f | |||
5b8312dcb9 | |||
b28f15c23b | |||
935f515a49 | |||
70585c007e | |||
bdde046a4d | |||
ad420366f1 | |||
727a0220b4 | |||
ab0fcf5d9c | |||
f43bfec992 | |||
6bf38b5e5e | |||
73ff2b45b9 | |||
7303e7d900 | |||
5ca1b715f3 | |||
cd984fddf5 | |||
2acb3c34bd | |||
1df3b4ba96 | |||
5ea3cb1054 | |||
5afd2ec518 | |||
59527fc954 | |||
c26fdfaee3 | |||
878dbd668b | |||
b10a0752fb | |||
51e73e7f8e | |||
3a46fd11c6 | |||
70f048f629 | |||
1f2d0d9b9f | |||
09e87e0fb8 | |||
0603a7603d | |||
d9a4f01e20 | |||
93709cd1dd | |||
0000e557a7 | |||
d2183e350e | |||
47caf4bb52 | |||
6fb9ee41fb | |||
b349c22434 | |||
12fa3487bb | |||
a76806645a | |||
738db25c2c | |||
9f8a5f5646 | |||
c59c07e756 | |||
2084b5afa3 | |||
f8d717f41b | |||
be58fc5e7d | |||
1c0bc7208a | |||
d89aaec062 | |||
13abd275b4 | |||
e8460c2409 | |||
6de1b9d78f | |||
64fa2b6370 | |||
8970a0c09a | |||
e7cea72825 | |||
93186edfbe | |||
e60883bc60 |
2
.github/workflows/ubuntu.yml
vendored
@ -38,7 +38,7 @@ jobs:
|
|||||||
arch: ${{ matrix.qt_arch }}
|
arch: ${{ matrix.qt_arch }}
|
||||||
modules: 'qt5compat qtmultimedia qtshadertools qtimageformats'
|
modules: 'qt5compat qtmultimedia qtshadertools qtimageformats'
|
||||||
- name: ubuntu install GL library
|
- name: ubuntu install GL library
|
||||||
run: sudo apt-get install -y libglew-dev libglfw3-dev qml-module-qtquick-controls qml-module-qtquick-controls2
|
run: sudo apt-get install -y libxkbcommon-x11-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-randr0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxcb-xinerama0-dev libxcb-sync-dev libxcb-render-util0-dev libxcb-shm0-dev
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
|
2
.github/workflows/windows-mingw.yml
vendored
@ -71,6 +71,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
file: ${{ steps.package.outputs.packageName }}.zip
|
file: ${{ steps.package.outputs.packageName }}.zip
|
||||||
asset_name: ${{ env.fileName }}_${{ github.ref_name }}_${{ matrix.os }}_Qt${{ matrix.qt_ver }}.zip
|
asset_name: ${{ env.fileName }}_${{ github.ref_name }}_${{ matrix.qt_arch }}_Qt${{ matrix.qt_ver }}.zip
|
||||||
tag: ${{ github.ref }}
|
tag: ${{ github.ref }}
|
||||||
overwrite: true
|
overwrite: true
|
2
.github/workflows/windows.yml
vendored
@ -87,6 +87,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
file: ${{ steps.package.outputs.packageName }}.zip
|
file: ${{ steps.package.outputs.packageName }}.zip
|
||||||
asset_name: ${{ env.fileName }}_${{ github.ref_name }}_${{ matrix.os }}_Qt${{ matrix.qt_ver }}.zip
|
asset_name: ${{ env.fileName }}_${{ github.ref_name }}_${{ matrix.qt_arch }}_Qt${{ matrix.qt_ver }}.zip
|
||||||
tag: ${{ github.ref }}
|
tag: ${{ github.ref }}
|
||||||
overwrite: true
|
overwrite: true
|
20
README.md
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## 简介
|
## 简介
|
||||||
|
|
||||||
这是一个漂亮的Fluent组件库,使用QML插件开发的
|
这是一个漂亮的Fluent组件库,使用QML插件开发的。main分支是Qt6.4.3,如果需要qt5的请切换至qt5分支
|
||||||
|
|
||||||
## 编译状态
|
## 编译状态
|
||||||
| [Windows][win-link]| [Ubuntu][ubuntu-link]|[MacOS][macos-link]|
|
| [Windows][win-link]| [Ubuntu][ubuntu-link]|[MacOS][macos-link]|
|
||||||
@ -62,6 +62,12 @@
|
|||||||
|FluDatePicker|日期选择器||
|
|FluDatePicker|日期选择器||
|
||||||
|FluMenu|菜单Popup||
|
|FluMenu|菜单Popup||
|
||||||
|FluNavigationView|响应式导航布局||
|
|FluNavigationView|响应式导航布局||
|
||||||
|
|FluScrollbar|滚动条||
|
||||||
|
|FluToggleButton|开关按钮||
|
||||||
|
|FluPagination|分页组件||
|
||||||
|
|FluTableView|表格组件||
|
||||||
|
|FluMediaPlayer|播放器||
|
||||||
|
|FluFlipView|FlipView||
|
||||||
|
|
||||||
# 部分效果预览
|
# 部分效果预览
|
||||||
|
|
||||||
@ -77,6 +83,10 @@
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
## TableView表格组件
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
## FluTreeView树组件
|
## FluTreeView树组件
|
||||||
|
|
||||||

|

|
||||||
@ -85,13 +95,5 @@
|
|||||||
|
|
||||||

|

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

|
|
||||||
|
|
||||||
## 多窗口路由跳转
|
|
||||||
|
|
||||||

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

|

|
Before Width: | Height: | Size: 103 KiB After Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 383 KiB After Width: | Height: | Size: 204 KiB |
Before Width: | Height: | Size: 382 KiB |
Before Width: | Height: | Size: 204 KiB After Width: | Height: | Size: 218 KiB |
Before Width: | Height: | Size: 89 KiB |
Before Width: | Height: | Size: 103 KiB |
BIN
doc/preview/tableview.png
Normal file
After Width: | Height: | Size: 71 KiB |
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 101 KiB After Width: | Height: | Size: 49 KiB |
@ -2,27 +2,25 @@
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtMultimedia
|
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
Window {
|
Window {
|
||||||
id:app
|
id:app
|
||||||
color: "#00000000"
|
|
||||||
//初始化一个MediaPlayer,解决macos切换到T_MediaPalyer页面崩溃问题
|
|
||||||
MediaPlayer{}
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
FluApp.init(app,properties)
|
FluApp.init(app)
|
||||||
FluTheme.frameless = ("windows" === Qt.platform.os)
|
FluTheme.frameless = ("windows" === Qt.platform.os)
|
||||||
FluTheme.dark = false
|
FluTheme.darkMode = FluDarkMode.System
|
||||||
FluApp.routes = {
|
FluApp.routes = {
|
||||||
"/":"qrc:/page/MainPage.qml",
|
"/":"qrc:/page/MainPage.qml",
|
||||||
"/about":"qrc:/page/AboutPage.qml",
|
"/about":"qrc:/page/AboutPage.qml",
|
||||||
"/login":"qrc:/page/LoginPage.qml",
|
"/login":"qrc:/page/LoginPage.qml",
|
||||||
"/chat":"qrc:/page/ChatPage.qml",
|
"/chat":"qrc:/page/ChatPage.qml",
|
||||||
"/media":"qrc:/page/MediaPage.qml",
|
"/media":"qrc:/page/MediaPage.qml",
|
||||||
|
"/singleTaskWindow":"qrc:/page/SingleTaskWindow.qml",
|
||||||
|
"/standardWindow":"qrc:/page/StandardWindow.qml",
|
||||||
|
"/singleInstanceWindow":"qrc:/page/SingleInstanceWindow.qml"
|
||||||
}
|
}
|
||||||
FluApp.initialRoute = "/"
|
FluApp.initialRoute = "/"
|
||||||
FluApp.run()
|
FluApp.run()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
25
example/AppInfo.cpp
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#include "AppInfo.h"
|
||||||
|
#include "lang/En.h"
|
||||||
|
#include "lang/Zh.h"
|
||||||
|
|
||||||
|
|
||||||
|
AppInfo::AppInfo(QObject *parent)
|
||||||
|
: QObject{parent}
|
||||||
|
{
|
||||||
|
version("1.2.6");
|
||||||
|
lang(new En());
|
||||||
|
}
|
||||||
|
|
||||||
|
void AppInfo::changeLang(const QString& locale){
|
||||||
|
if(_lang){
|
||||||
|
_lang->deleteLater();
|
||||||
|
}
|
||||||
|
if(locale=="Zh"){
|
||||||
|
lang(new Zh());
|
||||||
|
}else if(locale=="En"){
|
||||||
|
lang(new En());
|
||||||
|
}else {
|
||||||
|
lang(new En());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
18
example/AppInfo.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#ifndef APPINFO_H
|
||||||
|
#define APPINFO_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include "lang/Lang.h"
|
||||||
|
#include "stdafx.h"
|
||||||
|
|
||||||
|
class AppInfo : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PROPERTY_AUTO(QString,version)
|
||||||
|
Q_PROPERTY_AUTO(Lang*,lang)
|
||||||
|
public:
|
||||||
|
explicit AppInfo(QObject *parent = nullptr);
|
||||||
|
Q_INVOKABLE void changeLang(const QString& locale);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // APPINFO_H
|
@ -7,6 +7,8 @@ set(CMAKE_AUTOUIC ON)
|
|||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
|
file(TO_CMAKE_PATH "/" PATH_SEPARATOR)
|
||||||
|
|
||||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
set(platform 64)
|
set(platform 64)
|
||||||
else()
|
else()
|
||||||
@ -23,11 +25,13 @@ find_package(Qt6 COMPONENTS Core Quick QuickControls2 Concurrent Network Multime
|
|||||||
|
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
ChatController.cpp
|
ChatController.cpp
|
||||||
|
AppInfo.cpp
|
||||||
main.cpp
|
main.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(HEADERS
|
set(HEADERS
|
||||||
ChatController.h
|
ChatController.h
|
||||||
|
AppInfo.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(RESOURCES
|
set(RESOURCES
|
||||||
@ -43,22 +47,19 @@ qt_add_resources(QT_RESOURCES ${RESOURCES})
|
|||||||
add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS} ${QT_RESOURCES} ${RC_ICONS})
|
add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS} ${QT_RESOURCES} ${RC_ICONS})
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
if(platform EQUAL 32)
|
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
|
||||||
file(GLOB DLL_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../third/Win_x86/*.dll)
|
set(DLLPATH ${CMAKE_CURRENT_SOURCE_DIR}/../third/msvc/*.dll)
|
||||||
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy
|
|
||||||
${DLL_FILES}
|
|
||||||
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
|
|
||||||
)
|
|
||||||
else()
|
else()
|
||||||
file(GLOB DLL_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../third/Win_x64/*.dll)
|
set(DLLPATH ${CMAKE_CURRENT_SOURCE_DIR}/../third/mingw/*.dll)
|
||||||
|
endif()
|
||||||
|
string(REPLACE "/" ${PATH_SEPARATOR} DLLPATH "${DLLPATH}")
|
||||||
|
file(GLOB DLL_FILES ${DLLPATH})
|
||||||
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy
|
COMMAND ${CMAKE_COMMAND} -E copy
|
||||||
${DLL_FILES}
|
${DLL_FILES}
|
||||||
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
|
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
|
||||||
|
|
||||||
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
||||||
QT_DEPRECATED_WARNINGS
|
QT_DEPRECATED_WARNINGS
|
||||||
|
@ -3,6 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import "./component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
@ -11,6 +12,7 @@ FluScrollablePage{
|
|||||||
leftPadding:10
|
leftPadding:10
|
||||||
rightPadding:10
|
rightPadding:10
|
||||||
bottomPadding:20
|
bottomPadding:20
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -99,5 +101,20 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'Rectangle{
|
||||||
|
width: 40
|
||||||
|
height: 40
|
||||||
|
radius: 8
|
||||||
|
color: Qt.rgba(191/255,191/255,191/255,1)
|
||||||
|
FluBadge{
|
||||||
|
count: 100
|
||||||
|
isDot: false
|
||||||
|
color: Qt.rgba(82/255,196/255,26/255,1)
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,16 +2,17 @@
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Controls.Basic
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import "./component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
title:"Buttons"
|
title:"Buttons"
|
||||||
|
|
||||||
spacing: 20
|
|
||||||
|
|
||||||
leftPadding:10
|
leftPadding:10
|
||||||
rightPadding:10
|
rightPadding:10
|
||||||
bottomPadding:20
|
bottomPadding:20
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
@ -22,6 +23,7 @@ FluScrollablePage{
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
height: 68
|
height: 68
|
||||||
paddings: 10
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
|
|
||||||
FluTextButton{
|
FluTextButton{
|
||||||
disabled:text_button_switch.selected
|
disabled:text_button_switch.selected
|
||||||
@ -48,11 +50,22 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluTextButton{
|
||||||
|
text:"Text Button"
|
||||||
|
onClicked: {
|
||||||
|
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
height: 68
|
height: 68
|
||||||
paddings: 10
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
|
|
||||||
FluButton{
|
FluButton{
|
||||||
disabled:button_switch.selected
|
disabled:button_switch.selected
|
||||||
@ -79,10 +92,21 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluButton{
|
||||||
|
text:"Standard Button"
|
||||||
|
onClicked: {
|
||||||
|
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
height: 68
|
height: 68
|
||||||
|
Layout.topMargin: 20
|
||||||
paddings: 10
|
paddings: 10
|
||||||
|
|
||||||
FluFilledButton{
|
FluFilledButton{
|
||||||
@ -110,13 +134,65 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluFilledButton{
|
||||||
|
text:"Filled Button"
|
||||||
|
onClicked: {
|
||||||
|
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 68
|
||||||
|
Layout.topMargin: 20
|
||||||
|
paddings: 10
|
||||||
|
|
||||||
|
FluToggleButton{
|
||||||
|
disabled:toggle_button_switch.selected
|
||||||
|
text:"Toggle Button"
|
||||||
|
onClicked: {
|
||||||
|
selected = !selected
|
||||||
|
}
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row{
|
||||||
|
spacing: 5
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
|
FluToggleSwitch{
|
||||||
|
id:toggle_button_switch
|
||||||
|
Layout.alignment: Qt.AlignRight
|
||||||
|
text:"Disabled"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluToggleButton{
|
||||||
|
text:"Toggle Button"
|
||||||
|
onClicked: {
|
||||||
|
selected = !selected
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
height: 68
|
height: 68
|
||||||
paddings: 10
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
FluIconButton{
|
FluIconButton{
|
||||||
iconSource:FluentIcons.ChromeCloseContrast
|
iconSource:FluentIcons.ChromeCloseContrast
|
||||||
disabled:icon_button_switch.selected
|
disabled:icon_button_switch.selected
|
||||||
@ -143,12 +219,22 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluIconButton{
|
||||||
|
iconSource:FluentIcons.ChromeCloseContrast
|
||||||
|
onClicked: {
|
||||||
|
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
height: 68
|
height: 68
|
||||||
paddings: 10
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
FluDropDownButton{
|
FluDropDownButton{
|
||||||
disabled:drop_down_button_switch.selected
|
disabled:drop_down_button_switch.selected
|
||||||
text:"DropDownButton"
|
text:"DropDownButton"
|
||||||
@ -184,12 +270,33 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluDropDownButton{
|
||||||
|
text:"DropDownButton"
|
||||||
|
items:[
|
||||||
|
FluMenuItem{
|
||||||
|
text:"Menu_1"
|
||||||
|
},
|
||||||
|
FluMenuItem{
|
||||||
|
text:"Menu_2"
|
||||||
|
},
|
||||||
|
FluMenuItem{
|
||||||
|
text:"Menu_3"
|
||||||
|
},
|
||||||
|
FluMenuItem{
|
||||||
|
text:"Menu_4"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
height: 100
|
height: 100
|
||||||
paddings: 10
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
ColumnLayout{
|
ColumnLayout{
|
||||||
spacing: 8
|
spacing: 8
|
||||||
anchors{
|
anchors{
|
||||||
@ -225,13 +332,24 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluRadioButton{
|
||||||
|
selected:true
|
||||||
|
text:"Text Button"
|
||||||
|
onClicked: {
|
||||||
|
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
height: 68
|
height: 68
|
||||||
paddings: 10
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
FluCheckBox{
|
FluCheckBox{
|
||||||
disabled:check_box_switch.selected
|
disabled:check_box_switch.selected
|
||||||
text:"Check Box"
|
text:"Check Box"
|
||||||
@ -240,8 +358,6 @@ FluScrollablePage{
|
|||||||
left: parent.left
|
left: parent.left
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Row{
|
Row{
|
||||||
spacing: 5
|
spacing: 5
|
||||||
anchors{
|
anchors{
|
||||||
@ -255,4 +371,11 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluCheckBox{
|
||||||
|
text:"Check Box"
|
||||||
|
}'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import "./component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
@ -10,6 +11,7 @@ FluScrollablePage{
|
|||||||
leftPadding:10
|
leftPadding:10
|
||||||
rightPadding:10
|
rightPadding:10
|
||||||
bottomPadding:20
|
bottomPadding:20
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -19,6 +21,13 @@ FluScrollablePage{
|
|||||||
FluCalendarView{
|
FluCalendarView{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluCalendarView{
|
||||||
|
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -34,5 +43,12 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluCalendarPicker{
|
||||||
|
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import "./component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
@ -10,6 +11,7 @@ FluScrollablePage{
|
|||||||
leftPadding:10
|
leftPadding:10
|
||||||
rightPadding:10
|
rightPadding:10
|
||||||
bottomPadding:20
|
bottomPadding:20
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -35,4 +37,15 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluCarousel{
|
||||||
|
width: 400
|
||||||
|
height: 300
|
||||||
|
Component.onCompleted: {
|
||||||
|
setData([{url:"qrc:/res/image/banner_1.jpg"},{url:"qrc:/res/image/banner_2.jpg"},{url:"qrc:/res/image/banner_3.jpg"}])
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import "./component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
@ -10,14 +11,29 @@ FluScrollablePage{
|
|||||||
leftPadding:10
|
leftPadding:10
|
||||||
rightPadding:10
|
rightPadding:10
|
||||||
bottomPadding:20
|
bottomPadding:20
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
FluCheckBox{
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 68
|
||||||
|
paddings: 10
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
|
Row{
|
||||||
|
spacing: 30
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
FluCheckBox{
|
||||||
}
|
}
|
||||||
|
|
||||||
FluCheckBox{
|
FluCheckBox{
|
||||||
Layout.topMargin: 20
|
|
||||||
text:"Text"
|
text:"Text"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluCheckBox{
|
||||||
|
text:"Text"
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import "./component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
@ -10,6 +11,7 @@ FluScrollablePage{
|
|||||||
leftPadding:10
|
leftPadding:10
|
||||||
rightPadding:10
|
rightPadding:10
|
||||||
bottomPadding:20
|
bottomPadding:20
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -37,6 +39,13 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluColorView{
|
||||||
|
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -54,6 +63,13 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluColorPicker{
|
||||||
|
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import "./component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
@ -10,44 +11,43 @@ FluScrollablePage{
|
|||||||
leftPadding:10
|
leftPadding:10
|
||||||
rightPadding:10
|
rightPadding:10
|
||||||
bottomPadding:20
|
bottomPadding:20
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
height: 80
|
height: 80
|
||||||
paddings: 10
|
paddings: 10
|
||||||
|
|
||||||
ColumnLayout{
|
ColumnLayout{
|
||||||
|
|
||||||
anchors{
|
anchors{
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
left: parent.left
|
left: parent.left
|
||||||
}
|
}
|
||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
text:"showYear=true"
|
text:"showYear=true"
|
||||||
}
|
}
|
||||||
|
|
||||||
FluDatePicker{
|
FluDatePicker{
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluDatePicker{
|
||||||
|
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
height: 80
|
height: 80
|
||||||
paddings: 10
|
paddings: 10
|
||||||
|
|
||||||
ColumnLayout{
|
ColumnLayout{
|
||||||
|
|
||||||
anchors{
|
anchors{
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
left: parent.left
|
left: parent.left
|
||||||
}
|
}
|
||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
text:"showYear=false"
|
text:"showYear=false"
|
||||||
}
|
}
|
||||||
@ -56,8 +56,14 @@ FluScrollablePage{
|
|||||||
showYear:false
|
showYear:false
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluDatePicker{
|
||||||
|
showYear:false
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import "./component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
@ -10,12 +11,48 @@ FluScrollablePage{
|
|||||||
leftPadding:10
|
leftPadding:10
|
||||||
rightPadding:10
|
rightPadding:10
|
||||||
bottomPadding:20
|
bottomPadding:20
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
FluContentDialog{
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 68
|
||||||
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
|
FluButton{
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
Layout.topMargin: 20
|
||||||
|
text:"Show Double Button Dialog"
|
||||||
|
onClicked: {
|
||||||
|
double_btn_dialog.open()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluContentDialog{
|
||||||
id:dialog
|
id:dialog
|
||||||
title:"友情提示"
|
title:"友情提示"
|
||||||
message:"确定要退出程序么?"
|
message:"确定要退出程序么?"
|
||||||
negativeText:"取消"
|
negativeText:"取消"
|
||||||
|
buttonFlags: FluContentDialog.NegativeButton | FluContentDialog.PositiveButton
|
||||||
|
onNegativeClicked:{
|
||||||
|
showSuccess("点击取消按钮")
|
||||||
|
}
|
||||||
|
positiveText:"确定"
|
||||||
|
onPositiveClicked:{
|
||||||
|
showSuccess("点击确定按钮")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dialog.open()'
|
||||||
|
}
|
||||||
|
|
||||||
|
FluContentDialog{
|
||||||
|
id:double_btn_dialog
|
||||||
|
title:"友情提示"
|
||||||
|
message:"确定要退出程序么?"
|
||||||
|
buttonFlags: FluContentDialog.NegativeButton | FluContentDialog.PositiveButton
|
||||||
|
negativeText:"取消"
|
||||||
onNegativeClicked:{
|
onNegativeClicked:{
|
||||||
showSuccess("点击取消按钮")
|
showSuccess("点击取消按钮")
|
||||||
}
|
}
|
||||||
@ -25,11 +62,61 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluButton{
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 68
|
||||||
|
paddings: 10
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
text:"Show Dialog"
|
FluButton{
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
Layout.topMargin: 20
|
||||||
|
text:"Show Triple Button Dialog"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
dialog.open()
|
triple_btn_dialog.open()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluContentDialog{
|
||||||
|
id:dialog
|
||||||
|
title:"友情提示"
|
||||||
|
message:"确定要退出程序么?"
|
||||||
|
negativeText:"取消"
|
||||||
|
buttonFlags: FluContentDialog.NeutralButton | FluContentDialog.NegativeButton | FluContentDialog.PositiveButton
|
||||||
|
negativeText:"取消"
|
||||||
|
onNegativeClicked:{
|
||||||
|
showSuccess("点击取消按钮")
|
||||||
|
}
|
||||||
|
positiveText:"确定"
|
||||||
|
onPositiveClicked:{
|
||||||
|
showSuccess("点击确定按钮")
|
||||||
|
}
|
||||||
|
neutralText:"最小化"
|
||||||
|
onNeutralClicked:{
|
||||||
|
showSuccess("点击最小化按钮")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dialog.open()'
|
||||||
|
}
|
||||||
|
|
||||||
|
FluContentDialog{
|
||||||
|
id:triple_btn_dialog
|
||||||
|
title:"友情提示"
|
||||||
|
message:"确定要退出程序么?"
|
||||||
|
buttonFlags: FluContentDialog.NeutralButton | FluContentDialog.NegativeButton | FluContentDialog.PositiveButton
|
||||||
|
negativeText:"取消"
|
||||||
|
onNegativeClicked:{
|
||||||
|
showSuccess("点击取消按钮")
|
||||||
|
}
|
||||||
|
positiveText:"确定"
|
||||||
|
onPositiveClicked:{
|
||||||
|
showSuccess("点击确定按钮")
|
||||||
|
}
|
||||||
|
neutralText:"最小化"
|
||||||
|
onNeutralClicked:{
|
||||||
|
showSuccess("点击最小化按钮")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import "./component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
@ -10,6 +11,20 @@ FluScrollablePage{
|
|||||||
leftPadding:10
|
leftPadding:10
|
||||||
rightPadding:10
|
rightPadding:10
|
||||||
bottomPadding:20
|
bottomPadding:20
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: layout_column.height+20
|
||||||
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
|
Column{
|
||||||
|
id:layout_column
|
||||||
|
spacing: 15
|
||||||
|
anchors{
|
||||||
|
top:parent.top
|
||||||
|
left:parent.left
|
||||||
|
}
|
||||||
|
|
||||||
FluExpander{
|
FluExpander{
|
||||||
headerText:"打开一个单选框"
|
headerText:"打开一个单选框"
|
||||||
@ -63,3 +78,32 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluExpander{
|
||||||
|
headerText:"打开一个单选框"
|
||||||
|
Item{
|
||||||
|
anchors.fill: parent
|
||||||
|
Flickable{
|
||||||
|
width: parent.width
|
||||||
|
height: parent.height
|
||||||
|
contentWidth: width
|
||||||
|
contentHeight: text_info.height
|
||||||
|
ScrollBar.vertical: FluScrollBar {}
|
||||||
|
FluText{
|
||||||
|
id:text_info
|
||||||
|
width: scrollview.width
|
||||||
|
wrapMode: Text.WrapAnywhere
|
||||||
|
padding: 14
|
||||||
|
text:"先帝创业未半而中道崩殂,今天下三分......""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -3,6 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import "./component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
@ -10,7 +11,7 @@ FluScrollablePage{
|
|||||||
leftPadding:10
|
leftPadding:10
|
||||||
rightPadding:10
|
rightPadding:10
|
||||||
bottomPadding:20
|
bottomPadding:20
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -26,7 +27,6 @@ FluScrollablePage{
|
|||||||
Image{
|
Image{
|
||||||
source: "qrc:/res/image/banner_1.jpg"
|
source: "qrc:/res/image/banner_1.jpg"
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
sourceSize: Qt.size(400,300)
|
|
||||||
fillMode:Image.PreserveAspectCrop
|
fillMode:Image.PreserveAspectCrop
|
||||||
}
|
}
|
||||||
Image{
|
Image{
|
||||||
@ -42,6 +42,28 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluFlipView{
|
||||||
|
Image{
|
||||||
|
source: "qrc:/res/image/banner_1.jpg"
|
||||||
|
asynchronous: true
|
||||||
|
fillMode:Image.PreserveAspectCrop
|
||||||
|
}
|
||||||
|
Image{
|
||||||
|
source: "qrc:/res/image/banner_1.jpg"
|
||||||
|
asynchronous: true
|
||||||
|
fillMode:Image.PreserveAspectCrop
|
||||||
|
}
|
||||||
|
Image{
|
||||||
|
source: "qrc:/res/image/banner_1.jpg"
|
||||||
|
asynchronous: true
|
||||||
|
fillMode:Image.PreserveAspectCrop
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'
|
||||||
|
}
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -74,5 +96,27 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluFlipView{
|
||||||
|
vertical:true
|
||||||
|
Image{
|
||||||
|
source: "qrc:/res/image/banner_1.jpg"
|
||||||
|
asynchronous: true
|
||||||
|
fillMode:Image.PreserveAspectCrop
|
||||||
|
}
|
||||||
|
Image{
|
||||||
|
source: "qrc:/res/image/banner_1.jpg"
|
||||||
|
asynchronous: true
|
||||||
|
fillMode:Image.PreserveAspectCrop
|
||||||
|
}
|
||||||
|
Image{
|
||||||
|
source: "qrc:/res/image/banner_1.jpg"
|
||||||
|
asynchronous: true
|
||||||
|
fillMode:Image.PreserveAspectCrop
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import "./component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
@ -10,33 +11,54 @@ FluScrollablePage{
|
|||||||
leftPadding:10
|
leftPadding:10
|
||||||
rightPadding:10
|
rightPadding:10
|
||||||
bottomPadding:20
|
bottomPadding:20
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: 20
|
||||||
|
height: 200
|
||||||
|
paddings: 10
|
||||||
|
ColumnLayout{
|
||||||
|
spacing: 14
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
FluButton{
|
FluButton{
|
||||||
text:"Info"
|
text:"Info"
|
||||||
Layout.topMargin: 20
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
showInfo("这是一个Info样式的InfoBar")
|
showInfo("这是一个Info样式的InfoBar")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluButton{
|
FluButton{
|
||||||
text:"Warning"
|
text:"Warning"
|
||||||
Layout.topMargin: 20
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
showWarning("这是一个Warning样式的InfoBar")
|
showWarning("这是一个Warning样式的InfoBar")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluButton{
|
FluButton{
|
||||||
text:"Error"
|
text:"Error"
|
||||||
Layout.topMargin: 20
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
showError("这是一个Error样式的InfoBar")
|
showError("这是一个Error样式的InfoBar")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluButton{
|
FluButton{
|
||||||
text:"Success"
|
text:"Success"
|
||||||
Layout.topMargin: 20
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
showSuccess("这是一个Success样式的InfoBar这是一个Success样式的InfoBar")
|
showSuccess("这是一个Success样式的InfoBar这是一个Success样式的InfoBar")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'showInfo("这是一个Info样式的InfoBar")
|
||||||
|
|
||||||
|
showWarning("这是一个Warning样式的InfoBar")
|
||||||
|
|
||||||
|
showError("这是一个Error样式的InfoBar")
|
||||||
|
|
||||||
|
showSuccess("这是一个Success样式的InfoBar这是一个Success样式的InfoBar")'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -3,6 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import "./component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
@ -10,6 +11,7 @@ FluScrollablePage{
|
|||||||
leftPadding:10
|
leftPadding:10
|
||||||
rightPadding:10
|
rightPadding:10
|
||||||
bottomPadding:20
|
bottomPadding:20
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
if(visible){
|
if(visible){
|
||||||
@ -18,7 +20,6 @@ FluScrollablePage{
|
|||||||
player.pause()
|
player.pause()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
height: 320
|
height: 320
|
||||||
@ -35,13 +36,20 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluMediaPlayer{
|
||||||
|
id:player
|
||||||
|
source:"http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"
|
||||||
|
}
|
||||||
|
'
|
||||||
|
}
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
height: 68
|
height: 68
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
paddings: 10
|
paddings: 10
|
||||||
|
|
||||||
FluButton{
|
FluButton{
|
||||||
text:"跳转到视频播放器窗口"
|
text:"跳转到视频播放器窗口"
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
@ -49,8 +57,10 @@ FluScrollablePage{
|
|||||||
FluApp.navigate("/media",{source:"http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"})
|
FluApp.navigate("/media",{source:"http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import "./component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
@ -10,6 +11,20 @@ FluScrollablePage{
|
|||||||
leftPadding:10
|
leftPadding:10
|
||||||
rightPadding:10
|
rightPadding:10
|
||||||
bottomPadding:20
|
bottomPadding:20
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 100
|
||||||
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
|
Column{
|
||||||
|
id:layout_column
|
||||||
|
spacing: 15
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left:parent.left
|
||||||
|
}
|
||||||
|
|
||||||
FluButton{
|
FluButton{
|
||||||
text:"左击菜单"
|
text:"左击菜单"
|
||||||
@ -19,7 +34,6 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FluButton{
|
FluButton{
|
||||||
text:"右击菜单"
|
text:"右击菜单"
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
@ -34,6 +48,30 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluMenu{
|
||||||
|
id:menu
|
||||||
|
FluMenuItem:{
|
||||||
|
text:"删除"
|
||||||
|
onClicked: {
|
||||||
|
showError("删除")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluMenuItem:{
|
||||||
|
text:"修改"
|
||||||
|
onClicked: {
|
||||||
|
showInfo"修改")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
menu.popup()
|
||||||
|
'
|
||||||
|
}
|
||||||
|
|
||||||
FluMenu{
|
FluMenu{
|
||||||
id:menu
|
id:menu
|
||||||
@ -46,7 +84,7 @@ FluScrollablePage{
|
|||||||
FluMenuItem{
|
FluMenuItem{
|
||||||
text:"修改"
|
text:"修改"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
showError("修改")
|
showInfo("修改")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,17 +3,18 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import "./component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
|
property string password: ""
|
||||||
|
property var loginPageRegister: registerForPageResult("/login")
|
||||||
|
|
||||||
title:"MultiWindow"
|
title:"MultiWindow"
|
||||||
leftPadding:10
|
leftPadding:10
|
||||||
rightPadding:10
|
rightPadding:10
|
||||||
bottomPadding:20
|
bottomPadding:20
|
||||||
|
spacing: 0
|
||||||
property string password: ""
|
|
||||||
|
|
||||||
property var loginPageRegister: registerForPageResult("/login")
|
|
||||||
|
|
||||||
Connections{
|
Connections{
|
||||||
target: loginPageRegister
|
target: loginPageRegister
|
||||||
@ -23,12 +24,92 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 86
|
||||||
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
|
Column{
|
||||||
|
spacing: 15
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
FluText{
|
||||||
|
text:"<font color='red'>Standard</font>模式窗口,每次都会创建新窗口"
|
||||||
|
}
|
||||||
|
FluButton{
|
||||||
|
text:"点击创建窗口"
|
||||||
|
onClicked: {
|
||||||
|
FluApp.navigate("/standardWindow")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 86
|
||||||
|
paddings: 10
|
||||||
|
Layout.topMargin: 10
|
||||||
|
Column{
|
||||||
|
spacing: 15
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
FluText{
|
||||||
|
text:"<font color='red'>SingleTask</font>模式窗口,如果窗口存在,这激活该窗口"
|
||||||
|
textFormat: Text.RichText
|
||||||
|
}
|
||||||
|
FluButton{
|
||||||
|
text:"点击创建窗口"
|
||||||
|
onClicked: {
|
||||||
|
FluApp.navigate("/singleTaskWindow")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 86
|
||||||
|
paddings: 10
|
||||||
|
Layout.topMargin: 10
|
||||||
|
Column{
|
||||||
|
spacing: 15
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
FluText{
|
||||||
|
text:"<font color='red'>SingleInstance</font>模式窗口,如果窗口存在,则销毁窗口,然后新建窗口"
|
||||||
|
}
|
||||||
|
FluButton{
|
||||||
|
text:"点击创建窗口"
|
||||||
|
onClicked: {
|
||||||
|
FluApp.navigate("/singleInstanceWindow")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluWindow{
|
||||||
|
//launchMode: FluWindow.Standard
|
||||||
|
//launchMode: FluWindow.SingleTask
|
||||||
|
launchMode: FluWindow.SingleInstance
|
||||||
|
}
|
||||||
|
'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
height: 100
|
height: 100
|
||||||
paddings: 10
|
paddings: 10
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
|
|
||||||
Column{
|
Column{
|
||||||
spacing: 15
|
spacing: 15
|
||||||
anchors{
|
anchors{
|
||||||
@ -46,6 +127,17 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluButton{
|
||||||
|
text:"点击跳转"
|
||||||
|
onClicked: {
|
||||||
|
FluApp.navigate("/about")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'
|
||||||
|
}
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -68,11 +160,31 @@ FluScrollablePage{
|
|||||||
loginPageRegister.launch({username:"zhuzichu"})
|
loginPageRegister.launch({username:"zhuzichu"})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
text:"登录窗口返回过来的密码->"+password
|
text:"登录窗口返回过来的密码->"+password
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'property var loginPageRegister: registerForPageResult("/login")
|
||||||
|
|
||||||
|
Connections{
|
||||||
|
target: loginPageRegister
|
||||||
|
function onResult(data)
|
||||||
|
{
|
||||||
|
password = data.password
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FluButton{
|
||||||
|
text:"点击跳转"
|
||||||
|
onClicked: {
|
||||||
|
loginPageRegister.launch({username:"zhuzichu"})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import "./component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
@ -10,7 +11,7 @@ FluScrollablePage{
|
|||||||
leftPadding:10
|
leftPadding:10
|
||||||
rightPadding:10
|
rightPadding:10
|
||||||
bottomPadding:20
|
bottomPadding:20
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -20,6 +21,7 @@ FluScrollablePage{
|
|||||||
|
|
||||||
FluPivot{
|
FluPivot{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
currentIndex: 2
|
||||||
FluPivotItem{
|
FluPivotItem{
|
||||||
title:"All"
|
title:"All"
|
||||||
contentItem:FluText{
|
contentItem:FluText{
|
||||||
@ -46,6 +48,37 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluPivot{
|
||||||
|
anchors.fill: parent
|
||||||
|
FluPivotItem:{
|
||||||
|
text:"All"
|
||||||
|
contentItem: FluText{
|
||||||
|
text:"All emails go here."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluPivotItem:{
|
||||||
|
text:"Unread"
|
||||||
|
contentItem: FluText{
|
||||||
|
text:"Unread emails go here."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluPivotItem:{
|
||||||
|
text:"Flagged"
|
||||||
|
contentItem: FluText{
|
||||||
|
text:"Flagged emails go here."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluPivotItem:{
|
||||||
|
text:"Urgent"
|
||||||
|
contentItem: FluText{
|
||||||
|
text:"Urgent emails go here."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import "./component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
@ -10,30 +11,60 @@ FluScrollablePage{
|
|||||||
leftPadding:10
|
leftPadding:10
|
||||||
rightPadding:10
|
rightPadding:10
|
||||||
bottomPadding:20
|
bottomPadding:20
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
FluProgressBar{
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
|
height: 260
|
||||||
|
paddings: 10
|
||||||
|
ColumnLayout{
|
||||||
|
spacing: 20
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
FluProgressBar{
|
||||||
}
|
}
|
||||||
FluProgressRing{
|
FluProgressRing{
|
||||||
Layout.topMargin: 10
|
|
||||||
}
|
}
|
||||||
FluProgressBar{
|
FluProgressBar{
|
||||||
id:progress_bar
|
id:progress_bar
|
||||||
Layout.topMargin: 20
|
|
||||||
indeterminate: false
|
indeterminate: false
|
||||||
}
|
}
|
||||||
FluProgressRing{
|
FluProgressRing{
|
||||||
id:progress_ring
|
id:progress_ring
|
||||||
Layout.topMargin: 10
|
|
||||||
indeterminate: false
|
indeterminate: false
|
||||||
}
|
}
|
||||||
FluSlider{
|
FluSlider{
|
||||||
Layout.topMargin: 30
|
|
||||||
value:50
|
value:50
|
||||||
onValueChanged:{
|
onValueChanged:{
|
||||||
progress_bar.progress = value/100
|
progress_bar.progress = value/100
|
||||||
progress_ring.progress = value/100
|
progress_ring.progress = value/100
|
||||||
}
|
}
|
||||||
Layout.bottomMargin: 30
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluProgressBar{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
FluProgressRing{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
FluProgressBar{
|
||||||
|
indeterminate: false
|
||||||
|
}
|
||||||
|
|
||||||
|
FluProgressRing{
|
||||||
|
indeterminate: false
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
44
example/T_RatingControl.qml
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Window
|
||||||
|
import QtQuick.Controls
|
||||||
|
import FluentUI
|
||||||
|
import "./component"
|
||||||
|
|
||||||
|
FluScrollablePage{
|
||||||
|
|
||||||
|
title:"RatingControl"
|
||||||
|
leftPadding:10
|
||||||
|
rightPadding:10
|
||||||
|
bottomPadding:20
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 100
|
||||||
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
|
|
||||||
|
Column{
|
||||||
|
spacing: 10
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
FluRatingControl{
|
||||||
|
|
||||||
|
}
|
||||||
|
FluRatingControl{
|
||||||
|
number:10
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluRatingControl{
|
||||||
|
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -3,6 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import "./component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
@ -10,6 +11,20 @@ FluScrollablePage{
|
|||||||
leftPadding:10
|
leftPadding:10
|
||||||
rightPadding:10
|
rightPadding:10
|
||||||
bottomPadding:20
|
bottomPadding:20
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: 20
|
||||||
|
height: 480
|
||||||
|
paddings: 10
|
||||||
|
|
||||||
|
Column{
|
||||||
|
spacing: 15
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
|
||||||
RowLayout{
|
RowLayout{
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
@ -114,4 +129,24 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
Layout.topMargin: 10
|
Layout.topMargin: 10
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluRectangle{
|
||||||
|
radius: [25,25,25,25]
|
||||||
|
width: 50
|
||||||
|
height: 50
|
||||||
|
Image{
|
||||||
|
asynchronous: true
|
||||||
|
anchors.fill: parent
|
||||||
|
source: "qrc:/res/svg/avatar_4.svg"
|
||||||
|
sourceSize: Qt.size(width,height)
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
117
example/T_Settings.qml
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Window
|
||||||
|
import QtQuick.Controls
|
||||||
|
import FluentUI
|
||||||
|
import "qrc:///global/"
|
||||||
|
import "./component"
|
||||||
|
|
||||||
|
FluScrollablePage{
|
||||||
|
|
||||||
|
title:"Settings"
|
||||||
|
leftPadding:10
|
||||||
|
rightPadding:10
|
||||||
|
bottomPadding:20
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: 20
|
||||||
|
height: 136
|
||||||
|
paddings: 10
|
||||||
|
|
||||||
|
ColumnLayout{
|
||||||
|
spacing: 10
|
||||||
|
anchors{
|
||||||
|
top: parent.top
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
FluText{
|
||||||
|
text:lang.dark_mode
|
||||||
|
fontStyle: FluText.BodyStrong
|
||||||
|
Layout.bottomMargin: 4
|
||||||
|
}
|
||||||
|
Repeater{
|
||||||
|
model: [{title:"System",mode:FluDarkMode.System},{title:"Light",mode:FluDarkMode.Light},{title:"Dark",mode:FluDarkMode.Dark}]
|
||||||
|
delegate: FluRadioButton{
|
||||||
|
selected : FluTheme.darkMode === modelData.mode
|
||||||
|
text:modelData.title
|
||||||
|
onClicked:{
|
||||||
|
FluTheme.darkMode = modelData.mode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: 20
|
||||||
|
height: 168
|
||||||
|
paddings: 10
|
||||||
|
|
||||||
|
ColumnLayout{
|
||||||
|
spacing: 10
|
||||||
|
anchors{
|
||||||
|
top: parent.top
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
|
||||||
|
FluText{
|
||||||
|
text:lang.navigation_view_display_mode
|
||||||
|
fontStyle: FluText.BodyStrong
|
||||||
|
Layout.bottomMargin: 4
|
||||||
|
}
|
||||||
|
Repeater{
|
||||||
|
model: [{title:"Open",mode:FluNavigationView.Open},{title:"Compact",mode:FluNavigationView.Compact},{title:"Minimal",mode:FluNavigationView.Minimal},{title:"Auto",mode:FluNavigationView.Auto}]
|
||||||
|
delegate: FluRadioButton{
|
||||||
|
selected : MainEvent.displayMode===modelData.mode
|
||||||
|
text:modelData.title
|
||||||
|
onClicked:{
|
||||||
|
MainEvent.displayMode = modelData.mode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: 20
|
||||||
|
height: 80
|
||||||
|
paddings: 10
|
||||||
|
|
||||||
|
ColumnLayout{
|
||||||
|
spacing: 10
|
||||||
|
anchors{
|
||||||
|
top: parent.top
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
|
||||||
|
FluText{
|
||||||
|
text:lang.locale
|
||||||
|
fontStyle: FluText.BodyStrong
|
||||||
|
Layout.bottomMargin: 4
|
||||||
|
}
|
||||||
|
|
||||||
|
Flow{
|
||||||
|
spacing: 5
|
||||||
|
Repeater{
|
||||||
|
model: ["Zh","En"]
|
||||||
|
delegate: FluRadioButton{
|
||||||
|
selected : appInfo.lang.objectName === modelData
|
||||||
|
text:modelData
|
||||||
|
onClicked:{
|
||||||
|
console.debug(modelData)
|
||||||
|
appInfo.changeLang(modelData)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -2,6 +2,7 @@
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
|
import "./component"
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
@ -10,17 +11,48 @@ FluScrollablePage{
|
|||||||
leftPadding:10
|
leftPadding:10
|
||||||
rightPadding:10
|
rightPadding:10
|
||||||
bottomPadding:20
|
bottomPadding:20
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
FluSlider{
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 100
|
||||||
|
paddings: 10
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
value: 50
|
|
||||||
Layout.leftMargin: 10
|
|
||||||
}
|
|
||||||
FluSlider{
|
FluSlider{
|
||||||
|
value: 50
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluSlider{
|
||||||
|
value:50
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 200
|
||||||
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
|
FluSlider{
|
||||||
|
value: 50
|
||||||
|
vertical:true
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: 20
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluSlider{
|
||||||
vertical:true
|
vertical:true
|
||||||
Layout.topMargin: 20
|
|
||||||
Layout.leftMargin: 10
|
|
||||||
Layout.bottomMargin: 20
|
|
||||||
value:50
|
value:50
|
||||||
|
}'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
92
example/T_StatusView.qml
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Window
|
||||||
|
import FluentUI
|
||||||
|
import "./component"
|
||||||
|
|
||||||
|
FluScrollablePage{
|
||||||
|
|
||||||
|
title:"StatusView"
|
||||||
|
leftPadding:10
|
||||||
|
rightPadding:10
|
||||||
|
bottomPadding:20
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
id:layout_actions
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: 20
|
||||||
|
height: 50
|
||||||
|
paddings: 10
|
||||||
|
RowLayout{
|
||||||
|
spacing: 14
|
||||||
|
FluDropDownButton{
|
||||||
|
id:btn_status_mode
|
||||||
|
Layout.preferredWidth: 140
|
||||||
|
text:"Loading"
|
||||||
|
items:[
|
||||||
|
FluMenuItem{
|
||||||
|
text:"Loading"
|
||||||
|
onClicked: {
|
||||||
|
btn_status_mode.text = text
|
||||||
|
status_view.statusMode = FluStatusView.Loading
|
||||||
|
}
|
||||||
|
},
|
||||||
|
FluMenuItem{
|
||||||
|
text:"Empty"
|
||||||
|
onClicked: {
|
||||||
|
btn_status_mode.text = text
|
||||||
|
status_view.statusMode = FluStatusView.Empty
|
||||||
|
}
|
||||||
|
},
|
||||||
|
FluMenuItem{
|
||||||
|
text:"Error"
|
||||||
|
onClicked: {
|
||||||
|
btn_status_mode.text = text
|
||||||
|
status_view.statusMode = FluStatusView.Error
|
||||||
|
}
|
||||||
|
},
|
||||||
|
FluMenuItem{
|
||||||
|
text:"Success"
|
||||||
|
onClicked: {
|
||||||
|
btn_status_mode.text = text
|
||||||
|
status_view.statusMode = FluStatusView.Success
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: 10
|
||||||
|
height: 380
|
||||||
|
paddings: 10
|
||||||
|
FluStatusView{
|
||||||
|
id:status_view
|
||||||
|
anchors.fill: parent
|
||||||
|
onErrorClicked:{
|
||||||
|
showError("点击重新加载")
|
||||||
|
}
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
color:FluTheme.primaryColor.dark
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluStatusView{
|
||||||
|
anchors.fill: parent
|
||||||
|
statusMode: FluStatusView.Loading
|
||||||
|
Rectangle{
|
||||||
|
anchors.fill: parent
|
||||||
|
color:FluTheme.primaryColor.dark
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -3,6 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import "./component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
@ -10,6 +11,7 @@ FluScrollablePage{
|
|||||||
leftPadding:10
|
leftPadding:10
|
||||||
rightPadding:10
|
rightPadding:10
|
||||||
bottomPadding:20
|
bottomPadding:20
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
property var colors : [FluColors.Yellow,FluColors.Orange,FluColors.Red,FluColors.Magenta,FluColors.Purple,FluColors.Blue,FluColors.Teal,FluColors.Green]
|
property var colors : [FluColors.Yellow,FluColors.Orange,FluColors.Red,FluColors.Magenta,FluColors.Purple,FluColors.Blue,FluColors.Teal,FluColors.Green]
|
||||||
|
|
||||||
@ -99,7 +101,7 @@ FluScrollablePage{
|
|||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 5
|
Layout.topMargin: 15
|
||||||
height: 400
|
height: 400
|
||||||
paddings: 10
|
paddings: 10
|
||||||
FluTabView{
|
FluTabView{
|
||||||
@ -109,5 +111,28 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluTabView{
|
||||||
|
anchors.fill: parent
|
||||||
|
Component.onCompleted: {
|
||||||
|
newTab()
|
||||||
|
newTab()
|
||||||
|
newTab()
|
||||||
|
}
|
||||||
|
Component{
|
||||||
|
id:com_page
|
||||||
|
Rectangle{
|
||||||
|
anchors.fill: parent
|
||||||
|
color: argument
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function newTab(){
|
||||||
|
tab_view.appendTab("qrc:/res/image/favicon.ico","Document 1",com_page,argument)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
159
example/T_TableView.qml
Normal file
@ -0,0 +1,159 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Window
|
||||||
|
import FluentUI
|
||||||
|
import "./component"
|
||||||
|
|
||||||
|
FluScrollablePage{
|
||||||
|
|
||||||
|
title:"TableView"
|
||||||
|
leftPadding:10
|
||||||
|
rightPadding:10
|
||||||
|
bottomPadding:20
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
title: '姓名',
|
||||||
|
dataIndex: 'name',
|
||||||
|
width:100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '年龄',
|
||||||
|
dataIndex: 'age',
|
||||||
|
width:100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '住址',
|
||||||
|
dataIndex: 'address',
|
||||||
|
width:200
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '别名',
|
||||||
|
dataIndex: 'nickname',
|
||||||
|
width:100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
dataIndex: 'action',
|
||||||
|
width:100
|
||||||
|
},
|
||||||
|
];
|
||||||
|
table_view.columns = columns
|
||||||
|
loadData(1,10)
|
||||||
|
}
|
||||||
|
|
||||||
|
FluTableView{
|
||||||
|
id:table_view
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: 20
|
||||||
|
pageCurrent:1
|
||||||
|
pageCount:10
|
||||||
|
itemCount: 1000
|
||||||
|
onRequestPage:
|
||||||
|
(page,count)=> {
|
||||||
|
loadData(page,count)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component{
|
||||||
|
id:com_action
|
||||||
|
Item{
|
||||||
|
Row{
|
||||||
|
anchors.centerIn: parent
|
||||||
|
spacing: 10
|
||||||
|
FluFilledButton{
|
||||||
|
text:"编辑"
|
||||||
|
topPadding:3
|
||||||
|
bottomPadding:3
|
||||||
|
leftPadding:3
|
||||||
|
rightPadding:3
|
||||||
|
onClicked:{
|
||||||
|
console.debug(dataModel.index)
|
||||||
|
showSuccess(JSON.stringify(dataObject))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluFilledButton{
|
||||||
|
text:"删除"
|
||||||
|
topPadding:3
|
||||||
|
bottomPadding:3
|
||||||
|
leftPadding:3
|
||||||
|
rightPadding:3
|
||||||
|
onClicked:{
|
||||||
|
showError(JSON.stringify(dataObject))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadData(page,count){
|
||||||
|
const dataSource = []
|
||||||
|
for(var i=0;i<count;i++){
|
||||||
|
dataSource.push({
|
||||||
|
name: "孙悟空%1".arg(((page-1)*count+i)),
|
||||||
|
age: 500,
|
||||||
|
address: "钟灵毓秀的花果山,如神仙仙境的水帘洞",
|
||||||
|
nickname: "齐天大圣",
|
||||||
|
action:com_action
|
||||||
|
})
|
||||||
|
}
|
||||||
|
table_view.dataSource = dataSource
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -3,6 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import "./component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
@ -10,32 +11,164 @@ FluScrollablePage{
|
|||||||
leftPadding:10
|
leftPadding:10
|
||||||
rightPadding:10
|
rightPadding:10
|
||||||
bottomPadding:20
|
bottomPadding:20
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 68
|
||||||
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
|
|
||||||
FluTextBox{
|
FluTextBox{
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
placeholderText: "单行输入框"
|
placeholderText: "单行输入框"
|
||||||
Layout.preferredWidth: 300
|
Layout.preferredWidth: 300
|
||||||
disabled:toggle_switch.selected
|
disabled:text_box_switch.selected
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left: parent.left
|
||||||
}
|
}
|
||||||
FluMultilineTextBox{
|
|
||||||
Layout.topMargin: 20
|
|
||||||
Layout.preferredWidth: 300
|
|
||||||
placeholderText: "多行输入框"
|
|
||||||
disabled:toggle_switch.selected
|
|
||||||
}
|
|
||||||
FluAutoSuggestBox{
|
|
||||||
Layout.topMargin: 20
|
|
||||||
items:generateRandomNames(100)
|
|
||||||
placeholderText: "AutoSuggestBox"
|
|
||||||
Layout.preferredWidth: 300
|
|
||||||
disabled:toggle_switch.selected
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FluToggleSwitch{
|
Row{
|
||||||
id:toggle_switch
|
spacing: 5
|
||||||
text:"Disabled"
|
anchors{
|
||||||
Layout.topMargin: 20
|
verticalCenter: parent.verticalCenter
|
||||||
|
right: parent.right
|
||||||
}
|
}
|
||||||
|
FluToggleSwitch{
|
||||||
|
id:text_box_switch
|
||||||
|
Layout.alignment: Qt.AlignRight
|
||||||
|
text:"Disabled"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluTextBox{
|
||||||
|
placeholderText:"单行输入框"
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 68
|
||||||
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
|
|
||||||
|
FluPasswordBox{
|
||||||
|
Layout.topMargin: 20
|
||||||
|
placeholderText: "请输入密码"
|
||||||
|
Layout.preferredWidth: 300
|
||||||
|
disabled:password_box_switch.selected
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row{
|
||||||
|
spacing: 5
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
|
FluToggleSwitch{
|
||||||
|
id:password_box_switch
|
||||||
|
Layout.alignment: Qt.AlignRight
|
||||||
|
text:"Disabled"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluPasswordBox{
|
||||||
|
placeholderText:"请输入密码"
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 36+multiine_textbox.height
|
||||||
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
|
|
||||||
|
FluMultilineTextBox{
|
||||||
|
id:multiine_textbox
|
||||||
|
Layout.topMargin: 20
|
||||||
|
placeholderText: "多行输入框"
|
||||||
|
Layout.preferredWidth: 300
|
||||||
|
disabled:text_box_multi_switch.selected
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row{
|
||||||
|
spacing: 5
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
|
FluToggleSwitch{
|
||||||
|
id:text_box_multi_switch
|
||||||
|
Layout.alignment: Qt.AlignRight
|
||||||
|
text:"Disabled"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluMultilineTextBox{
|
||||||
|
placeholderText:"多行输入框"
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 68
|
||||||
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
|
|
||||||
|
FluAutoSuggestBox{
|
||||||
|
Layout.topMargin: 20
|
||||||
|
placeholderText: "AutoSuggestBox"
|
||||||
|
Layout.preferredWidth: 300
|
||||||
|
items:generateRandomNames(100)
|
||||||
|
disabled:text_box_suggest_switch.selected
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row{
|
||||||
|
spacing: 5
|
||||||
|
anchors{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
|
FluToggleSwitch{
|
||||||
|
id:text_box_suggest_switch
|
||||||
|
Layout.alignment: Qt.AlignRight
|
||||||
|
text:"Disabled"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluAutoSuggestBox{
|
||||||
|
placeholderText:"AutoSuggestBox"
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function generateRandomNames(numNames) {
|
function generateRandomNames(numNames) {
|
||||||
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||||
|
@ -3,6 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import "./component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
@ -10,9 +11,20 @@ FluScrollablePage{
|
|||||||
leftPadding:10
|
leftPadding:10
|
||||||
rightPadding:10
|
rightPadding:10
|
||||||
bottomPadding:20
|
bottomPadding:20
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
RowLayout{
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
|
height: 210
|
||||||
|
paddings: 10
|
||||||
|
ColumnLayout{
|
||||||
|
spacing:0
|
||||||
|
anchors{
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
RowLayout{
|
||||||
|
Layout.topMargin: 10
|
||||||
Repeater{
|
Repeater{
|
||||||
model: [FluColors.Yellow,FluColors.Orange,FluColors.Red,FluColors.Magenta,FluColors.Purple,FluColors.Blue,FluColors.Teal,FluColors.Green]
|
model: [FluColors.Yellow,FluColors.Orange,FluColors.Red,FluColors.Magenta,FluColors.Purple,FluColors.Blue,FluColors.Teal,FluColors.Green]
|
||||||
delegate: FluRectangle{
|
delegate: FluRectangle{
|
||||||
@ -43,9 +55,14 @@ FluScrollablePage{
|
|||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
}
|
}
|
||||||
FluToggleSwitch{
|
FluToggleSwitch{
|
||||||
|
Layout.topMargin: 5
|
||||||
selected: FluTheme.dark
|
selected: FluTheme.dark
|
||||||
clickFunc:function(){
|
clickFunc:function(){
|
||||||
FluTheme.dark = !FluTheme.dark
|
if(FluTheme.dark){
|
||||||
|
FluTheme.darkMode = FluDarkMode.Light
|
||||||
|
}else{
|
||||||
|
FluTheme.darkMode = FluDarkMode.Dark
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluText{
|
FluText{
|
||||||
@ -53,9 +70,23 @@ FluScrollablePage{
|
|||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
}
|
}
|
||||||
FluToggleSwitch{
|
FluToggleSwitch{
|
||||||
|
Layout.topMargin: 5
|
||||||
selected: FluTheme.nativeText
|
selected: FluTheme.nativeText
|
||||||
clickFunc:function(){
|
clickFunc:function(){
|
||||||
FluTheme.nativeText = !FluTheme.nativeText
|
FluTheme.nativeText = !FluTheme.nativeText
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluTheme.primaryColor = FluColors.Orange
|
||||||
|
|
||||||
|
FluTheme.dark = true
|
||||||
|
|
||||||
|
FluTheme.nativeText = true'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -3,6 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import "./component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
@ -10,6 +11,7 @@ FluScrollablePage{
|
|||||||
leftPadding:10
|
leftPadding:10
|
||||||
rightPadding:10
|
rightPadding:10
|
||||||
bottomPadding:20
|
bottomPadding:20
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -33,7 +35,13 @@ FluScrollablePage{
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluTimePicker{
|
||||||
|
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -49,7 +57,7 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
text:"hourFormat=FluTimePicker.HH"
|
text:"hourFormat=FluTimePicker.H"
|
||||||
}
|
}
|
||||||
|
|
||||||
FluTimePicker{
|
FluTimePicker{
|
||||||
@ -58,6 +66,12 @@ FluScrollablePage{
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluTimePicker{
|
||||||
|
hourFormat:FluTimePicker.HH
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import "./component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
@ -10,12 +11,30 @@ FluScrollablePage{
|
|||||||
leftPadding:10
|
leftPadding:10
|
||||||
rightPadding:10
|
rightPadding:10
|
||||||
bottomPadding:20
|
bottomPadding:20
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
FluToggleSwitch{
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 68
|
||||||
|
paddings: 10
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
|
Row{
|
||||||
|
spacing: 30
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
FluToggleSwitch{
|
||||||
}
|
}
|
||||||
FluToggleSwitch{
|
FluToggleSwitch{
|
||||||
Layout.topMargin: 20
|
|
||||||
text:"Text"
|
text:"Text"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluToggleSwitch{
|
||||||
|
text:"Text"
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -3,6 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import "./component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
@ -10,13 +11,13 @@ FluScrollablePage{
|
|||||||
leftPadding:10
|
leftPadding:10
|
||||||
rightPadding:10
|
rightPadding:10
|
||||||
bottomPadding:20
|
bottomPadding:20
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
text:"鼠标悬停不动,弹出Tooltip"
|
text:"鼠标悬停不动,弹出Tooltip"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
@ -42,6 +43,19 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluIconButton{
|
||||||
|
iconSource:FluentIcons.ChromeCloseContrast
|
||||||
|
iconSize: 15
|
||||||
|
text:"删除"
|
||||||
|
onClicked:{
|
||||||
|
showSuccess("点击IconButton")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'
|
||||||
|
}
|
||||||
|
|
||||||
FluArea{
|
FluArea{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -72,6 +86,22 @@ FluScrollablePage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluButton{
|
||||||
|
id:button_1
|
||||||
|
text:"删除"
|
||||||
|
FluTooltip{
|
||||||
|
visible: button_1.hovered
|
||||||
|
text:button_1.text
|
||||||
|
delay: 1000
|
||||||
|
}
|
||||||
|
onClicked:{
|
||||||
|
showSuccess("点击一个Button")
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,15 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import "./component"
|
||||||
|
|
||||||
FluContentPage {
|
FluScrollablePage {
|
||||||
|
|
||||||
title:"TreeView"
|
title:"TreeView"
|
||||||
leftPadding:10
|
leftPadding:10
|
||||||
rightPadding:10
|
rightPadding:10
|
||||||
bottomPadding:20
|
bottomPadding:20
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
function randomName() {
|
function randomName() {
|
||||||
var names = ["张三", "李四", "王五", "赵六", "钱七", "孙八", "周九", "吴十"]
|
var names = ["张三", "李四", "王五", "赵六", "钱七", "孙八", "周九", "吴十"]
|
||||||
@ -50,71 +52,42 @@ FluContentPage {
|
|||||||
return [tree_view.createItem(randomCompany(), true, subtrees)].concat(createOrg(numLevels - 1, numSubtrees, numEmployees))
|
return [tree_view.createItem(randomCompany(), true, subtrees)].concat(createOrg(numLevels - 1, numSubtrees, numEmployees))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FluArea{
|
||||||
FluTreeView{
|
id:layout_actions
|
||||||
id:tree_view
|
Layout.fillWidth: true
|
||||||
width:240
|
Layout.topMargin: 20
|
||||||
anchors{
|
height: 50
|
||||||
top:parent.top
|
paddings: 10
|
||||||
left:parent.left
|
RowLayout{
|
||||||
bottom:parent.bottom
|
spacing: 14
|
||||||
}
|
FluDropDownButton{
|
||||||
onItemClicked:
|
id:btn_selection_model
|
||||||
(model)=>{
|
Layout.preferredWidth: 140
|
||||||
showSuccess(model.text)
|
text:"None"
|
||||||
}
|
items:[
|
||||||
|
FluMenuItem{
|
||||||
Component.onCompleted: {
|
|
||||||
var org = createOrg(3, 3, 3)
|
|
||||||
updateData(org)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ColumnLayout{
|
|
||||||
anchors{
|
|
||||||
left: tree_view.right
|
|
||||||
right: parent.right
|
|
||||||
top: parent.top
|
|
||||||
}
|
|
||||||
|
|
||||||
FluText{
|
|
||||||
text:{
|
|
||||||
if(tree_view.selectionMode === FluTreeView.None){
|
|
||||||
return "selectionMode->FluTreeView.None"
|
|
||||||
}
|
|
||||||
if(tree_view.selectionMode === FluTreeView.Single){
|
|
||||||
return "selectionMode->FluTreeView.Single"
|
|
||||||
}
|
|
||||||
if(tree_view.selectionMode === FluTreeView.Multiple){
|
|
||||||
return "selectionMode->FluTreeView.Multiple"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FluButton{
|
|
||||||
text:"None"
|
text:"None"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
tree_view.selectionMode = FluTreeView.None
|
btn_selection_model.text = text
|
||||||
|
tree_view.selectionMode = FluTabView.Equal
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
FluMenuItem{
|
||||||
FluButton{
|
|
||||||
text:"Single"
|
text:"Single"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
tree_view.selectionMode = FluTreeView.Single
|
btn_selection_model.text = text
|
||||||
|
tree_view.selectionMode = FluTabView.SizeToContent
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
FluMenuItem{
|
||||||
FluButton{
|
text:"Muiltple"
|
||||||
text:"Multiple"
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
tree_view.selectionMode = FluTreeView.Multiple
|
btn_selection_model.text = text
|
||||||
|
tree_view.selectionMode = FluTabView.Compact
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
FluFilledButton{
|
FluFilledButton{
|
||||||
text:"获取选中的数据"
|
text:"获取选中的数据"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -139,6 +112,51 @@ FluContentPage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: 10
|
||||||
|
paddings: 10
|
||||||
|
height: 400
|
||||||
|
FluTreeView{
|
||||||
|
id:tree_view
|
||||||
|
width:240
|
||||||
|
anchors{
|
||||||
|
top:parent.top
|
||||||
|
left:parent.left
|
||||||
|
bottom:parent.bottom
|
||||||
|
}
|
||||||
|
onItemClicked:
|
||||||
|
(model)=>{
|
||||||
|
showSuccess(model.text)
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
var org = createOrg(3, 3, 3)
|
||||||
|
createItem()
|
||||||
|
updateData(org)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluTreeView{
|
||||||
|
id:tree_view
|
||||||
|
width:240
|
||||||
|
height:600
|
||||||
|
Component.onCompleted: {
|
||||||
|
var datas = []
|
||||||
|
datas.push(createItem("Node1",false))
|
||||||
|
datas.push(createItem("Node2",false))
|
||||||
|
datas.push(createItem("Node2",true,[createItem("Node2-1",false),createItem("Node2-2",false)]))
|
||||||
|
updateData(datas)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -15,15 +15,19 @@ FluContentPage {
|
|||||||
slider.seek(0)
|
slider.seek(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollView{
|
FluArea{
|
||||||
clip: true
|
anchors{
|
||||||
width: parent.width
|
top:parent.top
|
||||||
contentWidth: parent.width
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
bottom: parent.bottom
|
||||||
|
topMargin: 20
|
||||||
|
}
|
||||||
|
paddings: 10
|
||||||
ColumnLayout{
|
ColumnLayout{
|
||||||
spacing: 0
|
spacing: 0
|
||||||
FluText{
|
FluText{
|
||||||
text:"Display"
|
text:"Display"
|
||||||
Layout.topMargin: 20
|
|
||||||
padding: 0
|
padding: 0
|
||||||
pixelSize: textSize
|
pixelSize: textSize
|
||||||
fontStyle: FluText.Display
|
fontStyle: FluText.Display
|
||||||
@ -65,8 +69,6 @@ FluContentPage {
|
|||||||
fontStyle: FluText.Caption
|
fontStyle: FluText.Caption
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
FluSlider{
|
FluSlider{
|
||||||
id:slider
|
id:slider
|
||||||
@ -83,3 +85,10 @@ FluContentPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
131
example/component/CodeExpander.qml
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Window
|
||||||
|
import QtQuick.Controls
|
||||||
|
import FluentUI
|
||||||
|
|
||||||
|
FluExpander{
|
||||||
|
|
||||||
|
property string code: ""
|
||||||
|
|
||||||
|
headerText: "Source"
|
||||||
|
contentHeight:content.height
|
||||||
|
|
||||||
|
FluMultilineTextBox{
|
||||||
|
id:content
|
||||||
|
width:parent.width
|
||||||
|
readOnly:true
|
||||||
|
text:highlightQmlCode(code)
|
||||||
|
focus:false
|
||||||
|
textFormat: FluMultilineTextBox.RichText
|
||||||
|
KeyNavigation.priority: KeyNavigation.BeforeItem
|
||||||
|
background:Rectangle{
|
||||||
|
radius: 4
|
||||||
|
color:FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1)
|
||||||
|
border.color: FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1)
|
||||||
|
border.width: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FluIconButton{
|
||||||
|
iconSource:FluentIcons.Copy
|
||||||
|
anchors{
|
||||||
|
right: parent.right
|
||||||
|
top: parent.top
|
||||||
|
rightMargin: 5
|
||||||
|
topMargin: 5
|
||||||
|
}
|
||||||
|
onClicked:{
|
||||||
|
FluApp.clipText(content.text)
|
||||||
|
showSuccess("复制成功")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function htmlEncode(e){
|
||||||
|
var i,s;
|
||||||
|
for(i in s={
|
||||||
|
"&":/&/g,//""//":/"/g,"'":/'/g,
|
||||||
|
"<":/</g,">":/>/g,"<br/>":/\n/g,
|
||||||
|
" ":/ /g," ":/\t/g
|
||||||
|
})e=e.replace(s[i],i);
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
|
function highlightQmlCode(code) {
|
||||||
|
// 定义 QML 关键字列表
|
||||||
|
var qmlKeywords = [
|
||||||
|
"FluTextButton",
|
||||||
|
"FluAppBar",
|
||||||
|
"FluAutoSuggestBox",
|
||||||
|
"FluBadge",
|
||||||
|
"FluButton",
|
||||||
|
"FluCalendarPicker",
|
||||||
|
"FluCalendarView",
|
||||||
|
"FluCarousel",
|
||||||
|
"FluCheckBox",
|
||||||
|
"FluColorPicker",
|
||||||
|
"FluColorView",
|
||||||
|
"FluComboBox",
|
||||||
|
"FluContentDialog",
|
||||||
|
"FluContentPage",
|
||||||
|
"FluDatePicker",
|
||||||
|
"FluDivider",
|
||||||
|
"FluDropDownButton",
|
||||||
|
"FluExpander",
|
||||||
|
"FluFilledButton",
|
||||||
|
"FluFlipView",
|
||||||
|
"FluFocusRectangle",
|
||||||
|
"FluIcon",
|
||||||
|
"FluIconButton",
|
||||||
|
"FluInfoBar",
|
||||||
|
"FluItem",
|
||||||
|
"FluMediaPlayer",
|
||||||
|
"FluMenu",
|
||||||
|
"FluMenuItem",
|
||||||
|
"FluMultilineTextBox",
|
||||||
|
"FluNavigationView",
|
||||||
|
"FluObject",
|
||||||
|
"FluPaneItem",
|
||||||
|
"FluPaneItemExpander",
|
||||||
|
"FluPaneItemHeader",
|
||||||
|
"FluPaneItemSeparator",
|
||||||
|
"FluPivot",
|
||||||
|
"FluPivotItem",
|
||||||
|
"FluProgressBar",
|
||||||
|
"FluProgressRing",
|
||||||
|
"FluRadioButton",
|
||||||
|
"FluRectangle",
|
||||||
|
"FluScrollablePage",
|
||||||
|
"FluScrollBar",
|
||||||
|
"FluShadow",
|
||||||
|
"FluSlider",
|
||||||
|
"FluTabView",
|
||||||
|
"FluText",
|
||||||
|
"FluTextArea",
|
||||||
|
"FluTextBox",
|
||||||
|
"FluTextBoxBackground",
|
||||||
|
"FluTextBoxMenu",
|
||||||
|
"FluTextButton",
|
||||||
|
"FluTextFiled",
|
||||||
|
"FluTimePicker",
|
||||||
|
"FluToggleSwitch",
|
||||||
|
"FluTooltip",
|
||||||
|
"FluTreeView",
|
||||||
|
"FluWindow",
|
||||||
|
"FluWindowResize",
|
||||||
|
"FluToggleButton",
|
||||||
|
"FluTableView",
|
||||||
|
"FluColors",
|
||||||
|
"FluTheme",
|
||||||
|
"FluStatusView",
|
||||||
|
"FluRatingControl",
|
||||||
|
"FluPasswordBox"
|
||||||
|
];
|
||||||
|
code = code.replace(/\n/g, "<br>");
|
||||||
|
code = code.replace(/ /g, " ");
|
||||||
|
return code.replace(RegExp("\\b(" + qmlKeywords.join("|") + ")\\b", "g"), "<span style='color: #c23a80'>$1</span>");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,12 +1,21 @@
|
|||||||
QT += quick quickcontrols2 concurrent network multimedia
|
QT += quick concurrent network multimedia
|
||||||
CONFIG += c++17
|
CONFIG += c++17
|
||||||
DEFINES += QT_DEPRECATED_WARNINGS QT_NO_WARNING_OUTPUT
|
DEFINES += QT_DEPRECATED_WARNINGS QT_NO_WARNING_OUTPUT
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
ChatController.h
|
lang/En.h \
|
||||||
|
lang/Lang.h \
|
||||||
|
lang/Zh.h \
|
||||||
|
stdafx.h \
|
||||||
|
ChatController.h \
|
||||||
|
AppInfo.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
ChatController.cpp \
|
ChatController.cpp \
|
||||||
|
AppInfo.cpp \
|
||||||
|
lang/En.cpp \
|
||||||
|
lang/Lang.cpp \
|
||||||
|
lang/Zh.cpp \
|
||||||
main.cpp
|
main.cpp
|
||||||
|
|
||||||
RESOURCES += qml.qrc
|
RESOURCES += qml.qrc
|
||||||
@ -23,13 +32,15 @@ CONFIG(debug,debug|release) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
win32 {
|
win32 {
|
||||||
contains(QT_ARCH, i386) {
|
|
||||||
COPYDLL = $$absolute_path($${_PRO_FILE_PWD_}/../third/Win_x86/*.dll) $$DESTDIR
|
contains(QMAKE_CC, cl) {
|
||||||
|
COPYDLL = $$absolute_path($${_PRO_FILE_PWD_}/../third/msvc/*.dll) $$DESTDIR
|
||||||
QMAKE_PRE_LINK += $$QMAKE_COPY $$replace(COPYDLL, /, $$QMAKE_DIR_SEP)
|
QMAKE_PRE_LINK += $$QMAKE_COPY $$replace(COPYDLL, /, $$QMAKE_DIR_SEP)
|
||||||
} else {
|
} else {
|
||||||
COPYDLL = $$absolute_path($${_PRO_FILE_PWD_}/../third/Win_x64/*.dll) $$DESTDIR
|
COPYDLL = $$absolute_path($${_PRO_FILE_PWD_}/../third/mingw/*.dll) $$DESTDIR
|
||||||
QMAKE_PRE_LINK += $$QMAKE_COPY $$replace(COPYDLL, /, $$QMAKE_DIR_SEP)
|
QMAKE_PRE_LINK += $$QMAKE_COPY $$replace(COPYDLL, /, $$QMAKE_DIR_SEP)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qnx: target.path = /tmp/$${TARGET}/bin
|
qnx: target.path = /tmp/$${TARGET}/bin
|
||||||
|
@ -5,17 +5,22 @@ import FluentUI
|
|||||||
|
|
||||||
FluObject{
|
FluObject{
|
||||||
id:footer_items
|
id:footer_items
|
||||||
|
|
||||||
|
property var navigationView
|
||||||
|
|
||||||
FluPaneItemSeparator{}
|
FluPaneItemSeparator{}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"意见反馈"
|
title:lang.about
|
||||||
onTap:{
|
icon:FluentIcons.Contact
|
||||||
Qt.openUrlExternally("https://github.com/zhuzichu520/FluentUI/issues/new")
|
tapFunc:function(){
|
||||||
}
|
|
||||||
}
|
|
||||||
FluPaneItem{
|
|
||||||
title:"关于"
|
|
||||||
onTap:{
|
|
||||||
FluApp.navigate("/about")
|
FluApp.navigate("/about")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FluPaneItem{
|
||||||
|
title:lang.settings
|
||||||
|
icon:FluentIcons.Settings
|
||||||
|
onTap:{
|
||||||
|
navigationView.push("qrc:/T_Settings.qml")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,23 +3,28 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
|
|
||||||
FluObject{
|
FluObject{
|
||||||
|
|
||||||
property var navigationView
|
property var navigationView
|
||||||
|
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Home"
|
title:lang.home
|
||||||
icon:FluentIcons.Home
|
// icon:FluentIcons.Home
|
||||||
|
cusIcon: Image{
|
||||||
|
anchors.centerIn: parent
|
||||||
|
source: FluTheme.dark ? "qrc:/res/svg/home_dark.svg" : "qrc:/res/svg/home.svg"
|
||||||
|
sourceSize: Qt.size(30,30)
|
||||||
|
width: 18
|
||||||
|
height: 18
|
||||||
|
}
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Home.qml")
|
navigationView.push("qrc:/T_Home.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluPaneItemExpander{
|
FluPaneItemExpander{
|
||||||
title:"Basic input"
|
title:lang.basic_input
|
||||||
icon:FluentIcons.CheckboxComposite
|
icon:FluentIcons.CheckboxComposite
|
||||||
|
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Buttons"
|
title:"Buttons"
|
||||||
image:"qrc:/res/image/control/Button.png"
|
image:"qrc:/res/image/control/Button.png"
|
||||||
@ -38,7 +43,6 @@ FluObject{
|
|||||||
navigationView.push("qrc:/T_Slider.qml")
|
navigationView.push("qrc:/T_Slider.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"CheckBox"
|
title:"CheckBox"
|
||||||
image:"qrc:/res/image/control/Checkbox.png"
|
image:"qrc:/res/image/control/Checkbox.png"
|
||||||
@ -48,7 +52,6 @@ FluObject{
|
|||||||
navigationView.push("qrc:/T_CheckBox.qml")
|
navigationView.push("qrc:/T_CheckBox.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"ToggleSwitch"
|
title:"ToggleSwitch"
|
||||||
onTap:{
|
onTap:{
|
||||||
@ -58,7 +61,7 @@ FluObject{
|
|||||||
}
|
}
|
||||||
|
|
||||||
FluPaneItemExpander{
|
FluPaneItemExpander{
|
||||||
title:"Form"
|
title:lang.form
|
||||||
icon:FluentIcons.GridView
|
icon:FluentIcons.GridView
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"TextBox"
|
title:"TextBox"
|
||||||
@ -92,11 +95,9 @@ FluObject{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FluPaneItemExpander{
|
FluPaneItemExpander{
|
||||||
title:"Surface"
|
title:lang.surface
|
||||||
icon:FluentIcons.SurfaceHub
|
icon:FluentIcons.SurfaceHub
|
||||||
|
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"InfoBar"
|
title:"InfoBar"
|
||||||
image:"qrc:/res/image/control/InfoBar.png"
|
image:"qrc:/res/image/control/InfoBar.png"
|
||||||
@ -106,46 +107,52 @@ FluObject{
|
|||||||
navigationView.push("qrc:/T_InfoBar.qml")
|
navigationView.push("qrc:/T_InfoBar.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Progress"
|
title:"Progress"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Progress.qml")
|
navigationView.push("qrc:/T_Progress.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FluPaneItem{
|
||||||
|
title:"RatingControl"
|
||||||
|
onTap:{
|
||||||
|
navigationView.push("qrc:/T_RatingControl.qml")
|
||||||
|
}
|
||||||
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Badge"
|
title:"Badge"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Badge.qml")
|
navigationView.push("qrc:/T_Badge.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Rectangle"
|
title:"Rectangle"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Rectangle.qml")
|
navigationView.push("qrc:/T_Rectangle.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FluPaneItem{
|
||||||
|
title:"StatusView"
|
||||||
|
onTap:{
|
||||||
|
navigationView.push("qrc:/T_StatusView.qml")
|
||||||
|
}
|
||||||
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Carousel"
|
title:"Carousel"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Carousel.qml")
|
navigationView.push("qrc:/T_Carousel.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Expander"
|
title:"Expander"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Expander.qml")
|
navigationView.push("qrc:/T_Expander.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FluPaneItemExpander{
|
FluPaneItemExpander{
|
||||||
title:"Popus"
|
title:lang.popus
|
||||||
icon:FluentIcons.ButtonMenu
|
icon:FluentIcons.ButtonMenu
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Dialog"
|
title:"Dialog"
|
||||||
@ -153,14 +160,12 @@ FluObject{
|
|||||||
navigationView.push("qrc:/T_Dialog.qml")
|
navigationView.push("qrc:/T_Dialog.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Tooltip"
|
title:"Tooltip"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Tooltip.qml")
|
navigationView.push("qrc:/T_Tooltip.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Menu"
|
title:"Menu"
|
||||||
onTap:{
|
onTap:{
|
||||||
@ -170,9 +175,8 @@ FluObject{
|
|||||||
}
|
}
|
||||||
|
|
||||||
FluPaneItemExpander{
|
FluPaneItemExpander{
|
||||||
title:"Navigation"
|
title:lang.navigation
|
||||||
icon:FluentIcons.AllApps
|
icon:FluentIcons.AllApps
|
||||||
|
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Pivot"
|
title:"Pivot"
|
||||||
image:"qrc:/res/image/control/Pivot.png"
|
image:"qrc:/res/image/control/Pivot.png"
|
||||||
@ -199,6 +203,16 @@ FluObject{
|
|||||||
navigationView.push("qrc:/T_TreeView.qml")
|
navigationView.push("qrc:/T_TreeView.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FluPaneItem{
|
||||||
|
title:"TableView"
|
||||||
|
image:"qrc:/res/image/control/DataGrid.png"
|
||||||
|
recentlyAdded:true
|
||||||
|
order:4
|
||||||
|
desc:"The TableView control provides a flexible way to display a collection of data in rows and columns"
|
||||||
|
onTap:{
|
||||||
|
navigationView.push("qrc:/T_TableView.qml")
|
||||||
|
}
|
||||||
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"MultiWindow"
|
title:"MultiWindow"
|
||||||
onTap:{
|
onTap:{
|
||||||
@ -218,7 +232,7 @@ FluObject{
|
|||||||
}
|
}
|
||||||
|
|
||||||
FluPaneItemExpander{
|
FluPaneItemExpander{
|
||||||
title:"Theming"
|
title:lang.theming
|
||||||
icon:FluentIcons.Brightness
|
icon:FluentIcons.Brightness
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Theme"
|
title:"Theme"
|
||||||
@ -226,23 +240,22 @@ FluObject{
|
|||||||
navigationView.push("qrc:/T_Theme.qml")
|
navigationView.push("qrc:/T_Theme.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluPaneItem{
|
|
||||||
title:"Awesome"
|
|
||||||
onTap:{
|
|
||||||
navigationView.push("qrc:/T_Awesome.qml")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Typography"
|
title:"Typography"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Typography.qml")
|
navigationView.push("qrc:/T_Typography.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FluPaneItem{
|
||||||
|
title:"Awesome"
|
||||||
|
onTap:{
|
||||||
|
navigationView.push("qrc:/T_Awesome.qml")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluPaneItemExpander{
|
FluPaneItemExpander{
|
||||||
title:"Media"
|
title:lang.media
|
||||||
icon:FluentIcons.Media
|
icon:FluentIcons.Media
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"MediaPlayer"
|
title:"MediaPlayer"
|
||||||
@ -301,21 +314,7 @@ FluObject{
|
|||||||
}
|
}
|
||||||
|
|
||||||
function startPageByItem(data){
|
function startPageByItem(data){
|
||||||
var items = navigationView.getItems();
|
navigationView.startPageByItem(data)
|
||||||
for(var i=0;i<items.length;i++){
|
|
||||||
var item = items[i]
|
|
||||||
if(item.key === data.key){
|
|
||||||
if(navigationView.getCurrentIndex() === i){
|
|
||||||
return
|
|
||||||
}
|
|
||||||
item.tap()
|
|
||||||
navigationView.setCurrentIndex(i)
|
|
||||||
if(item.parent){
|
|
||||||
item.parent.isExpand = true
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
9
example/global/MainEvent.qml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
pragma Singleton
|
||||||
|
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import FluentUI
|
||||||
|
|
||||||
|
QtObject {
|
||||||
|
property int displayMode : FluNavigationView.Auto
|
||||||
|
}
|
@ -1,2 +1,3 @@
|
|||||||
singleton ItemsOriginal 1.0 ItemsOriginal.qml
|
singleton ItemsOriginal 1.0 ItemsOriginal.qml
|
||||||
singleton ItemsFooter 1.0 ItemsFooter.qml
|
singleton ItemsFooter 1.0 ItemsFooter.qml
|
||||||
|
singleton MainEvent 1.0 MainEvent.qml
|
||||||
|
22
example/lang/En.cpp
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#include "En.h"
|
||||||
|
|
||||||
|
En::En(QObject *parent)
|
||||||
|
: Lang{parent}
|
||||||
|
{
|
||||||
|
setObjectName("En");
|
||||||
|
home("Home");
|
||||||
|
basic_input("Basic Input");
|
||||||
|
form("Form");
|
||||||
|
surface("Surfaces");
|
||||||
|
popus("Popus");
|
||||||
|
navigation("Navigation");
|
||||||
|
theming("Theming");
|
||||||
|
media("Media");
|
||||||
|
dark_mode("Dark Mode");
|
||||||
|
sys_dark_mode("Sync with system");
|
||||||
|
search("Search");
|
||||||
|
about("About");
|
||||||
|
settings("Settings");
|
||||||
|
locale("Locale");
|
||||||
|
navigation_view_display_mode("NavigationView Display Mode");
|
||||||
|
}
|
17
example/lang/En.h
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#ifndef EN_H
|
||||||
|
#define EN_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include "Lang.h"
|
||||||
|
|
||||||
|
class En : public Lang
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit En(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // EN_H
|
7
example/lang/Lang.cpp
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#include "Lang.h"
|
||||||
|
|
||||||
|
Lang::Lang(QObject *parent)
|
||||||
|
: QObject{parent}
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
30
example/lang/Lang.h
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#ifndef LANG_H
|
||||||
|
#define LANG_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include "stdafx.h"
|
||||||
|
|
||||||
|
class Lang : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PROPERTY_AUTO(QString,home);
|
||||||
|
Q_PROPERTY_AUTO(QString,basic_input);
|
||||||
|
Q_PROPERTY_AUTO(QString,form);
|
||||||
|
Q_PROPERTY_AUTO(QString,surface);
|
||||||
|
Q_PROPERTY_AUTO(QString,popus);
|
||||||
|
Q_PROPERTY_AUTO(QString,navigation);
|
||||||
|
Q_PROPERTY_AUTO(QString,theming);
|
||||||
|
Q_PROPERTY_AUTO(QString,media);
|
||||||
|
Q_PROPERTY_AUTO(QString,dark_mode);
|
||||||
|
Q_PROPERTY_AUTO(QString,sys_dark_mode);
|
||||||
|
Q_PROPERTY_AUTO(QString,search);
|
||||||
|
Q_PROPERTY_AUTO(QString,about);
|
||||||
|
Q_PROPERTY_AUTO(QString,settings);
|
||||||
|
Q_PROPERTY_AUTO(QString,navigation_view_display_mode);
|
||||||
|
Q_PROPERTY_AUTO(QString,locale);
|
||||||
|
public:
|
||||||
|
explicit Lang(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // LANG_H
|
22
example/lang/Zh.cpp
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#include "Zh.h"
|
||||||
|
|
||||||
|
Zh::Zh(QObject *parent)
|
||||||
|
: Lang{parent}
|
||||||
|
{
|
||||||
|
setObjectName("Zh");
|
||||||
|
home("首页");
|
||||||
|
basic_input("基本输入");
|
||||||
|
form("表单");
|
||||||
|
surface("表面");
|
||||||
|
popus("弹窗");
|
||||||
|
navigation("导航");
|
||||||
|
theming("主题");
|
||||||
|
media("媒体");
|
||||||
|
dark_mode("夜间模式");
|
||||||
|
sys_dark_mode("跟随系统");
|
||||||
|
search("查找");
|
||||||
|
about("关于");
|
||||||
|
settings("设置");
|
||||||
|
locale("语言环境");
|
||||||
|
navigation_view_display_mode("导航视图显示模式");
|
||||||
|
}
|
17
example/lang/Zh.h
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#ifndef ZH_H
|
||||||
|
#define ZH_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include "Lang.h"
|
||||||
|
|
||||||
|
class Zh : public Lang
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit Zh(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ZH_H
|
@ -3,35 +3,35 @@
|
|||||||
#include <QQmlContext>
|
#include <QQmlContext>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QQuickWindow>
|
#include <QQuickWindow>
|
||||||
#include <QQuickStyle>
|
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
#include "lang/Lang.h"
|
||||||
|
#include "AppInfo.h"
|
||||||
#include "ChatController.h"
|
#include "ChatController.h"
|
||||||
|
|
||||||
QMap<QString, QVariant> properties(){
|
|
||||||
QMap<QString, QVariant> map;
|
|
||||||
// map["installHelper"] = QVariant::fromValue(QVariant::fromValue(InstallHelper::getInstance()));
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QCoreApplication::setOrganizationName("ZhuZiChu");
|
//将样式设置为Basic,不然会导致组件显示异常
|
||||||
QCoreApplication::setOrganizationDomain("https://zhuzichu520.github.io");
|
qputenv("QT_QUICK_CONTROLS_STYLE","Basic");
|
||||||
QCoreApplication::setApplicationName("FluentUI");
|
//6.4及以下监听系统深色模式变化
|
||||||
QQuickStyle::setStyle("Basic");
|
#ifdef Q_OS_WIN
|
||||||
|
qputenv("QT_QPA_PLATFORM","windows:darkmode=2");
|
||||||
|
#endif
|
||||||
|
QGuiApplication::setOrganizationName("ZhuZiChu");
|
||||||
|
QGuiApplication::setOrganizationDomain("https://zhuzichu520.github.io");
|
||||||
|
QGuiApplication::setApplicationName("FluentUI");
|
||||||
|
// QQuickWindow::setGraphicsApi(QSGRendererInterface::Software);
|
||||||
QGuiApplication app(argc, argv);
|
QGuiApplication app(argc, argv);
|
||||||
|
app.setQuitOnLastWindowClosed(false);
|
||||||
QQmlApplicationEngine engine;
|
QQmlApplicationEngine engine;
|
||||||
|
|
||||||
qmlRegisterType<ChatController>("Controller",1,0,"ChatController");
|
qmlRegisterType<ChatController>("Controller",1,0,"ChatController");
|
||||||
|
AppInfo* appInfo = new AppInfo();
|
||||||
QMapIterator<QString, QVariant> iterator(properties());
|
QQmlContext * context = engine.rootContext();
|
||||||
while (iterator.hasNext()) {
|
Lang* lang = appInfo->lang();
|
||||||
iterator.next();
|
context->setContextProperty("lang",lang);
|
||||||
QString key = iterator.key();
|
QObject::connect(appInfo,&AppInfo::langChanged,&app,[context,appInfo]{
|
||||||
QVariant value = iterator.value();
|
context->setContextProperty("lang",appInfo->lang());
|
||||||
engine.rootContext()->setContextProperty(key,value);
|
});
|
||||||
}
|
context->setContextProperty("appInfo",appInfo);
|
||||||
engine.rootContext()->setContextProperty("properties",properties());
|
|
||||||
const QUrl url(QStringLiteral("qrc:/App.qml"));
|
const QUrl url(QStringLiteral("qrc:/App.qml"));
|
||||||
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
|
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
|
||||||
&app, [url](QObject *obj, const QUrl &objUrl) {
|
&app, [url](QObject *obj, const QUrl &objUrl) {
|
||||||
|
@ -5,12 +5,15 @@ import FluentUI
|
|||||||
|
|
||||||
FluWindow {
|
FluWindow {
|
||||||
|
|
||||||
width: 500
|
id:window
|
||||||
|
|
||||||
|
width: 600
|
||||||
height: 600
|
height: 600
|
||||||
minimumWidth: 500
|
minimumWidth: 600
|
||||||
minimumHeight: 600
|
minimumHeight: 600
|
||||||
maximumWidth: 500
|
maximumWidth: 600
|
||||||
maximumHeight: 600
|
maximumHeight: 600
|
||||||
|
launchMode: FluWindow.SingleTask
|
||||||
|
|
||||||
title:"关于"
|
title:"关于"
|
||||||
|
|
||||||
@ -36,7 +39,7 @@ FluWindow {
|
|||||||
fontStyle: FluText.Title
|
fontStyle: FluText.Title
|
||||||
}
|
}
|
||||||
FluText{
|
FluText{
|
||||||
text:"v1.1.9"
|
text:"v%1".arg(appInfo.version)
|
||||||
fontStyle: FluText.Body
|
fontStyle: FluText.Body
|
||||||
Layout.alignment: Qt.AlignBottom
|
Layout.alignment: Qt.AlignBottom
|
||||||
}
|
}
|
||||||
@ -57,13 +60,14 @@ FluWindow {
|
|||||||
|
|
||||||
RowLayout{
|
RowLayout{
|
||||||
spacing: 14
|
spacing: 14
|
||||||
Layout.topMargin: 20
|
|
||||||
Layout.leftMargin: 15
|
Layout.leftMargin: 15
|
||||||
FluText{
|
FluText{
|
||||||
text:"GitHub:"
|
text:"GitHub:"
|
||||||
}
|
}
|
||||||
FluTextButton{
|
FluTextButton{
|
||||||
id:text_hublink
|
id:text_hublink
|
||||||
|
topPadding:0
|
||||||
|
bottomPadding:0
|
||||||
text:"https://github.com/zhuzichu520/FluentUI"
|
text:"https://github.com/zhuzichu520/FluentUI"
|
||||||
Layout.alignment: Qt.AlignBottom
|
Layout.alignment: Qt.AlignBottom
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -71,13 +75,30 @@ FluWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RowLayout{
|
||||||
|
spacing: 14
|
||||||
|
Layout.leftMargin: 15
|
||||||
|
FluText{
|
||||||
|
text:"B站:"
|
||||||
|
}
|
||||||
|
FluTextButton{
|
||||||
|
topPadding:0
|
||||||
|
bottomPadding:0
|
||||||
|
text:"https://www.bilibili.com/video/BV1mg4y1M71w/"
|
||||||
|
Layout.alignment: Qt.AlignBottom
|
||||||
|
onClicked: {
|
||||||
|
Qt.openUrlExternally(text)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RowLayout{
|
RowLayout{
|
||||||
spacing: 14
|
spacing: 14
|
||||||
Layout.topMargin: 20
|
|
||||||
Layout.leftMargin: 15
|
Layout.leftMargin: 15
|
||||||
FluText{
|
FluText{
|
||||||
id:text_info
|
id:text_info
|
||||||
text:"如果该项目对你有作用,就请点击上方链接给一个免费的star吧!"
|
text:"如果该项目对你有作用,就请点击上方链接给一个免费的star,或者一键三连,谢谢!"
|
||||||
ColorAnimation {
|
ColorAnimation {
|
||||||
id: animation
|
id: animation
|
||||||
target: text_info
|
target: text_info
|
||||||
@ -91,5 +112,43 @@ FluWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RowLayout{
|
||||||
|
spacing: 14
|
||||||
|
Layout.leftMargin: 15
|
||||||
|
FluText{
|
||||||
|
text:"捐赠:"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item{
|
||||||
|
Layout.preferredWidth: parent.width
|
||||||
|
Layout.preferredHeight: 252
|
||||||
|
Row{
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
spacing: 60
|
||||||
|
Image{
|
||||||
|
width: 164.55
|
||||||
|
height: 224.25
|
||||||
|
source: "qrc:/res/image/qrcode_wx.jpg"
|
||||||
|
}
|
||||||
|
Image{
|
||||||
|
width: 162
|
||||||
|
height: 252
|
||||||
|
source: "qrc:/res/image/qrcode_zfb.jpg"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout{
|
||||||
|
spacing: 14
|
||||||
|
Layout.leftMargin: 15
|
||||||
|
FluText{
|
||||||
|
id:text_desc
|
||||||
|
text:"个人开发,维护不易,你们的捐赠就是我继续更新的动力!\n有什么问题提Issues,只要时间充足我就会解决的!!"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,7 @@ FluWindow {
|
|||||||
rightMargin: 10
|
rightMargin: 10
|
||||||
}
|
}
|
||||||
height: Math.min(textbox.implicitHeight,64)
|
height: Math.min(textbox.implicitHeight,64)
|
||||||
FluMultiLineTextBox{
|
FluMultilineTextBox{
|
||||||
id:textbox
|
id:textbox
|
||||||
focus:true
|
focus:true
|
||||||
placeholderText: "请输入消息"
|
placeholderText: "请输入消息"
|
||||||
|
@ -12,8 +12,6 @@ FluWindow {
|
|||||||
minimumHeight: 400
|
minimumHeight: 400
|
||||||
maximumWidth: 400
|
maximumWidth: 400
|
||||||
maximumHeight: 400
|
maximumHeight: 400
|
||||||
modality:2
|
|
||||||
|
|
||||||
title:"登录"
|
title:"登录"
|
||||||
|
|
||||||
onInitArgument:
|
onInitArgument:
|
||||||
|
@ -2,22 +2,73 @@
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import "qrc:///global/"
|
import Qt.labs.platform
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import "qrc:///global/"
|
||||||
|
|
||||||
FluWindow {
|
FluWindow {
|
||||||
id:rootwindow
|
id:window
|
||||||
width: 1000
|
width: 1000
|
||||||
height: 640
|
height: 640
|
||||||
title: "FluentUI"
|
title: "FluentUI"
|
||||||
|
closeDestory:false
|
||||||
minimumWidth: 520
|
minimumWidth: 520
|
||||||
minimumHeight: 460
|
minimumHeight: 460
|
||||||
|
|
||||||
|
closeFunc:function(event){
|
||||||
|
close_app.open()
|
||||||
|
event.accepted = false
|
||||||
|
}
|
||||||
|
|
||||||
FluAppBar{
|
FluAppBar{
|
||||||
id:appbar
|
id:appbar
|
||||||
z:10
|
z:9
|
||||||
showDark: true
|
showDark: true
|
||||||
width:parent.width
|
width:parent.width
|
||||||
|
darkText: lang.dark_mode
|
||||||
|
}
|
||||||
|
|
||||||
|
SystemTrayIcon {
|
||||||
|
id:system_tray
|
||||||
|
visible: true
|
||||||
|
icon.source: "qrc:/res/image/favicon.ico"
|
||||||
|
tooltip: "FluentUI"
|
||||||
|
menu: Menu {
|
||||||
|
MenuItem {
|
||||||
|
text: "退出"
|
||||||
|
onTriggered: {
|
||||||
|
window.destoryWindow()
|
||||||
|
FluApp.closeApp()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onActivated:
|
||||||
|
(reason)=>{
|
||||||
|
if(reason === SystemTrayIcon.Trigger){
|
||||||
|
window.show()
|
||||||
|
window.raise()
|
||||||
|
window.requestActivate()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FluContentDialog{
|
||||||
|
id:close_app
|
||||||
|
title:"退出"
|
||||||
|
message:"确定要退出程序吗?"
|
||||||
|
negativeText:"最小化"
|
||||||
|
buttonFlags: FluContentDialog.NeutralButton | FluContentDialog.NegativeButton | FluContentDialog.PositiveButton
|
||||||
|
onNegativeClicked:{
|
||||||
|
system_tray.showMessage("友情提示","FluentUI已隐藏至托盘,点击托盘可再次激活窗口");
|
||||||
|
window.hide()
|
||||||
|
}
|
||||||
|
positiveText:"退出"
|
||||||
|
neutralText:"取消"
|
||||||
|
onPositiveClicked:{
|
||||||
|
window.destoryWindow()
|
||||||
|
FluApp.closeApp()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNavigationView{
|
FluNavigationView{
|
||||||
@ -25,15 +76,16 @@ FluWindow {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
items: ItemsOriginal
|
items: ItemsOriginal
|
||||||
footerItems:ItemsFooter
|
footerItems:ItemsFooter
|
||||||
logo: "qrc:/res/image/favicon.ico"
|
|
||||||
z:11
|
z:11
|
||||||
|
displayMode:MainEvent.displayMode
|
||||||
|
logo: "qrc:/res/image/favicon.ico"
|
||||||
title:"FluentUI"
|
title:"FluentUI"
|
||||||
autoSuggestBox:FluAutoSuggestBox{
|
autoSuggestBox:FluAutoSuggestBox{
|
||||||
width: 280
|
width: 280
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
iconSource: FluentIcons.Zoom
|
iconSource: FluentIcons.Search
|
||||||
items: ItemsOriginal.getSearchData()
|
items: ItemsOriginal.getSearchData()
|
||||||
placeholderText: "查找"
|
placeholderText: lang.search
|
||||||
onItemClicked:
|
onItemClicked:
|
||||||
(data)=>{
|
(data)=>{
|
||||||
ItemsOriginal.startPageByItem(data)
|
ItemsOriginal.startPageByItem(data)
|
||||||
@ -41,8 +93,8 @@ FluWindow {
|
|||||||
}
|
}
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
ItemsOriginal.navigationView = nav_view
|
ItemsOriginal.navigationView = nav_view
|
||||||
|
ItemsFooter.navigationView = nav_view
|
||||||
nav_view.setCurrentIndex(0)
|
nav_view.setCurrentIndex(0)
|
||||||
nav_view.push("qrc:/T_Home.qml")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
46
example/page/SingleInstanceWindow.qml
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import FluentUI
|
||||||
|
|
||||||
|
FluWindow {
|
||||||
|
|
||||||
|
id:window
|
||||||
|
|
||||||
|
width: 500
|
||||||
|
height: 600
|
||||||
|
minimumWidth: 500
|
||||||
|
minimumHeight: 600
|
||||||
|
maximumWidth: 500
|
||||||
|
maximumHeight: 600
|
||||||
|
launchMode: FluWindow.SingleInstance
|
||||||
|
|
||||||
|
title:"SingleInstance"
|
||||||
|
|
||||||
|
FluAppBar{
|
||||||
|
id:appbar
|
||||||
|
title:"SingleInstance"
|
||||||
|
width:parent.width
|
||||||
|
}
|
||||||
|
|
||||||
|
FluTextBox{
|
||||||
|
anchors{
|
||||||
|
top:parent.top
|
||||||
|
topMargin:60
|
||||||
|
horizontalCenter: parent.horizontalCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FluText{
|
||||||
|
wrapMode: Text.WrapAnywhere
|
||||||
|
anchors{
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
leftMargin: 20
|
||||||
|
rightMargin: 20
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
text:"我是一个SingleInstance模式的窗口,如果我存在,我会销毁之前的窗口,并创建一个新窗口"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
31
example/page/SingleTaskWindow.qml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import FluentUI
|
||||||
|
|
||||||
|
FluWindow {
|
||||||
|
|
||||||
|
id:window
|
||||||
|
|
||||||
|
width: 500
|
||||||
|
height: 600
|
||||||
|
minimumWidth: 500
|
||||||
|
minimumHeight: 600
|
||||||
|
maximumWidth: 500
|
||||||
|
maximumHeight: 600
|
||||||
|
launchMode: FluWindow.SingleTask
|
||||||
|
|
||||||
|
title:"SingleTask"
|
||||||
|
|
||||||
|
FluAppBar{
|
||||||
|
id:appbar
|
||||||
|
title:"SingleTask"
|
||||||
|
width:parent.width
|
||||||
|
}
|
||||||
|
|
||||||
|
FluText{
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text:"我是一个SingleTask模式的窗口,如果我存在,我就激活窗口"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
31
example/page/StandardWindow.qml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import FluentUI
|
||||||
|
|
||||||
|
FluWindow {
|
||||||
|
|
||||||
|
id:window
|
||||||
|
|
||||||
|
width: 500
|
||||||
|
height: 600
|
||||||
|
minimumWidth: 500
|
||||||
|
minimumHeight: 600
|
||||||
|
maximumWidth: 500
|
||||||
|
maximumHeight: 600
|
||||||
|
launchMode: FluWindow.Standard
|
||||||
|
|
||||||
|
title:"Standard"
|
||||||
|
|
||||||
|
FluAppBar{
|
||||||
|
id:appbar
|
||||||
|
title:"Standard"
|
||||||
|
width:parent.width
|
||||||
|
}
|
||||||
|
|
||||||
|
FluText{
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text:"我是一个Standard模式的窗口,每次我都会创建一个新的窗口"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -155,5 +155,18 @@
|
|||||||
<file>page/MediaPage.qml</file>
|
<file>page/MediaPage.qml</file>
|
||||||
<file>T_FlipView.qml</file>
|
<file>T_FlipView.qml</file>
|
||||||
<file>T_Pivot.qml</file>
|
<file>T_Pivot.qml</file>
|
||||||
|
<file>component/CodeExpander.qml</file>
|
||||||
|
<file>T_TableView.qml</file>
|
||||||
|
<file>T_StatusView.qml</file>
|
||||||
|
<file>T_Settings.qml</file>
|
||||||
|
<file>global/MainEvent.qml</file>
|
||||||
|
<file>res/svg/home.svg</file>
|
||||||
|
<file>res/svg/home_dark.svg</file>
|
||||||
|
<file>page/StandardWindow.qml</file>
|
||||||
|
<file>page/SingleTaskWindow.qml</file>
|
||||||
|
<file>page/SingleInstanceWindow.qml</file>
|
||||||
|
<file>T_RatingControl.qml</file>
|
||||||
|
<file>res/image/qrcode_wx.jpg</file>
|
||||||
|
<file>res/image/qrcode_zfb.jpg</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
BIN
example/res/image/qrcode_wx.jpg
Normal file
After Width: | Height: | Size: 119 KiB |
BIN
example/res/image/qrcode_zfb.jpg
Normal file
After Width: | Height: | Size: 145 KiB |
1
example/res/svg/home.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1681271578882" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3664" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M923.733333 394.666667c-85.333333-70.4-206.933333-174.933333-362.666666-309.333334C533.333333 61.866667 490.666667 61.866667 462.933333 85.333333c-155.733333 134.4-277.333333 238.933333-362.666666 309.333334-14.933333 14.933333-25.6 34.133333-25.6 53.333333 0 38.4 32 70.4 70.4 70.4H192v358.4c0 29.866667 23.466667 53.333333 53.333333 53.333333H405.333333c29.866667 0 53.333333-23.466667 53.333334-53.333333v-206.933333h106.666666v206.933333c0 29.866667 23.466667 53.333333 53.333334 53.333333h160c29.866667 0 53.333333-23.466667 53.333333-53.333333V518.4h46.933333c38.4 0 70.4-32 70.4-70.4 0-21.333333-10.666667-40.533333-25.6-53.333333z m-44.8 59.733333h-57.6c-29.866667 0-53.333333 23.466667-53.333333 53.333333v358.4h-138.666667V661.333333c0-29.866667-23.466667-53.333333-53.333333-53.333333h-128c-29.866667 0-53.333333 23.466667-53.333333 53.333333v206.933334H256V507.733333c0-29.866667-23.466667-53.333333-53.333333-53.333333H145.066667c-4.266667 0-6.4-2.133333-6.4-6.4 0-2.133333 2.133333-4.266667 2.133333-6.4 85.333333-70.4 206.933333-174.933333 362.666667-309.333333 4.266667-4.266667 10.666667-4.266667 14.933333 0 155.733333 134.4 277.333333 238.933333 362.666667 309.333333 2.133333 2.133333 2.133333 2.133333 2.133333 4.266667 2.133333 6.4-2.133333 8.533333-4.266667 8.533333z" fill="#2c2c2c" p-id="3665"></path></svg>
|
After Width: | Height: | Size: 1.6 KiB |
1
example/res/svg/home_dark.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1681277986581" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3875" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M923.733333 394.666667c-85.333333-70.4-206.933333-174.933333-362.666666-309.333334C533.333333 61.866667 490.666667 61.866667 462.933333 85.333333c-155.733333 134.4-277.333333 238.933333-362.666666 309.333334-14.933333 14.933333-25.6 34.133333-25.6 53.333333 0 38.4 32 70.4 70.4 70.4H192v358.4c0 29.866667 23.466667 53.333333 53.333333 53.333333H405.333333c29.866667 0 53.333333-23.466667 53.333334-53.333333v-206.933333h106.666666v206.933333c0 29.866667 23.466667 53.333333 53.333334 53.333333h160c29.866667 0 53.333333-23.466667 53.333333-53.333333V518.4h46.933333c38.4 0 70.4-32 70.4-70.4 0-21.333333-10.666667-40.533333-25.6-53.333333z m-44.8 59.733333h-57.6c-29.866667 0-53.333333 23.466667-53.333333 53.333333v358.4h-138.666667V661.333333c0-29.866667-23.466667-53.333333-53.333333-53.333333h-128c-29.866667 0-53.333333 23.466667-53.333333 53.333333v206.933334H256V507.733333c0-29.866667-23.466667-53.333333-53.333333-53.333333H145.066667c-4.266667 0-6.4-2.133333-6.4-6.4 0-2.133333 2.133333-4.266667 2.133333-6.4 85.333333-70.4 206.933333-174.933333 362.666667-309.333333 4.266667-4.266667 10.666667-4.266667 14.933333 0 155.733333 134.4 277.333333 238.933333 362.666667 309.333333 2.133333 2.133333 2.133333 2.133333 2.133333 4.266667 2.133333 6.4-2.133333 8.533333-4.266667 8.533333z" fill="#ffffff" p-id="3876"></path></svg>
|
After Width: | Height: | Size: 1.6 KiB |
@ -10,6 +10,10 @@ set(QT_INSTALL_QML ${Qt6Core_DIR}/../../../qml)
|
|||||||
set(TARGET_TYPE SHARED)
|
set(TARGET_TYPE SHARED)
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/FluentUI)
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/FluentUI)
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
set(CMAKE_SHARED_LIBRARY_PREFIX "")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(TARGET_RESOURCES res.qrc)
|
set(TARGET_RESOURCES res.qrc)
|
||||||
set(TARGET_SOURCES
|
set(TARGET_SOURCES
|
||||||
Def.cpp
|
Def.cpp
|
||||||
@ -20,6 +24,7 @@ set(TARGET_SOURCES
|
|||||||
FluTheme.cpp
|
FluTheme.cpp
|
||||||
Fluent.cpp
|
Fluent.cpp
|
||||||
FluentUI.cpp
|
FluentUI.cpp
|
||||||
|
NativeEventFilter.cpp
|
||||||
WindowHelper.cpp
|
WindowHelper.cpp
|
||||||
qml_plugin.cpp
|
qml_plugin.cpp
|
||||||
)
|
)
|
||||||
@ -33,18 +38,12 @@ set(TARGET_HEADERS
|
|||||||
FluTheme.h
|
FluTheme.h
|
||||||
Fluent.h
|
Fluent.h
|
||||||
FluentUI.h
|
FluentUI.h
|
||||||
FramelessView.h
|
NativeEventFilter.h
|
||||||
WindowHelper.h
|
WindowHelper.h
|
||||||
qml_plugin.h
|
qml_plugin.h
|
||||||
stdafx.h
|
stdafx.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if(WIN32)
|
|
||||||
set(TARGET_SOURCES ${TARGET_SOURCES} FramelessView_win.cpp)
|
|
||||||
else()
|
|
||||||
set(TARGET_SOURCES ${TARGET_SOURCES} FramelessView_unix.cpp)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_definitions(-DVERSION_IN="1.0.0")
|
add_definitions(-DVERSION_IN="1.0.0")
|
||||||
add_definitions(-DVURI_STR="FluentUI")
|
add_definitions(-DVURI_STR="FluentUI")
|
||||||
|
|
||||||
|
10
src/Def.h
@ -3,6 +3,16 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
|
namespace Fluent_DarkMode {
|
||||||
|
Q_NAMESPACE
|
||||||
|
enum Fluent_DarkModeType {
|
||||||
|
System = 0x0,
|
||||||
|
Light = 0x1,
|
||||||
|
Dark = 0x2,
|
||||||
|
};
|
||||||
|
Q_ENUMS(Fluent_DarkModeType);
|
||||||
|
}
|
||||||
|
|
||||||
namespace Fluent_Awesome {
|
namespace Fluent_Awesome {
|
||||||
Q_NAMESPACE
|
Q_NAMESPACE
|
||||||
enum class Fluent_AwesomeType {
|
enum class Fluent_AwesomeType {
|
||||||
|
@ -7,8 +7,20 @@
|
|||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
|
#include "FluTheme.h"
|
||||||
#include "Def.h"
|
#include "Def.h"
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
#include <dwmapi.h>
|
||||||
|
#include <Windows.h>
|
||||||
|
#include <windowsx.h>
|
||||||
|
static bool isCompositionEnabled()
|
||||||
|
{
|
||||||
|
BOOL composition_enabled = FALSE;
|
||||||
|
bool success = ::DwmIsCompositionEnabled(&composition_enabled) == S_OK;
|
||||||
|
return composition_enabled && success;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
FluApp* FluApp::m_instance = nullptr;
|
FluApp* FluApp::m_instance = nullptr;
|
||||||
|
|
||||||
@ -25,12 +37,16 @@ FluApp::FluApp(QObject *parent)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluApp::init(QWindow *window,QMap<QString, QVariant> properties){
|
void FluApp::init(QQuickWindow *window){
|
||||||
this->appWindow = window;
|
this->appWindow = window;
|
||||||
this->properties = properties;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluApp::run(){
|
void FluApp::run(){
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
if(!isCompositionEnabled()){
|
||||||
|
FluTheme::getInstance()->frameless(false);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
navigate(initialRoute());
|
navigate(initialRoute());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,38 +55,45 @@ void FluApp::navigate(const QString& route,const QJsonObject& argument,FluRegist
|
|||||||
qErrnoWarning("没有找到当前路由");
|
qErrnoWarning("没有找到当前路由");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bool isAppWindow = route == initialRoute();
|
QQmlEngine *engine = qmlEngine(appWindow);
|
||||||
FramelessView *view = new FramelessView();
|
QQmlComponent component(engine, routes().value(route).toString());
|
||||||
|
QVariantMap properties;
|
||||||
|
properties.insert("route",route);
|
||||||
if(fluRegister){
|
if(fluRegister){
|
||||||
fluRegister->to(view);
|
properties.insert("pageRegister",QVariant::fromValue(fluRegister));
|
||||||
view->setProperty("pageRegister",QVariant::fromValue(fluRegister));
|
|
||||||
}
|
}
|
||||||
view->setProperty("argument",argument);
|
properties.insert("argument",argument);
|
||||||
QMapIterator<QString, QVariant> iterator(properties);
|
QQuickWindow *view = qobject_cast<QQuickWindow*>(component.createWithInitialProperties(properties));
|
||||||
while (iterator.hasNext()) {
|
|
||||||
iterator.next();
|
int launchMode = view->property("launchMode").toInt();
|
||||||
QString key = iterator.key();
|
if(launchMode==1){
|
||||||
QVariant value = iterator.value();
|
for (auto& pair : wnds) {
|
||||||
view->engine()->rootContext()->setContextProperty(key,value);
|
QString r = pair->property("route").toString();
|
||||||
|
if(r == route){
|
||||||
|
pair->requestActivate();
|
||||||
|
view->deleteLater();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
view->setColor(QColor(Qt::transparent));
|
|
||||||
QObject::connect(view, &QQuickView::statusChanged, view, [&](QQuickView::Status status) {
|
|
||||||
if (status == QQuickView::Status::Ready) {
|
|
||||||
Q_EMIT windowReady(view);
|
|
||||||
view->moveToScreenCenter();
|
|
||||||
view->show();
|
|
||||||
}
|
}
|
||||||
});
|
}else if(launchMode==2){
|
||||||
view->setSource((routes().value(route).toString()));
|
for (auto& pair : wnds) {
|
||||||
if(isAppWindow){
|
QString r = pair->property("route").toString();
|
||||||
QObject::connect(view->engine(), &QQmlEngine::quit, qApp, &QCoreApplication::quit);
|
if(r == route){
|
||||||
}else{
|
pair->close();
|
||||||
view->closeDeleteLater();
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FluApp::equalsWindow(FramelessView *view,QWindow *window){
|
if(FluTheme::getInstance()->frameless()){
|
||||||
return view->winId() == window->winId();
|
view->setFlag(Qt::FramelessWindowHint,true);
|
||||||
|
}
|
||||||
|
wnds.insert(view->winId(),view);
|
||||||
|
if(fluRegister){
|
||||||
|
fluRegister->to(view);
|
||||||
|
}
|
||||||
|
view->setColor(QColor(Qt::transparent));
|
||||||
|
view->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
QJsonArray FluApp::awesomelist(const QString& keyword)
|
QJsonArray FluApp::awesomelist(const QString& keyword)
|
||||||
@ -104,3 +127,7 @@ void FluApp::clipText(const QString& text){
|
|||||||
QString FluApp::uuid(){
|
QString FluApp::uuid(){
|
||||||
return QUuid::createUuid().toString();
|
return QUuid::createUuid().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FluApp::closeApp(){
|
||||||
|
qApp->exit(0);
|
||||||
|
}
|
||||||
|
13
src/FluApp.h
@ -8,7 +8,6 @@
|
|||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QQmlEngine>
|
#include <QQmlEngine>
|
||||||
#include "FluRegister.h"
|
#include "FluRegister.h"
|
||||||
#include "FramelessView.h"
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
class FluApp : public QObject
|
class FluApp : public QObject
|
||||||
@ -27,11 +26,7 @@ public:
|
|||||||
|
|
||||||
Q_INVOKABLE void navigate(const QString& route,const QJsonObject& argument = {},FluRegister* fluRegister = nullptr);
|
Q_INVOKABLE void navigate(const QString& route,const QJsonObject& argument = {},FluRegister* fluRegister = nullptr);
|
||||||
|
|
||||||
Q_INVOKABLE void init(QWindow *window,QMap<QString, QVariant> properties);
|
Q_INVOKABLE void init(QQuickWindow *window);
|
||||||
|
|
||||||
Q_SIGNAL void windowReady(FramelessView *view);
|
|
||||||
|
|
||||||
Q_INVOKABLE bool equalsWindow(FramelessView *view,QWindow *window);
|
|
||||||
|
|
||||||
Q_INVOKABLE QJsonArray awesomelist(const QString& keyword = "");
|
Q_INVOKABLE QJsonArray awesomelist(const QString& keyword = "");
|
||||||
|
|
||||||
@ -39,11 +34,13 @@ public:
|
|||||||
|
|
||||||
Q_INVOKABLE QString uuid();
|
Q_INVOKABLE QString uuid();
|
||||||
|
|
||||||
|
Q_INVOKABLE void closeApp();
|
||||||
|
|
||||||
|
public:
|
||||||
|
QMap<quint64, QQuickWindow*> wnds;
|
||||||
private:
|
private:
|
||||||
QMap<QString, QVariant> properties;
|
|
||||||
static FluApp* m_instance;
|
static FluApp* m_instance;
|
||||||
QWindow *appWindow;
|
QWindow *appWindow;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FLUAPP_H
|
#endif // FLUAPP_H
|
||||||
|
@ -2,15 +2,15 @@
|
|||||||
#define FLUREGISTER_H
|
#define FLUREGISTER_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <FramelessView.h>
|
#include <QQuickWindow>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
class FluRegister : public QObject
|
class FluRegister : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY_AUTO(FramelessView*,from)
|
Q_PROPERTY_AUTO(QQuickWindow*,from)
|
||||||
Q_PROPERTY_AUTO(FramelessView*,to)
|
Q_PROPERTY_AUTO(QQuickWindow*,to)
|
||||||
Q_PROPERTY_AUTO(QString,path);
|
Q_PROPERTY_AUTO(QString,path);
|
||||||
public:
|
public:
|
||||||
explicit FluRegister(QObject *parent = nullptr);
|
explicit FluRegister(QObject *parent = nullptr);
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
#include "FluTheme.h"
|
#include "FluTheme.h"
|
||||||
|
|
||||||
#include "FluColors.h"
|
#include "FluColors.h"
|
||||||
|
#include "Def.h"
|
||||||
|
#include <QPalette>
|
||||||
|
#include <QGuiApplication>
|
||||||
|
|
||||||
FluTheme* FluTheme::m_instance = nullptr;
|
FluTheme* FluTheme::m_instance = nullptr;
|
||||||
|
|
||||||
@ -15,9 +18,44 @@ FluTheme *FluTheme::getInstance()
|
|||||||
FluTheme::FluTheme(QObject *parent)
|
FluTheme::FluTheme(QObject *parent)
|
||||||
: QObject{parent}
|
: QObject{parent}
|
||||||
{
|
{
|
||||||
|
connect(this,&FluTheme::darkModeChanged,this,[=]{
|
||||||
|
Q_EMIT darkChanged();
|
||||||
|
});
|
||||||
primaryColor(FluColors::getInstance()->Blue());
|
primaryColor(FluColors::getInstance()->Blue());
|
||||||
textSize(13);
|
textSize(13);
|
||||||
nativeText(true);
|
nativeText(false);
|
||||||
frameless(true);
|
frameless(true);
|
||||||
dark(false);
|
darkMode(Fluent_DarkMode::Fluent_DarkModeType::Light);
|
||||||
|
qApp->installEventFilter(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FluTheme::eventFilter(QObject *obj, QEvent *event)
|
||||||
|
{
|
||||||
|
Q_UNUSED(obj);
|
||||||
|
if (event->type() == QEvent::ApplicationPaletteChange)
|
||||||
|
{
|
||||||
|
Q_EMIT darkChanged();
|
||||||
|
event->accept();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FluTheme::systemDark()
|
||||||
|
{
|
||||||
|
QPalette palette = qApp->palette();
|
||||||
|
QColor color = palette.color(QPalette::Window).rgb();
|
||||||
|
return !(color.red() * 0.2126 + color.green() * 0.7152 + color.blue() * 0.0722 > 255 / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FluTheme::dark(){
|
||||||
|
if(_darkMode == Fluent_DarkMode::Fluent_DarkModeType::Dark){
|
||||||
|
return true;
|
||||||
|
}else if(_darkMode == Fluent_DarkMode::Fluent_DarkModeType::Light){
|
||||||
|
return false;
|
||||||
|
}else if(_darkMode == Fluent_DarkMode::Fluent_DarkModeType::System){
|
||||||
|
return systemDark();
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,17 +8,22 @@
|
|||||||
class FluTheme : public QObject
|
class FluTheme : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(bool dark READ dark NOTIFY darkChanged)
|
||||||
Q_PROPERTY_AUTO(FluColorSet*,primaryColor)
|
Q_PROPERTY_AUTO(FluColorSet*,primaryColor)
|
||||||
Q_PROPERTY_AUTO(bool,frameless);
|
Q_PROPERTY_AUTO(bool,frameless);
|
||||||
Q_PROPERTY_AUTO(bool,dark);
|
Q_PROPERTY_AUTO(int,darkMode);
|
||||||
Q_PROPERTY_AUTO(bool,nativeText);
|
Q_PROPERTY_AUTO(bool,nativeText);
|
||||||
Q_PROPERTY_AUTO(int,textSize);
|
Q_PROPERTY_AUTO(int,textSize);
|
||||||
public:
|
public:
|
||||||
explicit FluTheme(QObject *parent = nullptr);
|
explicit FluTheme(QObject *parent = nullptr);
|
||||||
static FluTheme *getInstance();
|
static FluTheme *getInstance();
|
||||||
|
bool dark();
|
||||||
|
Q_SIGNAL void darkChanged();
|
||||||
private:
|
private:
|
||||||
static FluTheme* m_instance;
|
static FluTheme* m_instance;
|
||||||
|
bool _dark;
|
||||||
|
bool eventFilter(QObject *obj, QEvent *event);
|
||||||
|
bool systemDark();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FLUTHEME_H
|
#endif // FLUTHEME_H
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
#include <QQuickWindow>
|
#include <QQuickWindow>
|
||||||
#include "FluColors.h"
|
#include "FluColors.h"
|
||||||
|
#include "NativeEventFilter.h"
|
||||||
#include "FluTheme.h"
|
#include "FluTheme.h"
|
||||||
#include "WindowHelper.h"
|
#include "WindowHelper.h"
|
||||||
#include "FluApp.h"
|
#include "FluApp.h"
|
||||||
@ -33,6 +34,11 @@ void Fluent::registerTypes(const char *uri){
|
|||||||
qmlRegisterType<WindowHelper>(uri,major,minor,"WindowHelper");
|
qmlRegisterType<WindowHelper>(uri,major,minor,"WindowHelper");
|
||||||
qmlRegisterType<FluColorSet>(uri,major,minor,"FluColorSet");
|
qmlRegisterType<FluColorSet>(uri,major,minor,"FluColorSet");
|
||||||
|
|
||||||
|
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluRatingControl.qml"),uri,major,minor,"FluRatingControl");
|
||||||
|
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluStatusView.qml"),uri,major,minor,"FluStatusView");
|
||||||
|
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluPagination.qml"),uri,major,minor,"FluPagination");
|
||||||
|
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluToggleButton.qml"),uri,major,minor,"FluToggleButton");
|
||||||
|
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluTableView.qml"),uri,major,minor,"FluTableView");
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluPivotItem.qml"),uri,major,minor,"FluPivotItem");
|
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluPivotItem.qml"),uri,major,minor,"FluPivotItem");
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluPivot.qml"),uri,major,minor,"FluPivot");
|
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluPivot.qml"),uri,major,minor,"FluPivot");
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluFlipView.qml"),uri,major,minor,"FluFlipView");
|
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluFlipView.qml"),uri,major,minor,"FluFlipView");
|
||||||
@ -82,15 +88,20 @@ void Fluent::registerTypes(const char *uri){
|
|||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluRadioButton.qml"),uri,major,minor,"FluRadioButton");
|
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluRadioButton.qml"),uri,major,minor,"FluRadioButton");
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluSlider.qml"),uri,major,minor,"FluSlider");
|
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluSlider.qml"),uri,major,minor,"FluSlider");
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluTextBox.qml"),uri,major,minor,"FluTextBox");
|
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluTextBox.qml"),uri,major,minor,"FluTextBox");
|
||||||
|
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluPasswordBox.qml"),uri,major,minor,"FluPasswordBox");
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluText.qml"),uri,major,minor,"FluText");
|
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluText.qml"),uri,major,minor,"FluText");
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluFilledButton.qml"),uri,major,minor,"FluFilledButton");
|
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluFilledButton.qml"),uri,major,minor,"FluFilledButton");
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluToggleSwitch.qml"),uri,major,minor,"FluToggleSwitch");
|
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluToggleSwitch.qml"),uri,major,minor,"FluToggleSwitch");
|
||||||
|
|
||||||
qmlRegisterUncreatableMetaObject(Fluent_Awesome::staticMetaObject, uri,major,minor,"FluentIcons", "Access to enums & flags only");
|
qmlRegisterUncreatableMetaObject(Fluent_Awesome::staticMetaObject, uri,major,minor,"FluentIcons", "Access to enums & flags only");
|
||||||
|
qmlRegisterUncreatableMetaObject(Fluent_DarkMode::staticMetaObject, uri,major,minor,"FluDarkMode", "Access to enums & flags only");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fluent::initializeEngine(QQmlEngine *engine, const char *uri)
|
void Fluent::initializeEngine(QQmlEngine *engine, const char *uri)
|
||||||
{
|
{
|
||||||
|
nativeEvent = new NativeEventFilter();
|
||||||
|
qApp->installNativeEventFilter(nativeEvent);
|
||||||
Q_UNUSED(engine)
|
Q_UNUSED(engine)
|
||||||
Q_UNUSED(uri)
|
Q_UNUSED(uri)
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
@ -3,17 +3,25 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QQmlEngine>
|
#include <QQmlEngine>
|
||||||
|
#include "NativeEventFilter.h"
|
||||||
|
|
||||||
class Fluent: public QObject
|
class Fluent: public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
Q_INVOKABLE QString version() const;
|
Q_INVOKABLE QString version() const;
|
||||||
|
~Fluent(){
|
||||||
|
if (nativeEvent != Q_NULLPTR) {
|
||||||
|
delete nativeEvent;
|
||||||
|
nativeEvent = Q_NULLPTR;
|
||||||
|
}
|
||||||
|
}
|
||||||
void registerTypes(const char *uri);
|
void registerTypes(const char *uri);
|
||||||
void initializeEngine(QQmlEngine *engine, const char *uri);
|
void initializeEngine(QQmlEngine *engine, const char *uri);
|
||||||
static Fluent *getInstance();
|
static Fluent *getInstance();
|
||||||
private:
|
private:
|
||||||
static Fluent* m_instance;
|
static Fluent* m_instance;
|
||||||
|
NativeEventFilter *nativeEvent = Q_NULLPTR;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FLUENT_H
|
#endif // FLUENT_H
|
||||||
|
@ -19,7 +19,7 @@ HEADERS += \
|
|||||||
FluTheme.h \
|
FluTheme.h \
|
||||||
Fluent.h \
|
Fluent.h \
|
||||||
FluentUI.h \
|
FluentUI.h \
|
||||||
FramelessView.h \
|
NativeEventFilter.h \
|
||||||
WindowHelper.h \
|
WindowHelper.h \
|
||||||
qml_plugin.h \
|
qml_plugin.h \
|
||||||
stdafx.h
|
stdafx.h
|
||||||
@ -33,16 +33,12 @@ SOURCES += \
|
|||||||
FluTheme.cpp \
|
FluTheme.cpp \
|
||||||
Fluent.cpp \
|
Fluent.cpp \
|
||||||
FluentUI.cpp \
|
FluentUI.cpp \
|
||||||
|
NativeEventFilter.cpp \
|
||||||
WindowHelper.cpp \
|
WindowHelper.cpp \
|
||||||
qml_plugin.cpp \
|
qml_plugin.cpp \
|
||||||
|
|
||||||
win32 {
|
win32 {
|
||||||
LIBS += -ldwmapi -luser32
|
LIBS += -ldwmapi -luser32
|
||||||
SOURCES += \
|
|
||||||
FramelessView_win.cpp
|
|
||||||
} else {
|
|
||||||
SOURCES += \
|
|
||||||
FramelessView_unix.cpp
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINES += VERSION_IN=\\\"1.0.0\\\"
|
DEFINES += VERSION_IN=\\\"1.0.0\\\"
|
||||||
|
@ -1,56 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QMouseEvent>
|
|
||||||
#include <QQuickView>
|
|
||||||
#include <QRegion>
|
|
||||||
|
|
||||||
class FramelessViewPrivate;
|
|
||||||
class FramelessView : public QQuickView
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
using Super = QQuickView;
|
|
||||||
Q_PROPERTY(bool isMax READ isMax NOTIFY isMaxChanged)
|
|
||||||
Q_PROPERTY(bool isFull READ isFull NOTIFY isFullChanged)
|
|
||||||
public:
|
|
||||||
explicit FramelessView(QWindow *parent = nullptr);
|
|
||||||
~FramelessView();
|
|
||||||
void moveToScreenCenter();
|
|
||||||
void closeDeleteLater();
|
|
||||||
bool isMax() const;
|
|
||||||
bool isFull() const;
|
|
||||||
QQuickItem *titleItem() const;
|
|
||||||
|
|
||||||
static QMap<WId,FramelessView*> *windowCache;
|
|
||||||
static QRect calcCenterGeo(const QRect &screenGeo, const QSize &normalSize);
|
|
||||||
public slots:
|
|
||||||
void setIsMax(bool isMax);
|
|
||||||
void setIsFull(bool isFull);
|
|
||||||
void setTitleItem(QQuickItem* item);
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void isMaxChanged(bool isMax);
|
|
||||||
void isFullChanged(bool isFull);
|
|
||||||
void mousePressed(int xPos, int yPos, int button);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void showEvent(QShowEvent *e) override;
|
|
||||||
void resizeEvent(QResizeEvent *e) override;
|
|
||||||
bool event(QEvent *ev) override;
|
|
||||||
# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) override;
|
|
||||||
# else
|
|
||||||
bool nativeEvent(const QByteArray &eventType, void *message, long *result) override;
|
|
||||||
# endif
|
|
||||||
void mousePressEvent(QMouseEvent* event) override
|
|
||||||
{
|
|
||||||
# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
emit mousePressed(event->position().x(), event->position().y(), event->button());
|
|
||||||
#else
|
|
||||||
emit mousePressed(event->x(), event->y(), event->button());
|
|
||||||
#endif
|
|
||||||
Super::mousePressEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
FramelessViewPrivate *d;
|
|
||||||
};
|
|
@ -1,138 +0,0 @@
|
|||||||
#include "FramelessView.h"
|
|
||||||
#include <QGuiApplication>
|
|
||||||
#include <QQuickItem>
|
|
||||||
#include <QScreen>
|
|
||||||
#include <QWindow>
|
|
||||||
#include <FluTheme.h>
|
|
||||||
|
|
||||||
class FramelessViewPrivate
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
bool m_isMax = false;
|
|
||||||
bool m_isFull = false;
|
|
||||||
bool m_deleteLater = false;
|
|
||||||
QQuickItem *m_titleItem = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
FramelessView::FramelessView(QWindow *parent) : Super(parent), d(new FramelessViewPrivate)
|
|
||||||
{
|
|
||||||
if(FluTheme::getInstance()->frameless()){
|
|
||||||
setFlags( Qt::Window | Qt::FramelessWindowHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
|
|
||||||
}
|
|
||||||
setResizeMode(SizeRootObjectToView);
|
|
||||||
setIsMax(windowState() == Qt::WindowMaximized);
|
|
||||||
setIsFull(windowState() == Qt::WindowFullScreen);
|
|
||||||
connect(this, &QWindow::windowStateChanged, this, [&](Qt::WindowState state) {
|
|
||||||
(void)state;
|
|
||||||
setIsMax(windowState() == Qt::WindowMaximized);
|
|
||||||
setIsFull(windowState() == Qt::WindowFullScreen);
|
|
||||||
});
|
|
||||||
connect(FluTheme::getInstance(),&FluTheme::framelessChanged,this,[=](){
|
|
||||||
setFlag(Qt::Window,false);
|
|
||||||
setFlag(Qt::Window,true);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
FramelessView::~FramelessView()
|
|
||||||
{
|
|
||||||
delete d;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FramelessView::showEvent(QShowEvent *e)
|
|
||||||
{
|
|
||||||
Super::showEvent(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
QRect FramelessView::calcCenterGeo(const QRect &screenGeo, const QSize &normalSize)
|
|
||||||
{
|
|
||||||
int w = normalSize.width();
|
|
||||||
int h = normalSize.height();
|
|
||||||
int x = screenGeo.x() + (screenGeo.width() - w) / 2;
|
|
||||||
int y = screenGeo.y() + (screenGeo.height() - h) / 2;
|
|
||||||
if (screenGeo.width() < w) {
|
|
||||||
x = screenGeo.x();
|
|
||||||
w = screenGeo.width();
|
|
||||||
}
|
|
||||||
if (screenGeo.height() < h) {
|
|
||||||
y = screenGeo.y();
|
|
||||||
h = screenGeo.height();
|
|
||||||
}
|
|
||||||
return { x, y, w, h };
|
|
||||||
}
|
|
||||||
|
|
||||||
void FramelessView::moveToScreenCenter()
|
|
||||||
{
|
|
||||||
auto geo = calcCenterGeo(screen()->availableGeometry(), size());
|
|
||||||
if (minimumWidth() > geo.width() || minimumHeight() > geo.height()) {
|
|
||||||
setMinimumSize(geo.size());
|
|
||||||
}
|
|
||||||
setGeometry(geo);
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void FramelessView::closeDeleteLater(){
|
|
||||||
d->m_deleteLater = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FramelessView::isMax() const
|
|
||||||
{
|
|
||||||
return d->m_isMax;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FramelessView::isFull() const
|
|
||||||
{
|
|
||||||
return d->m_isFull;
|
|
||||||
}
|
|
||||||
|
|
||||||
QQuickItem *FramelessView::titleItem() const
|
|
||||||
{
|
|
||||||
return d->m_titleItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FramelessView::setIsMax(bool isMax)
|
|
||||||
{
|
|
||||||
if (d->m_isMax == isMax)
|
|
||||||
return;
|
|
||||||
|
|
||||||
d->m_isMax = isMax;
|
|
||||||
emit isMaxChanged(d->m_isMax);
|
|
||||||
}
|
|
||||||
|
|
||||||
void FramelessView::setIsFull(bool isFull)
|
|
||||||
{
|
|
||||||
if(d->m_isFull == isFull)
|
|
||||||
return;
|
|
||||||
|
|
||||||
d->m_isFull = isFull;
|
|
||||||
emit isFullChanged(d->m_isFull);
|
|
||||||
}
|
|
||||||
|
|
||||||
void FramelessView::setTitleItem(QQuickItem *item)
|
|
||||||
{
|
|
||||||
d->m_titleItem = item;
|
|
||||||
}
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
bool FramelessView::nativeEvent(const QByteArray &eventType, void *message, qintptr *result)
|
|
||||||
#else
|
|
||||||
bool FramelessView::nativeEvent(const QByteArray &eventType, void *message, long *result)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
return Super::nativeEvent(eventType, message, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
void FramelessView::resizeEvent(QResizeEvent *e)
|
|
||||||
{
|
|
||||||
Super::resizeEvent(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FramelessView::event(QEvent *ev)
|
|
||||||
{
|
|
||||||
if (ev->type() == QEvent::Close) {
|
|
||||||
if(d->m_deleteLater){
|
|
||||||
deleteLater();
|
|
||||||
ev->setAccepted(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return QQuickWindow::event(ev);
|
|
||||||
}
|
|
||||||
|
|
@ -1,268 +0,0 @@
|
|||||||
#include "FramelessView.h"
|
|
||||||
#include <QGuiApplication>
|
|
||||||
#include <QQuickItem>
|
|
||||||
#include <QScreen>
|
|
||||||
#include <QWindow>
|
|
||||||
#include <FluTheme.h>
|
|
||||||
#include <QTimer>
|
|
||||||
|
|
||||||
#include <dwmapi.h>
|
|
||||||
#include <windowsx.h>
|
|
||||||
#pragma comment(lib, "Dwmapi.lib")
|
|
||||||
#pragma comment(lib, "User32.lib")
|
|
||||||
|
|
||||||
|
|
||||||
static bool isCompositionEnabled()
|
|
||||||
{
|
|
||||||
BOOL composition_enabled = FALSE;
|
|
||||||
bool success = ::DwmIsCompositionEnabled(&composition_enabled) == S_OK;
|
|
||||||
return composition_enabled && success;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool isMaxWin(QWindow* win)
|
|
||||||
{
|
|
||||||
return win->windowState() == Qt::WindowMaximized;
|
|
||||||
}
|
|
||||||
static bool isFullWin(QQuickView* win)
|
|
||||||
{
|
|
||||||
return win->windowState() == Qt::WindowFullScreen;
|
|
||||||
}
|
|
||||||
static bool isFixWin(QQuickView* win)
|
|
||||||
{
|
|
||||||
return win->minimumWidth() == win->maximumWidth() && win->minimumHeight() == win->maximumHeight();
|
|
||||||
}
|
|
||||||
static long hitTest(RECT winrect, long x, long y, int borderWidth)
|
|
||||||
{
|
|
||||||
if ((x >= winrect.left) && (x < winrect.left + borderWidth) && (y >= winrect.top) && (y < winrect.top + borderWidth))
|
|
||||||
{
|
|
||||||
return HTTOPLEFT;
|
|
||||||
}
|
|
||||||
else if (x < winrect.right && x >= winrect.right - borderWidth && y >= winrect.top && y < winrect.top + borderWidth)
|
|
||||||
{
|
|
||||||
return HTTOPRIGHT;
|
|
||||||
}
|
|
||||||
else if (x >= winrect.left && x < winrect.left + borderWidth && y < winrect.bottom && y >= winrect.bottom - borderWidth)
|
|
||||||
{
|
|
||||||
return HTBOTTOMLEFT;
|
|
||||||
}
|
|
||||||
else if (x < winrect.right && x >= winrect.right - borderWidth && y < winrect.bottom && y >= winrect.bottom - borderWidth)
|
|
||||||
{
|
|
||||||
return HTBOTTOMRIGHT;
|
|
||||||
}
|
|
||||||
else if (x >= winrect.left && x < winrect.left + borderWidth)
|
|
||||||
{
|
|
||||||
return HTLEFT;
|
|
||||||
}
|
|
||||||
else if (x < winrect.right && x >= winrect.right - borderWidth)
|
|
||||||
{
|
|
||||||
return HTRIGHT;
|
|
||||||
}
|
|
||||||
else if (y >= winrect.top && y < winrect.top + borderWidth)
|
|
||||||
{
|
|
||||||
return HTTOP;
|
|
||||||
}
|
|
||||||
else if (y < winrect.bottom && y >= winrect.bottom - borderWidth)
|
|
||||||
{
|
|
||||||
return HTBOTTOM;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class FramelessViewPrivate
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
bool m_isMax = false;
|
|
||||||
bool m_isFull = false;
|
|
||||||
bool m_deleteLater = false;
|
|
||||||
bool m_isFirst = true;
|
|
||||||
QQuickItem *m_titleItem = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
FramelessView::FramelessView(QWindow *parent) : Super(parent), d(new FramelessViewPrivate)
|
|
||||||
{
|
|
||||||
if(!isCompositionEnabled()){
|
|
||||||
FluTheme::getInstance()->frameless(false);
|
|
||||||
}
|
|
||||||
if(FluTheme::getInstance()->frameless()){
|
|
||||||
setFlag(Qt::FramelessWindowHint,true);
|
|
||||||
}
|
|
||||||
setResizeMode(SizeRootObjectToView);
|
|
||||||
setIsMax(windowState() == Qt::WindowMaximized);
|
|
||||||
setIsFull(windowState() == Qt::WindowFullScreen);
|
|
||||||
connect(this, &QWindow::windowStateChanged, this, [=](Qt::WindowState state) {
|
|
||||||
(void)state;
|
|
||||||
setIsMax(windowState() == Qt::WindowMaximized);
|
|
||||||
setIsFull(windowState() == Qt::WindowFullScreen);
|
|
||||||
});
|
|
||||||
connect(FluTheme::getInstance(),&FluTheme::framelessChanged,this,[=](){
|
|
||||||
setFlag(Qt::Window,false);
|
|
||||||
setFlag(Qt::Window,true);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
FramelessView::~FramelessView()
|
|
||||||
{
|
|
||||||
delete d;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FramelessView::showEvent(QShowEvent *e)
|
|
||||||
{
|
|
||||||
static const MARGINS shadow_state[2] { { 0, 0, 0, 0 }, { 1, 1, 1, 1 } };
|
|
||||||
::DwmExtendFrameIntoClientArea((HWND)(winId()), &shadow_state[true]);
|
|
||||||
if(FluTheme::getInstance()->frameless()){
|
|
||||||
setFlag(Qt::FramelessWindowHint,false);
|
|
||||||
}
|
|
||||||
Super::showEvent(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
QRect FramelessView::calcCenterGeo(const QRect &screenGeo, const QSize &normalSize)
|
|
||||||
{
|
|
||||||
int w = normalSize.width();
|
|
||||||
int h = normalSize.height();
|
|
||||||
int x = screenGeo.x() + (screenGeo.width() - w) / 2;
|
|
||||||
int y = screenGeo.y() + (screenGeo.height() - h) / 2;
|
|
||||||
if (screenGeo.width() < w) {
|
|
||||||
x = screenGeo.x();
|
|
||||||
w = screenGeo.width();
|
|
||||||
}
|
|
||||||
if (screenGeo.height() < h) {
|
|
||||||
y = screenGeo.y();
|
|
||||||
h = screenGeo.height();
|
|
||||||
}
|
|
||||||
return { x, y, w, h };
|
|
||||||
}
|
|
||||||
|
|
||||||
void FramelessView::moveToScreenCenter()
|
|
||||||
{
|
|
||||||
auto geo = calcCenterGeo(screen()->availableGeometry(), size());
|
|
||||||
if (minimumWidth() > geo.width() || minimumHeight() > geo.height()) {
|
|
||||||
setMinimumSize(geo.size());
|
|
||||||
}
|
|
||||||
setGeometry(geo);
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void FramelessView::closeDeleteLater(){
|
|
||||||
d->m_deleteLater = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FramelessView::isMax() const
|
|
||||||
{
|
|
||||||
return d->m_isMax;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FramelessView::isFull() const
|
|
||||||
{
|
|
||||||
return d->m_isFull;
|
|
||||||
}
|
|
||||||
|
|
||||||
QQuickItem *FramelessView::titleItem() const
|
|
||||||
{
|
|
||||||
return d->m_titleItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FramelessView::setIsMax(bool isMax)
|
|
||||||
{
|
|
||||||
if (d->m_isMax == isMax)
|
|
||||||
return;
|
|
||||||
|
|
||||||
d->m_isMax = isMax;
|
|
||||||
emit isMaxChanged(d->m_isMax);
|
|
||||||
}
|
|
||||||
|
|
||||||
void FramelessView::setIsFull(bool isFull)
|
|
||||||
{
|
|
||||||
if(d->m_isFull == isFull)
|
|
||||||
return;
|
|
||||||
|
|
||||||
d->m_isFull = isFull;
|
|
||||||
emit isFullChanged(d->m_isFull);
|
|
||||||
}
|
|
||||||
|
|
||||||
int count = 1;
|
|
||||||
|
|
||||||
void FramelessView::setTitleItem(QQuickItem *item)
|
|
||||||
{
|
|
||||||
d->m_titleItem = item;
|
|
||||||
}
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
bool FramelessView::nativeEvent(const QByteArray &eventType, void *message, qintptr *result)
|
|
||||||
#else
|
|
||||||
bool FramelessView::nativeEvent(const QByteArray &eventType, void *message, long *result)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
MSG* msg = static_cast<MSG*>(message);
|
|
||||||
if (!msg || !msg->hwnd)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (msg->message == WM_NCHITTEST && FluTheme::getInstance()->frameless())
|
|
||||||
{
|
|
||||||
RECT winrect;
|
|
||||||
GetWindowRect(HWND(winId()), &winrect);
|
|
||||||
long x = GET_X_LPARAM(msg->lParam);
|
|
||||||
long y = GET_Y_LPARAM(msg->lParam);
|
|
||||||
*result = 0;
|
|
||||||
if (!isMaxWin(this) && !isFullWin(this) && !isFixWin(this))
|
|
||||||
{
|
|
||||||
*result = hitTest(winrect, x, y, 4);
|
|
||||||
if (0 != *result)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else if (msg->message == WM_NCCALCSIZE && FluTheme::getInstance()->frameless())
|
|
||||||
{
|
|
||||||
const auto mode = static_cast<BOOL>(msg->wParam);
|
|
||||||
const auto clientRect = mode ? &(reinterpret_cast<LPNCCALCSIZE_PARAMS>(msg->lParam)->rgrc[0]) : reinterpret_cast<LPRECT>(msg->lParam);
|
|
||||||
if (mode == TRUE)
|
|
||||||
{
|
|
||||||
*result = WVR_REDRAW;
|
|
||||||
if (!isMaxWin(this) && !isFullWin(this))
|
|
||||||
{
|
|
||||||
if (clientRect->top != 0)
|
|
||||||
{
|
|
||||||
clientRect->top -= 0.1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (clientRect->top != 0)
|
|
||||||
{
|
|
||||||
clientRect->top += 0.1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}else if (msg->message == WM_WINDOWPOSCHANGING)
|
|
||||||
{
|
|
||||||
WINDOWPOS* wp = reinterpret_cast<WINDOWPOS*>(msg->lParam);
|
|
||||||
if (wp != nullptr && (wp->flags & SWP_NOSIZE) == 0)
|
|
||||||
{
|
|
||||||
wp->flags |= SWP_NOCOPYBITS;
|
|
||||||
*result = 0;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Super::nativeEvent(eventType, message, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
void FramelessView::resizeEvent(QResizeEvent *e)
|
|
||||||
{
|
|
||||||
Super::resizeEvent(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FramelessView::event(QEvent *ev)
|
|
||||||
{
|
|
||||||
if (ev->type() == QEvent::Close) {
|
|
||||||
if(d->m_deleteLater){
|
|
||||||
deleteLater();
|
|
||||||
ev->setAccepted(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return QQuickWindow::event(ev);
|
|
||||||
}
|
|
||||||
|
|
76
src/NativeEventFilter.cpp
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
#include "NativeEventFilter.h"
|
||||||
|
#include "FluTheme.h"
|
||||||
|
#include "FluApp.h"
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
#include <Windows.h>
|
||||||
|
#include <windowsx.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool NativeEventFilter::nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result)
|
||||||
|
{
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
if (eventType == "windows_generic_MSG" && FluTheme::getInstance()->frameless()) {
|
||||||
|
MSG* msg = static_cast<MSG *>(message);
|
||||||
|
if (msg == Q_NULLPTR)
|
||||||
|
return false;
|
||||||
|
switch(msg->message) {
|
||||||
|
case WM_NCCALCSIZE:{
|
||||||
|
NCCALCSIZE_PARAMS& params = *reinterpret_cast<NCCALCSIZE_PARAMS*>(msg->lParam);
|
||||||
|
if (params.rgrc[0].top != 0)
|
||||||
|
params.rgrc[0].top -= 1;
|
||||||
|
*result = WVR_REDRAW;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case WM_NCHITTEST: {
|
||||||
|
auto view = FluApp::getInstance()->wnds[(WId)msg->hwnd];
|
||||||
|
bool isResize = !(view->maximumWidth()==view->minimumWidth()&&view->maximumHeight()==view->minimumHeight());
|
||||||
|
const LONG borderWidth = 8;
|
||||||
|
RECT winrect;
|
||||||
|
GetWindowRect(msg->hwnd, &winrect);
|
||||||
|
long x = GET_X_LPARAM(msg->lParam);
|
||||||
|
long y = GET_Y_LPARAM(msg->lParam);
|
||||||
|
if (x >= winrect.left && x < winrect.left + borderWidth &&
|
||||||
|
y < winrect.bottom && y >= winrect.bottom - borderWidth && isResize) {
|
||||||
|
*result = HTBOTTOMLEFT;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (x < winrect.right && x >= winrect.right - borderWidth &&
|
||||||
|
y < winrect.bottom && y >= winrect.bottom - borderWidth && isResize) {
|
||||||
|
*result = HTBOTTOMRIGHT;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (x >= winrect.left && x < winrect.left + borderWidth &&
|
||||||
|
y >= winrect.top && y < winrect.top + borderWidth && isResize) {
|
||||||
|
*result = HTTOPLEFT;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (x < winrect.right && x >= winrect.right - borderWidth &&
|
||||||
|
y >= winrect.top && y < winrect.top + borderWidth && isResize) {
|
||||||
|
*result = HTTOPRIGHT;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (x >= winrect.left && x < winrect.left + borderWidth && isResize) {
|
||||||
|
*result = HTLEFT;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (x < winrect.right && x >= winrect.right - borderWidth && isResize) {
|
||||||
|
*result = HTRIGHT;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (y < winrect.bottom && y >= winrect.bottom - borderWidth && isResize) {
|
||||||
|
*result = HTBOTTOM;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (y >= winrect.top && y < winrect.top + borderWidth && isResize) {
|
||||||
|
*result = HTTOP;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return false;
|
||||||
|
}
|
14
src/NativeEventFilter.h
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#ifndef NATIVEEVENTFILTER_H
|
||||||
|
#define NATIVEEVENTFILTER_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QAbstractNativeEventFilter>
|
||||||
|
|
||||||
|
class NativeEventFilter : public QAbstractNativeEventFilter
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NATIVEEVENTFILTER_H
|
@ -1,6 +1,19 @@
|
|||||||
#include "WindowHelper.h"
|
#include "WindowHelper.h"
|
||||||
|
|
||||||
#include "FluRegister.h"
|
#include "FluRegister.h"
|
||||||
|
#include "FluApp.h"
|
||||||
|
#include "FluTheme.h"
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
#include <dwmapi.h>
|
||||||
|
#include <Windows.h>
|
||||||
|
#include <windowsx.h>
|
||||||
|
enum class Style : DWORD
|
||||||
|
{
|
||||||
|
windowed = (WS_OVERLAPPEDWINDOW | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_THICKFRAME | WS_CLIPCHILDREN),
|
||||||
|
aero_borderless = (WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_THICKFRAME | WS_CLIPCHILDREN)
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
WindowHelper::WindowHelper(QObject *parent)
|
WindowHelper::WindowHelper(QObject *parent)
|
||||||
: QObject{parent}
|
: QObject{parent}
|
||||||
@ -8,56 +21,38 @@ WindowHelper::WindowHelper(QObject *parent)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowHelper::setTitle(const QString& text){
|
void WindowHelper::initWindow(QQuickWindow* window){
|
||||||
window->setTitle(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
void WindowHelper::initWindow(FramelessView* window){
|
|
||||||
this->window = window;
|
this->window = window;
|
||||||
}
|
}
|
||||||
|
|
||||||
QJsonObject WindowHelper::getArgument(){
|
void WindowHelper::firstUpdate(){
|
||||||
return window->property("argument").toJsonObject();
|
if(isFisrt){
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
if(FluTheme::getInstance()->frameless()){
|
||||||
|
HWND wnd = (HWND)window->winId();
|
||||||
|
SetWindowLongPtr(wnd, GWL_STYLE, static_cast<LONG>(Style::aero_borderless));
|
||||||
|
const MARGINS shadow_on = { 1, 1, 1, 1 };
|
||||||
|
DwmExtendFrameIntoClientArea(wnd, &shadow_on);
|
||||||
|
SetWindowPos(wnd, Q_NULLPTR, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE);
|
||||||
|
ShowWindow(wnd, SW_SHOW);
|
||||||
|
window->setFlag(Qt::FramelessWindowHint,false);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
isFisrt = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant WindowHelper::getPageRegister(){
|
|
||||||
return window->property("pageRegister");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowHelper::setMinimumWidth(int width){
|
QVariant WindowHelper::createRegister(QQuickWindow* window,const QString& path){
|
||||||
this->window->setMinimumWidth(width);
|
FluRegister *p = new FluRegister(window);
|
||||||
}
|
p->from(window);
|
||||||
void WindowHelper::setMaximumWidth(int width){
|
|
||||||
this->window->setMaximumWidth(width);
|
|
||||||
}
|
|
||||||
void WindowHelper::setMinimumHeight(int height){
|
|
||||||
this->window->setMinimumHeight(height);
|
|
||||||
}
|
|
||||||
void WindowHelper::setMaximumHeight(int height){
|
|
||||||
this->window->setMaximumHeight(height);
|
|
||||||
}
|
|
||||||
void WindowHelper::updateWindow(){
|
|
||||||
this->window->setFlag(Qt::Window,false);
|
|
||||||
this->window->setFlag(Qt::Window,true);
|
|
||||||
}
|
|
||||||
void WindowHelper::setOpacity(qreal opacity){
|
|
||||||
this->window->setOpacity(opacity);
|
|
||||||
}
|
|
||||||
void WindowHelper::setModality(int type){
|
|
||||||
if(type == 0){
|
|
||||||
this->window->setModality(Qt::NonModal);
|
|
||||||
}else if(type == 1){
|
|
||||||
this->window->setModality(Qt::WindowModal);
|
|
||||||
}else if(type == 2){
|
|
||||||
this->window->setModality(Qt::ApplicationModal);
|
|
||||||
}else{
|
|
||||||
this->window->setModality(Qt::NonModal);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant WindowHelper::createRegister(const QString& path){
|
|
||||||
FluRegister *p = new FluRegister(this->window);
|
|
||||||
p->from(this->window);
|
|
||||||
p->path(path);
|
p->path(path);
|
||||||
return QVariant::fromValue(p);
|
return QVariant::fromValue(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowHelper::destoryWindow(){
|
||||||
|
if(this->window){
|
||||||
|
FluApp::getInstance()->wnds.remove(this->window->winId());
|
||||||
|
this->window->deleteLater();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
#include <QQuickItem>
|
#include <QQuickItem>
|
||||||
#include <QWindow>
|
#include <QWindow>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include "FramelessView.h"
|
|
||||||
|
|
||||||
class WindowHelper : public QObject
|
class WindowHelper : public QObject
|
||||||
{
|
{
|
||||||
@ -15,22 +14,15 @@ class WindowHelper : public QObject
|
|||||||
public:
|
public:
|
||||||
explicit WindowHelper(QObject *parent = nullptr);
|
explicit WindowHelper(QObject *parent = nullptr);
|
||||||
|
|
||||||
Q_INVOKABLE void initWindow(FramelessView* window);
|
Q_INVOKABLE void initWindow(QQuickWindow* window);
|
||||||
Q_INVOKABLE void setTitle(const QString& text);
|
Q_INVOKABLE void destoryWindow();
|
||||||
Q_INVOKABLE void setMinimumWidth(int width);
|
Q_INVOKABLE QVariant createRegister(QQuickWindow* window,const QString& path);
|
||||||
Q_INVOKABLE void setMaximumWidth(int width);
|
|
||||||
Q_INVOKABLE void setMinimumHeight(int height);
|
Q_INVOKABLE void firstUpdate();
|
||||||
Q_INVOKABLE void setMaximumHeight(int height);
|
|
||||||
Q_INVOKABLE QJsonObject getArgument();
|
|
||||||
Q_INVOKABLE QVariant getPageRegister();
|
|
||||||
Q_INVOKABLE void updateWindow();
|
|
||||||
Q_INVOKABLE void setOpacity(qreal opacity);
|
|
||||||
Q_INVOKABLE void setModality(int type);
|
|
||||||
Q_INVOKABLE QVariant createRegister(const QString& path);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FramelessView* window;
|
QQuickWindow* window;
|
||||||
|
bool isFisrt=true;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WINDOWHELPER_H
|
#endif // WINDOWHELPER_H
|
||||||
|
@ -24,6 +24,7 @@ Item {
|
|||||||
y: -Math.round(cursorHeight/2)
|
y: -Math.round(cursorHeight/2)
|
||||||
height: parent.height+cursorHeight
|
height: parent.height+cursorHeight
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
preventStealing: true
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
function handleMouse(mouse) {
|
function handleMouse(mouse) {
|
||||||
if (mouse.buttons & Qt.LeftButton) {
|
if (mouse.buttons & Qt.LeftButton) {
|
||||||
|
@ -67,7 +67,6 @@ Rectangle{
|
|||||||
height: root.height
|
height: root.height
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
||||||
|
|
||||||
RowLayout{
|
RowLayout{
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
Layout.rightMargin: 5
|
Layout.rightMargin: 5
|
||||||
@ -80,7 +79,11 @@ Rectangle{
|
|||||||
FluToggleSwitch{
|
FluToggleSwitch{
|
||||||
selected: FluTheme.dark
|
selected: FluTheme.dark
|
||||||
clickFunc:function(){
|
clickFunc:function(){
|
||||||
FluTheme.dark = !FluTheme.dark
|
if(FluTheme.dark){
|
||||||
|
FluTheme.darkMode = FluDarkMode.Light
|
||||||
|
}else{
|
||||||
|
FluTheme.darkMode = FluDarkMode.Dark
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
@ -5,6 +5,7 @@ import FluentUI
|
|||||||
FluTextBox{
|
FluTextBox{
|
||||||
property var items:[]
|
property var items:[]
|
||||||
property string emptyText: "没有找到结果"
|
property string emptyText: "没有找到结果"
|
||||||
|
property int autoSuggestBoxReplacement: FluentIcons.Search
|
||||||
signal itemClicked(var data)
|
signal itemClicked(var data)
|
||||||
signal handleClicked
|
signal handleClicked
|
||||||
QtObject{
|
QtObject{
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Controls.Basic
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
@ -43,11 +44,17 @@ Button {
|
|||||||
if(disabled){
|
if(disabled){
|
||||||
return Qt.rgba(131/255,131/255,131/255,1)
|
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)
|
return Qt.rgba(1,1,1,1)
|
||||||
}else{
|
}else{
|
||||||
if(disabled){
|
if(disabled){
|
||||||
return Qt.rgba(160/255,160/255,160/255,1)
|
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)
|
return Qt.rgba(0,0,0,1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,21 +67,26 @@ Rectangle {
|
|||||||
modal: true
|
modal: true
|
||||||
dim:false
|
dim:false
|
||||||
enter: Transition {
|
enter: Transition {
|
||||||
NumberAnimation {
|
reversible: true
|
||||||
property: "y"
|
|
||||||
from:0
|
|
||||||
to:popup.y
|
|
||||||
duration: 150
|
|
||||||
}
|
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
property: "opacity"
|
property: "opacity"
|
||||||
from:0
|
from:0
|
||||||
to:1
|
to:1
|
||||||
duration: 150
|
duration: 83
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exit:Transition {
|
||||||
|
NumberAnimation {
|
||||||
|
property: "opacity"
|
||||||
|
from:1
|
||||||
|
to:0
|
||||||
|
duration: 83
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
contentItem: Item{
|
contentItem: Item{
|
||||||
anchors.fill: parent
|
clip: true
|
||||||
FluCalendarView{
|
FluCalendarView{
|
||||||
id:container
|
id:container
|
||||||
onDateClicked:
|
onDateClicked:
|
||||||
@ -94,15 +99,19 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
background: Item{}
|
background: Item{
|
||||||
|
FluShadow{
|
||||||
|
radius: 5
|
||||||
|
}
|
||||||
|
}
|
||||||
function showPopup() {
|
function showPopup() {
|
||||||
var pos = control.mapToItem(null, 0, 0)
|
var pos = control.mapToItem(null, 0, 0)
|
||||||
if(window.height>pos.y+control.height+popup.height){
|
if(window.height>pos.y+control.height+container.height){
|
||||||
popup.y = control.height
|
popup.y = control.height
|
||||||
} else if(pos.y>popup.height){
|
} else if(pos.y>container.height){
|
||||||
popup.y = -popup.height
|
popup.y = -container.height
|
||||||
} else {
|
} else {
|
||||||
popup.y = window.height-(pos.y+popup.height)
|
popup.y = window.height-(pos.y+container.height)
|
||||||
}
|
}
|
||||||
popup.x = -(popup.width-control.width)/2
|
popup.x = -(popup.width-control.width)/2
|
||||||
popup.open()
|
popup.open()
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Controls.Basic
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
@ -12,10 +13,13 @@ Button {
|
|||||||
property color borderSelectedColor: FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
property color borderSelectedColor: FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
||||||
property color borderHoverColor: FluTheme.dark ? Qt.rgba(167/255,167/255,167/255,1) : Qt.rgba(135/255,135/255,135/255,1)
|
property color borderHoverColor: FluTheme.dark ? Qt.rgba(167/255,167/255,167/255,1) : Qt.rgba(135/255,135/255,135/255,1)
|
||||||
property color borderDisableColor: FluTheme.dark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1)
|
property color borderDisableColor: FluTheme.dark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1)
|
||||||
|
property color borderPressedColor: FluTheme.dark ? Qt.rgba(90/255,90/255,90/255,1) : Qt.rgba(191/255,191/255,191/255,1)
|
||||||
|
|
||||||
property color normalColor: FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(247/255,247/255,247/255,1)
|
property color normalColor: FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(247/255,247/255,247/255,1)
|
||||||
property color selectedColor: FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
property color selectedColor: FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
||||||
property color hoverColor: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(244/255,244/255,244/255,1)
|
property color hoverColor: FluTheme.dark ? Qt.rgba(72/255,72/255,72/255,1) : Qt.rgba(236/255,236/255,236/255,1)
|
||||||
property color selectedHoverColor: FluTheme.dark ? Qt.darker(selectedColor,1.1) : Qt.lighter(selectedColor,1.1)
|
property color selectedHoverColor: FluTheme.dark ? Qt.darker(selectedColor,1.15) : Qt.lighter(selectedColor,1.15)
|
||||||
|
property color selectedPreesedColor: FluTheme.dark ? Qt.darker(selectedColor,1.3) : Qt.lighter(selectedColor,1.3)
|
||||||
property color selectedDisableColor: FluTheme.dark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1)
|
property color selectedDisableColor: 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)
|
||||||
|
|
||||||
@ -52,6 +56,9 @@ Button {
|
|||||||
if(selected){
|
if(selected){
|
||||||
return borderSelectedColor
|
return borderSelectedColor
|
||||||
}
|
}
|
||||||
|
if(pressed){
|
||||||
|
return borderPressedColor
|
||||||
|
}
|
||||||
if(hovered){
|
if(hovered){
|
||||||
return borderHoverColor
|
return borderHoverColor
|
||||||
}
|
}
|
||||||
@ -63,6 +70,9 @@ Button {
|
|||||||
if(disabled){
|
if(disabled){
|
||||||
return selectedDisableColor
|
return selectedDisableColor
|
||||||
}
|
}
|
||||||
|
if(pressed){
|
||||||
|
return selectedPreesedColor
|
||||||
|
}
|
||||||
if(hovered){
|
if(hovered){
|
||||||
return selectedHoverColor
|
return selectedHoverColor
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Controls.Basic
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
|
|
||||||
Button{
|
Button{
|
||||||
id:control
|
id:control
|
||||||
width: 36
|
width: 36
|
||||||
@ -34,34 +34,42 @@ Button{
|
|||||||
height: container.height
|
height: container.height
|
||||||
width: container.width
|
width: container.width
|
||||||
contentItem: Item{
|
contentItem: Item{
|
||||||
anchors.fill: parent
|
clip: true
|
||||||
FluColorView{
|
FluColorView{
|
||||||
id:container
|
id:container
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
background:Item{}
|
background:Item{
|
||||||
enter: Transition {
|
FluShadow{
|
||||||
NumberAnimation {
|
radius: 5
|
||||||
property: "y"
|
|
||||||
from:0
|
|
||||||
to:popup.y
|
|
||||||
duration: 150
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
enter: Transition {
|
||||||
|
reversible: true
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
property: "opacity"
|
property: "opacity"
|
||||||
from:0
|
from:0
|
||||||
to:1
|
to:1
|
||||||
duration: 150
|
duration: 83
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exit:Transition {
|
||||||
|
NumberAnimation {
|
||||||
|
property: "opacity"
|
||||||
|
from:1
|
||||||
|
to:0
|
||||||
|
duration: 83
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function showPopup() {
|
function showPopup() {
|
||||||
var pos = control.mapToItem(null, 0, 0)
|
var pos = control.mapToItem(null, 0, 0)
|
||||||
if(window.height>pos.y+control.height+popup.height){
|
if(window.height>pos.y+control.height+container.height){
|
||||||
popup.y = control.height
|
popup.y = control.height
|
||||||
} else if(pos.y>popup.height){
|
} else if(pos.y>container.height){
|
||||||
popup.y = -popup.height
|
popup.y = -container.height
|
||||||
} else {
|
} else {
|
||||||
popup.y = window.height-(pos.y+popup.height)
|
popup.y = window.height-(pos.y+container.height)
|
||||||
}
|
}
|
||||||
popup.x = -(popup.width-control.width)/2
|
popup.x = -(popup.width-control.width)/2
|
||||||
popup.open()
|
popup.open()
|
||||||
|
@ -7,11 +7,19 @@ Popup {
|
|||||||
id: popup
|
id: popup
|
||||||
|
|
||||||
property string title: "Title"
|
property string title: "Title"
|
||||||
property string message: "Messaeg"
|
property string message: "Message"
|
||||||
|
property string neutralText: "Neutral"
|
||||||
property string negativeText: "Negative"
|
property string negativeText: "Negative"
|
||||||
property string positiveText: "Positive"
|
property string positiveText: "Positive"
|
||||||
|
signal neutralClicked
|
||||||
signal negativeClicked
|
signal negativeClicked
|
||||||
signal positiveClicked
|
signal positiveClicked
|
||||||
|
enum ButtonFlag{
|
||||||
|
NegativeButton=1
|
||||||
|
,NeutralButton=2
|
||||||
|
,PositiveButton=4
|
||||||
|
}
|
||||||
|
property int buttonFlags: FluContentDialog.NegativeButton | FluContentDialog.PositiveButton
|
||||||
property var minWidth: {
|
property var minWidth: {
|
||||||
if(Window.window==null)
|
if(Window.window==null)
|
||||||
return 400
|
return 400
|
||||||
@ -74,21 +82,31 @@ Popup {
|
|||||||
right: parent.right
|
right: parent.right
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
RowLayout{
|
||||||
id:divider
|
anchors
|
||||||
width: 1
|
{
|
||||||
height: parent.height
|
centerIn: parent
|
||||||
anchors.centerIn: parent
|
margins: spacing
|
||||||
|
fill: parent
|
||||||
|
}
|
||||||
|
spacing: 15
|
||||||
|
FluButton{
|
||||||
|
id:neutral_btn
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: true
|
||||||
|
visible: popup.buttonFlags&FluContentDialog.NeutralButton
|
||||||
|
text: neutralText
|
||||||
|
onClicked: {
|
||||||
|
popup.close()
|
||||||
|
neutralClicked()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluButton{
|
FluButton{
|
||||||
anchors{
|
id:negative_btn
|
||||||
left: parent.left
|
Layout.fillWidth: true
|
||||||
leftMargin: 20
|
Layout.fillHeight: true
|
||||||
rightMargin: 10
|
visible: popup.buttonFlags&FluContentDialog.NegativeButton
|
||||||
right: divider.left
|
|
||||||
verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
text: negativeText
|
text: negativeText
|
||||||
onClicked: {
|
onClicked: {
|
||||||
popup.close()
|
popup.close()
|
||||||
@ -97,13 +115,10 @@ Popup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
FluFilledButton{
|
FluFilledButton{
|
||||||
anchors{
|
id:positive_btn
|
||||||
right: parent.right
|
Layout.fillWidth: true
|
||||||
left: divider.right
|
Layout.fillHeight: true
|
||||||
rightMargin: 20
|
visible: popup.buttonFlags&FluContentDialog.PositiveButton
|
||||||
leftMargin: 10
|
|
||||||
verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
text: positiveText
|
text: positiveText
|
||||||
onClicked: {
|
onClicked: {
|
||||||
popup.close()
|
popup.close()
|
||||||
@ -113,3 +128,4 @@ Popup {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -100,28 +100,39 @@ Rectangle {
|
|||||||
Menu{
|
Menu{
|
||||||
id:popup
|
id:popup
|
||||||
modal: true
|
modal: true
|
||||||
width: 300
|
width: container.width
|
||||||
height: 340
|
height: container.height
|
||||||
dim:false
|
dim:false
|
||||||
enter: Transition {
|
enter: Transition {
|
||||||
NumberAnimation {
|
reversible: true
|
||||||
property: "y"
|
|
||||||
from:0
|
|
||||||
to:popup.y
|
|
||||||
duration: 150
|
|
||||||
}
|
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
property: "opacity"
|
property: "opacity"
|
||||||
from:0
|
from:0
|
||||||
to:1
|
to:1
|
||||||
duration: 150
|
duration: 83
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
background:Item{}
|
|
||||||
contentItem: Rectangle{
|
exit:Transition {
|
||||||
|
NumberAnimation {
|
||||||
|
property: "opacity"
|
||||||
|
from:1
|
||||||
|
to:0
|
||||||
|
duration: 83
|
||||||
|
}
|
||||||
|
}
|
||||||
|
background:Item{
|
||||||
|
FluShadow{
|
||||||
|
radius: 4
|
||||||
|
}
|
||||||
|
}
|
||||||
|
contentItem: Item{
|
||||||
|
clip: true
|
||||||
|
Rectangle{
|
||||||
id:container
|
id:container
|
||||||
radius: 4
|
radius: 4
|
||||||
anchors.fill: parent
|
width: 300
|
||||||
|
height: 340
|
||||||
color: FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1)
|
color: FluTheme.dark ? Qt.rgba(51/255,48/255,48/255,1) : Qt.rgba(248/255,250/255,253/255,1)
|
||||||
MouseArea{
|
MouseArea{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@ -338,6 +349,7 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
y:35
|
y:35
|
||||||
function showPopup() {
|
function showPopup() {
|
||||||
changeFlag = true
|
changeFlag = true
|
||||||
@ -362,12 +374,12 @@ Rectangle {
|
|||||||
text_day.text = day
|
text_day.text = day
|
||||||
|
|
||||||
var pos = root.mapToItem(null, 0, 0)
|
var pos = root.mapToItem(null, 0, 0)
|
||||||
if(window.height>pos.y+root.height+popup.height){
|
if(window.height>pos.y+root.height+container.height){
|
||||||
popup.y = root.height
|
popup.y = root.height
|
||||||
} else if(pos.y>popup.height){
|
} else if(pos.y>container.height){
|
||||||
popup.y = -popup.height
|
popup.y = -container.height
|
||||||
} else {
|
} else {
|
||||||
popup.y = window.height-(pos.y+popup.height)
|
popup.y = window.height-(pos.y+container.height)
|
||||||
}
|
}
|
||||||
popup.open()
|
popup.open()
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Controls.Basic
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
@ -58,11 +59,17 @@ Button {
|
|||||||
if(disabled){
|
if(disabled){
|
||||||
return Qt.rgba(131/255,131/255,131/255,1)
|
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)
|
return Qt.rgba(1,1,1,1)
|
||||||
}else{
|
}else{
|
||||||
if(disabled){
|
if(disabled){
|
||||||
return Qt.rgba(160/255,160/255,160/255,1)
|
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)
|
return Qt.rgba(0,0,0,1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -70,12 +77,13 @@ Button {
|
|||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
var pos = control.mapToItem(null, 0, 0)
|
var pos = control.mapToItem(null, 0, 0)
|
||||||
if(window.height>pos.y+control.height+menu.height){
|
var containerHeight = menu.getContainerHeight()
|
||||||
|
if(window.height>pos.y+control.height+containerHeight){
|
||||||
menu.y = control.height
|
menu.y = control.height
|
||||||
}else if(pos.y>menu.height){
|
}else if(pos.y>containerHeight){
|
||||||
menu.y = -menu.height
|
menu.y = -containerHeight
|
||||||
}else{
|
}else{
|
||||||
menu.y = window.height-(pos.y+menu.height)
|
menu.y = window.height-(pos.y+containerHeight)
|
||||||
}
|
}
|
||||||
menu.open()
|
menu.open()
|
||||||
}
|
}
|
||||||
|