mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-07-06 02:15:23 +08:00
Compare commits
21 Commits
Author | SHA1 | Date | |
---|---|---|---|
36ac017e3d | |||
981445630b | |||
9494ec4ac6 | |||
d71441e7c5 | |||
9f0b8c5ec5 | |||
94c0356c25 | |||
9e73f33877 | |||
adc8040604 | |||
82d1edc43c | |||
da17b31be7 | |||
67518fb4e6 | |||
2bd03ad9d8 | |||
e16a8d6b09 | |||
9e0050be63 | |||
a4398d1a2f | |||
a27e5db032 | |||
f7c17a27b6 | |||
020a75ac93 | |||
1b0cdd6152 | |||
1a9cca4300 | |||
d939546f31 |
2
.github/workflows/ubuntu.yml
vendored
2
.github/workflows/ubuntu.yml
vendored
@ -56,7 +56,7 @@ jobs:
|
|||||||
- name: package
|
- name: package
|
||||||
run: |
|
run: |
|
||||||
# make sure Qt plugin finds QML sources so it can deploy the imported files
|
# make sure Qt plugin finds QML sources so it can deploy the imported files
|
||||||
export QML_SOURCES_PATHS=src
|
export QML_SOURCES_PATHS=./
|
||||||
# 拷贝依赖
|
# 拷贝依赖
|
||||||
linuxdeploy-x86_64.AppImage --plugin=qt --output=appimage --create-desktop-file --icon-file=${targetName}.svg --executable=bin/release/${targetName} --appdir bin/release/
|
linuxdeploy-x86_64.AppImage --plugin=qt --output=appimage --create-desktop-file --icon-file=${targetName}.svg --executable=bin/release/${targetName} --appdir bin/release/
|
||||||
mv ${{ env.targetName }}-*.AppImage ${{ env.targetName }}.AppImage
|
mv ${{ env.targetName }}-*.AppImage ${{ env.targetName }}.AppImage
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Window
|
|
||||||
import QtQuick.Controls
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import FluentUI
|
|
||||||
|
|
||||||
Window {
|
|
||||||
id:app
|
|
||||||
Component.onCompleted: {
|
|
||||||
FluApp.init(app)
|
|
||||||
FluTheme.frameless = ("windows" === Qt.platform.os)
|
|
||||||
FluTheme.darkMode = FluDarkMode.System
|
|
||||||
FluApp.routes = {
|
|
||||||
"/":"qrc:/page/MainPage.qml",
|
|
||||||
"/about":"qrc:/page/AboutPage.qml",
|
|
||||||
"/login":"qrc:/page/LoginPage.qml",
|
|
||||||
"/chat":"qrc:/page/ChatPage.qml",
|
|
||||||
"/media":"qrc:/page/MediaPage.qml",
|
|
||||||
"/singleTaskWindow":"qrc:/page/SingleTaskWindow.qml",
|
|
||||||
"/standardWindow":"qrc:/page/StandardWindow.qml",
|
|
||||||
"/singleInstanceWindow":"qrc:/page/SingleInstanceWindow.qml"
|
|
||||||
}
|
|
||||||
FluApp.initialRoute = "/"
|
|
||||||
FluApp.run()
|
|
||||||
}
|
|
||||||
}
|
|
@ -24,14 +24,23 @@ endif()
|
|||||||
find_package(Qt6 COMPONENTS Core Quick QuickControls2 Concurrent Network Multimedia REQUIRED)
|
find_package(Qt6 COMPONENTS Core Quick QuickControls2 Concurrent Network Multimedia REQUIRED)
|
||||||
|
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
ChatController.cpp
|
src/controller/ChatController.cpp
|
||||||
AppInfo.cpp
|
src/AppInfo.cpp
|
||||||
main.cpp
|
src/main.cpp
|
||||||
|
src/lang/Lang.cpp
|
||||||
|
src/lang/Zh.cpp
|
||||||
|
src/lang/En.cpp
|
||||||
|
src/tool/IPC.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(HEADERS
|
set(HEADERS
|
||||||
ChatController.h
|
src/controller/ChatController.h
|
||||||
AppInfo.h
|
src/AppInfo.h
|
||||||
|
src/stdafx.h
|
||||||
|
src/lang/Lang.h
|
||||||
|
src/lang/Zh.h
|
||||||
|
src/lang/En.h
|
||||||
|
src/tool/IPC.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(RESOURCES
|
set(RESOURCES
|
||||||
|
@ -3,20 +3,22 @@ CONFIG += c++17
|
|||||||
DEFINES += QT_DEPRECATED_WARNINGS QT_NO_WARNING_OUTPUT
|
DEFINES += QT_DEPRECATED_WARNINGS QT_NO_WARNING_OUTPUT
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
lang/En.h \
|
src/lang/En.h \
|
||||||
lang/Lang.h \
|
src/lang/Lang.h \
|
||||||
lang/Zh.h \
|
src/lang/Zh.h \
|
||||||
stdafx.h \
|
src/stdafx.h \
|
||||||
ChatController.h \
|
src/controller/ChatController.h \
|
||||||
AppInfo.h
|
src/AppInfo.h \
|
||||||
|
src/tool/IPC.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
ChatController.cpp \
|
src/controller/ChatController.cpp \
|
||||||
AppInfo.cpp \
|
src/AppInfo.cpp \
|
||||||
lang/En.cpp \
|
src/lang/En.cpp \
|
||||||
lang/Lang.cpp \
|
src/lang/Lang.cpp \
|
||||||
lang/Zh.cpp \
|
src/lang/Zh.cpp \
|
||||||
main.cpp
|
src/main.cpp \
|
||||||
|
src/tool/IPC.cpp
|
||||||
|
|
||||||
RESOURCES += qml.qrc
|
RESOURCES += qml.qrc
|
||||||
|
|
||||||
@ -50,3 +52,8 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin
|
|||||||
mac: {
|
mac: {
|
||||||
QMAKE_INFO_PLIST = Info.plist
|
QMAKE_INFO_PLIST = Info.plist
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#### 如果你正在使用静态库,请将将下面的配置注释取消掉。
|
||||||
|
#DEFINES += STATICLIB
|
||||||
|
#INCLUDEPATH += $$OUT_PWD/../bin/FluentUI/
|
||||||
|
#LIBS += -L$$OUT_PWD/../bin/FluentUI/ -lFluentUI
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/">
|
<qresource prefix="/">
|
||||||
<file>App.qml</file>
|
|
||||||
<file>res/image/image_huoyin.webp</file>
|
<file>res/image/image_huoyin.webp</file>
|
||||||
<file>res/svg/avatar_1.svg</file>
|
<file>res/svg/avatar_1.svg</file>
|
||||||
<file>res/svg/avatar_2.svg</file>
|
<file>res/svg/avatar_2.svg</file>
|
||||||
@ -14,40 +13,11 @@
|
|||||||
<file>res/svg/avatar_10.svg</file>
|
<file>res/svg/avatar_10.svg</file>
|
||||||
<file>res/svg/avatar_11.svg</file>
|
<file>res/svg/avatar_11.svg</file>
|
||||||
<file>res/svg/avatar_12.svg</file>
|
<file>res/svg/avatar_12.svg</file>
|
||||||
<file>page/AboutPage.qml</file>
|
|
||||||
<file>page/MainPage.qml</file>
|
|
||||||
<file>page/LoginPage.qml</file>
|
|
||||||
<file>T_ToggleSwitch.qml</file>
|
|
||||||
<file>T_Typography.qml</file>
|
|
||||||
<file>T_Awesome.qml</file>
|
|
||||||
<file>T_Buttons.qml</file>
|
|
||||||
<file>T_Rectangle.qml</file>
|
|
||||||
<file>T_InfoBar.qml</file>
|
|
||||||
<file>T_Progress.qml</file>
|
|
||||||
<file>T_Slider.qml</file>
|
|
||||||
<file>T_TextBox.qml</file>
|
|
||||||
<file>T_Theme.qml</file>
|
|
||||||
<file>T_Dialog.qml</file>
|
|
||||||
<file>T_TreeView.qml</file>
|
|
||||||
<file>T_Expander.qml</file>
|
|
||||||
<file>T_TimePicker.qml</file>
|
|
||||||
<file>T_DatePicker.qml</file>
|
|
||||||
<file>T_MultiWindow.qml</file>
|
|
||||||
<file>T_Menu.qml</file>
|
|
||||||
<file>res/image/banner_1.jpg</file>
|
<file>res/image/banner_1.jpg</file>
|
||||||
<file>res/image/banner_2.jpg</file>
|
<file>res/image/banner_2.jpg</file>
|
||||||
<file>res/image/banner_3.jpg</file>
|
<file>res/image/banner_3.jpg</file>
|
||||||
<file>res/image/logo_openai.png</file>
|
<file>res/image/logo_openai.png</file>
|
||||||
<file>page/ChatPage.qml</file>
|
|
||||||
<file>T_Tooltip.qml</file>
|
|
||||||
<file>T_Badge.qml</file>
|
|
||||||
<file>T_CalendarPicker.qml</file>
|
|
||||||
<file>T_ColorPicker.qml</file>
|
|
||||||
<file>T_Carousel.qml</file>
|
|
||||||
<file>T_MediaPlayer.qml</file>
|
|
||||||
<file>T_TabView.qml</file>
|
|
||||||
<file>res/image/favicon.ico</file>
|
<file>res/image/favicon.ico</file>
|
||||||
<file>T_Home.qml</file>
|
|
||||||
<file>res/image/bg_home_header.png</file>
|
<file>res/image/bg_home_header.png</file>
|
||||||
<file>res/image/ic_home_github.png</file>
|
<file>res/image/ic_home_github.png</file>
|
||||||
<file>res/image/control/Acrylic.png</file>
|
<file>res/image/control/Acrylic.png</file>
|
||||||
@ -148,25 +118,56 @@
|
|||||||
<file>res/image/control/Viewbox.png</file>
|
<file>res/image/control/Viewbox.png</file>
|
||||||
<file>res/image/control/WebView.png</file>
|
<file>res/image/control/WebView.png</file>
|
||||||
<file>res/image/control/XamlUICommand.png</file>
|
<file>res/image/control/XamlUICommand.png</file>
|
||||||
<file>T_CheckBox.qml</file>
|
|
||||||
<file>global/ItemsOriginal.qml</file>
|
|
||||||
<file>global/qmldir</file>
|
|
||||||
<file>global/ItemsFooter.qml</file>
|
|
||||||
<file>page/MediaPage.qml</file>
|
|
||||||
<file>T_FlipView.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.svg</file>
|
||||||
<file>res/svg/home_dark.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_wx.jpg</file>
|
||||||
<file>res/image/qrcode_zfb.jpg</file>
|
<file>res/image/qrcode_zfb.jpg</file>
|
||||||
|
<file>qml/component/CodeExpander.qml</file>
|
||||||
|
<file>qml/global/ItemsFooter.qml</file>
|
||||||
|
<file>qml/global/ItemsOriginal.qml</file>
|
||||||
|
<file>qml/global/MainEvent.qml</file>
|
||||||
|
<file>qml/global/qmldir</file>
|
||||||
|
<file>qml/App.qml</file>
|
||||||
|
<file>qml/window/AboutWindow.qml</file>
|
||||||
|
<file>qml/window/ChatWindow.qml</file>
|
||||||
|
<file>qml/window/LoginWindow.qml</file>
|
||||||
|
<file>qml/window/MainWindow.qml</file>
|
||||||
|
<file>qml/window/MediaWindow.qml</file>
|
||||||
|
<file>qml/window/SingleInstanceWindow.qml</file>
|
||||||
|
<file>qml/window/SingleTaskWindow.qml</file>
|
||||||
|
<file>qml/window/StandardWindow.qml</file>
|
||||||
|
<file>qml/page/T_Awesome.qml</file>
|
||||||
|
<file>qml/page/T_Badge.qml</file>
|
||||||
|
<file>qml/page/T_Buttons.qml</file>
|
||||||
|
<file>qml/page/T_CalendarPicker.qml</file>
|
||||||
|
<file>qml/page/T_Carousel.qml</file>
|
||||||
|
<file>qml/page/T_CheckBox.qml</file>
|
||||||
|
<file>qml/page/T_ColorPicker.qml</file>
|
||||||
|
<file>qml/page/T_DatePicker.qml</file>
|
||||||
|
<file>qml/page/T_Dialog.qml</file>
|
||||||
|
<file>qml/page/T_Expander.qml</file>
|
||||||
|
<file>qml/page/T_FlipView.qml</file>
|
||||||
|
<file>qml/page/T_Home.qml</file>
|
||||||
|
<file>qml/page/T_InfoBar.qml</file>
|
||||||
|
<file>qml/page/T_MediaPlayer.qml</file>
|
||||||
|
<file>qml/page/T_Menu.qml</file>
|
||||||
|
<file>qml/page/T_MultiWindow.qml</file>
|
||||||
|
<file>qml/page/T_Pivot.qml</file>
|
||||||
|
<file>qml/page/T_Progress.qml</file>
|
||||||
|
<file>qml/page/T_RatingControl.qml</file>
|
||||||
|
<file>qml/page/T_Rectangle.qml</file>
|
||||||
|
<file>qml/page/T_Settings.qml</file>
|
||||||
|
<file>qml/page/T_Slider.qml</file>
|
||||||
|
<file>qml/page/T_StatusView.qml</file>
|
||||||
|
<file>qml/page/T_TableView.qml</file>
|
||||||
|
<file>qml/page/T_TabView.qml</file>
|
||||||
|
<file>qml/page/T_TextBox.qml</file>
|
||||||
|
<file>qml/page/T_Theme.qml</file>
|
||||||
|
<file>qml/page/T_TimePicker.qml</file>
|
||||||
|
<file>qml/page/T_ToggleSwitch.qml</file>
|
||||||
|
<file>qml/page/T_Tooltip.qml</file>
|
||||||
|
<file>qml/page/T_TreeView.qml</file>
|
||||||
|
<file>qml/page/T_Typography.qml</file>
|
||||||
|
<file>qml/page/T_BreadcrumbBar.qml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
26
example/qml/App.qml
Normal file
26
example/qml/App.qml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Window
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import FluentUI
|
||||||
|
|
||||||
|
Window {
|
||||||
|
id:app
|
||||||
|
Component.onCompleted: {
|
||||||
|
FluApp.init(app)
|
||||||
|
FluTheme.frameless = ("windows" === Qt.platform.os)
|
||||||
|
FluTheme.darkMode = FluDarkMode.System
|
||||||
|
FluApp.routes = {
|
||||||
|
"/":"qrc:/qml/window/MainWindow.qml",
|
||||||
|
"/about":"qrc:/qml/window/AboutWindow.qml",
|
||||||
|
"/login":"qrc:/qml/window/LoginWindow.qml",
|
||||||
|
"/chat":"qrc:/qml/window/ChatWindow.qml",
|
||||||
|
"/media":"qrc:/qml/window/MediaWindow.qml",
|
||||||
|
"/singleTaskWindow":"qrc:/qml/window/SingleTaskWindow.qml",
|
||||||
|
"/standardWindow":"qrc:/qml/window/StandardWindow.qml",
|
||||||
|
"/singleInstanceWindow":"qrc:/qml/window/SingleInstanceWindow.qml"
|
||||||
|
}
|
||||||
|
FluApp.initialRoute = "/"
|
||||||
|
FluApp.run()
|
||||||
|
}
|
||||||
|
}
|
@ -119,7 +119,8 @@ FluExpander{
|
|||||||
"FluTheme",
|
"FluTheme",
|
||||||
"FluStatusView",
|
"FluStatusView",
|
||||||
"FluRatingControl",
|
"FluRatingControl",
|
||||||
"FluPasswordBox"
|
"FluPasswordBox",
|
||||||
|
"FluBreadcrumbBar"
|
||||||
];
|
];
|
||||||
code = code.replace(/\n/g, "<br>");
|
code = code.replace(/\n/g, "<br>");
|
||||||
code = code.replace(/ /g, " ");
|
code = code.replace(/ /g, " ");
|
@ -20,7 +20,7 @@ FluObject{
|
|||||||
title:lang.settings
|
title:lang.settings
|
||||||
icon:FluentIcons.Settings
|
icon:FluentIcons.Settings
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Settings.qml")
|
navigationView.push("qrc:/qml/page/T_Settings.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -18,7 +18,7 @@ FluObject{
|
|||||||
height: 18
|
height: 18
|
||||||
}
|
}
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Home.qml")
|
navigationView.push("qrc:/qml/page/T_Home.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ FluObject{
|
|||||||
recentlyUpdated:true
|
recentlyUpdated:true
|
||||||
desc:"A control that responds to user input and raisesa Click event."
|
desc:"A control that responds to user input and raisesa Click event."
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Buttons.qml")
|
navigationView.push("qrc:/qml/page/T_Buttons.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
@ -40,7 +40,7 @@ FluObject{
|
|||||||
recentlyUpdated:true
|
recentlyUpdated:true
|
||||||
desc:"A control that lets the user select from a rangeof values by moving a Thumb control along atrack."
|
desc:"A control that lets the user select from a rangeof values by moving a Thumb control along atrack."
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Slider.qml")
|
navigationView.push("qrc:/qml/page/T_Slider.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
@ -49,13 +49,13 @@ FluObject{
|
|||||||
recentlyUpdated:true
|
recentlyUpdated:true
|
||||||
desc:"A control that a user can select or clear."
|
desc:"A control that a user can select or clear."
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_CheckBox.qml")
|
navigationView.push("qrc:/qml/page/T_CheckBox.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"ToggleSwitch"
|
title:"ToggleSwitch"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_ToggleSwitch.qml")
|
navigationView.push("qrc:/qml/page/T_ToggleSwitch.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -66,31 +66,31 @@ FluObject{
|
|||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"TextBox"
|
title:"TextBox"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_TextBox.qml")
|
navigationView.push("qrc:/qml/page/T_TextBox.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"TimePicker"
|
title:"TimePicker"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_TimePicker.qml")
|
navigationView.push("qrc:/qml/page/T_TimePicker.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"DatePicker"
|
title:"DatePicker"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_DatePicker.qml")
|
navigationView.push("qrc:/qml/page/T_DatePicker.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"CalendarPicker"
|
title:"CalendarPicker"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_CalendarPicker.qml")
|
navigationView.push("qrc:/qml/page/T_CalendarPicker.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"ColorPicker"
|
title:"ColorPicker"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_ColorPicker.qml")
|
navigationView.push("qrc:/qml/page/T_ColorPicker.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -104,49 +104,49 @@ FluObject{
|
|||||||
recentlyUpdated:true
|
recentlyUpdated:true
|
||||||
desc:"An inline message to display app-wide statuschange information."
|
desc:"An inline message to display app-wide statuschange information."
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_InfoBar.qml")
|
navigationView.push("qrc:/qml/page/T_InfoBar.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Progress"
|
title:"Progress"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Progress.qml")
|
navigationView.push("qrc:/qml/page/T_Progress.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"RatingControl"
|
title:"RatingControl"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_RatingControl.qml")
|
navigationView.push("qrc:/qml/page/T_RatingControl.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Badge"
|
title:"Badge"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Badge.qml")
|
navigationView.push("qrc:/qml/page/T_Badge.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Rectangle"
|
title:"Rectangle"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Rectangle.qml")
|
navigationView.push("qrc:/qml/page/T_Rectangle.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"StatusView"
|
title:"StatusView"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_StatusView.qml")
|
navigationView.push("qrc:/qml/page/T_StatusView.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Carousel"
|
title:"Carousel"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Carousel.qml")
|
navigationView.push("qrc:/qml/page/T_Carousel.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Expander"
|
title:"Expander"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Expander.qml")
|
navigationView.push("qrc:/qml/page/T_Expander.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -157,19 +157,19 @@ FluObject{
|
|||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Dialog"
|
title:"Dialog"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Dialog.qml")
|
navigationView.push("qrc:/qml/page/T_Dialog.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Tooltip"
|
title:"Tooltip"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Tooltip.qml")
|
navigationView.push("qrc:/qml/page/T_Tooltip.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Menu"
|
title:"Menu"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Menu.qml")
|
navigationView.push("qrc:/qml/page/T_Menu.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -184,7 +184,13 @@ FluObject{
|
|||||||
order:3
|
order:3
|
||||||
desc:"Presents information from different sources in atabbed view."
|
desc:"Presents information from different sources in atabbed view."
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Pivot.qml")
|
navigationView.push("qrc:/qml/page/T_Pivot.qml")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluPaneItem{
|
||||||
|
title:"BreadcrumbBar"
|
||||||
|
onTap:{
|
||||||
|
navigationView.push("qrc:/qml/page/T_BreadcrumbBar.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
@ -194,13 +200,13 @@ FluObject{
|
|||||||
order:1
|
order:1
|
||||||
desc:"A control that displays a collection of tabs thatcan be used to display several documents."
|
desc:"A control that displays a collection of tabs thatcan be used to display several documents."
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_TabView.qml")
|
navigationView.push("qrc:/qml/page/T_TabView.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"TreeView"
|
title:"TreeView"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_TreeView.qml")
|
navigationView.push("qrc:/qml/page/T_TreeView.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
@ -210,13 +216,13 @@ FluObject{
|
|||||||
order:4
|
order:4
|
||||||
desc:"The TableView control provides a flexible way to display a collection of data in rows and columns"
|
desc:"The TableView control provides a flexible way to display a collection of data in rows and columns"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_TableView.qml")
|
navigationView.push("qrc:/qml/page/T_TableView.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"MultiWindow"
|
title:"MultiWindow"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_MultiWindow.qml")
|
navigationView.push("qrc:/qml/page/T_MultiWindow.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
@ -226,7 +232,7 @@ FluObject{
|
|||||||
order:2
|
order:2
|
||||||
desc:"Presents a collection of items that the user canflip through, one item at a time."
|
desc:"Presents a collection of items that the user canflip through, one item at a time."
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_FlipView.qml")
|
navigationView.push("qrc:/qml/page/T_FlipView.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -237,19 +243,19 @@ FluObject{
|
|||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Theme"
|
title:"Theme"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Theme.qml")
|
navigationView.push("qrc:/qml/page/T_Theme.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Typography"
|
title:"Typography"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Typography.qml")
|
navigationView.push("qrc:/qml/page/T_Typography.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluPaneItem{
|
FluPaneItem{
|
||||||
title:"Awesome"
|
title:"Awesome"
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_Awesome.qml")
|
navigationView.push("qrc:/qml/page/T_Awesome.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -264,7 +270,7 @@ FluObject{
|
|||||||
order:0
|
order:0
|
||||||
desc:"A control to display video and image content."
|
desc:"A control to display video and image content."
|
||||||
onTap:{
|
onTap:{
|
||||||
navigationView.push("qrc:/T_MediaPlayer.qml")
|
navigationView.push("qrc:/qml/page/T_MediaPlayer.qml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,7 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
98
example/qml/page/T_BreadcrumbBar.qml
Normal file
98
example/qml/page/T_BreadcrumbBar.qml
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Window
|
||||||
|
import FluentUI
|
||||||
|
import "../component"
|
||||||
|
|
||||||
|
FluScrollablePage{
|
||||||
|
|
||||||
|
title:"BreadcurmbBar"
|
||||||
|
leftPadding:10
|
||||||
|
rightPadding:10
|
||||||
|
bottomPadding:20
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
var items = []
|
||||||
|
for(var i=0;i<10;i++){
|
||||||
|
items.push({title:"Item_"+(i+1)})
|
||||||
|
}
|
||||||
|
breadcrumb_1.items = items
|
||||||
|
breadcrumb_2.items = items
|
||||||
|
}
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 68
|
||||||
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
|
|
||||||
|
FluBreadcrumbBar{
|
||||||
|
id:breadcrumb_1
|
||||||
|
width:parent.width
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
onClickItem:
|
||||||
|
(model)=>{
|
||||||
|
showSuccess(model.title)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FluArea{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 100
|
||||||
|
paddings: 10
|
||||||
|
Layout.topMargin: 20
|
||||||
|
|
||||||
|
ColumnLayout{
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
width:parent.width
|
||||||
|
spacing: 10
|
||||||
|
|
||||||
|
FluFilledButton{
|
||||||
|
text:"Reset sample"
|
||||||
|
onClicked:{
|
||||||
|
var items = []
|
||||||
|
for(var i=0;i<10;i++){
|
||||||
|
items.push({title:"Item_"+(i+1)})
|
||||||
|
}
|
||||||
|
breadcrumb_2.items = items
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FluBreadcrumbBar{
|
||||||
|
id:breadcrumb_2
|
||||||
|
separator:">"
|
||||||
|
spacing:8
|
||||||
|
textSize:18
|
||||||
|
Layout.fillWidth: true
|
||||||
|
onClickItem:
|
||||||
|
(model)=>{
|
||||||
|
//不是点击最后一个item元素
|
||||||
|
if(model.index+1!==count()){
|
||||||
|
breadcrumb_2.remove(model.index+1,count()-model.index-1)
|
||||||
|
}
|
||||||
|
showSuccess(model.title)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CodeExpander{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: -1
|
||||||
|
code:'FluBreadcrumbBar{
|
||||||
|
width:parent.width
|
||||||
|
separator:">"
|
||||||
|
spacing:8
|
||||||
|
textSize:18
|
||||||
|
onClickItem: (model)=>{
|
||||||
|
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -4,7 +4,7 @@ import QtQuick.Window
|
|||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Controls.Basic
|
import QtQuick.Controls.Basic
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
title:"Buttons"
|
title:"Buttons"
|
@ -3,7 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -2,7 +2,7 @@
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import "qrc:///global/"
|
import "qrc:///qml/global/"
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
@ -3,7 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,12 +3,12 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
property string password: ""
|
property string password: ""
|
||||||
property var loginPageRegister: registerForPageResult("/login")
|
property var loginPageRegister: registerForWindowResult("/login")
|
||||||
|
|
||||||
title:"MultiWindow"
|
title:"MultiWindow"
|
||||||
leftPadding:10
|
leftPadding:10
|
||||||
@ -168,7 +168,7 @@ FluScrollablePage{
|
|||||||
CodeExpander{
|
CodeExpander{
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: -1
|
Layout.topMargin: -1
|
||||||
code:'property var loginPageRegister: registerForPageResult("/login")
|
code:'property var loginPageRegister: registerForWindowResult("/login")
|
||||||
|
|
||||||
Connections{
|
Connections{
|
||||||
target: loginPageRegister
|
target: loginPageRegister
|
@ -3,7 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,8 +3,8 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "qrc:///global/"
|
import "qrc:///qml/global/"
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -2,7 +2,7 @@
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import "./component"
|
import "../component"
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
@ -3,7 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
||||||
@ -68,8 +68,8 @@ FluScrollablePage{
|
|||||||
text:"编辑"
|
text:"编辑"
|
||||||
topPadding:3
|
topPadding:3
|
||||||
bottomPadding:3
|
bottomPadding:3
|
||||||
leftPadding:3
|
leftPadding:6
|
||||||
rightPadding:3
|
rightPadding:6
|
||||||
onClicked:{
|
onClicked:{
|
||||||
console.debug(dataModel.index)
|
console.debug(dataModel.index)
|
||||||
showSuccess(JSON.stringify(dataObject))
|
showSuccess(JSON.stringify(dataObject))
|
||||||
@ -79,8 +79,8 @@ FluScrollablePage{
|
|||||||
text:"删除"
|
text:"删除"
|
||||||
topPadding:3
|
topPadding:3
|
||||||
bottomPadding:3
|
bottomPadding:3
|
||||||
leftPadding:3
|
leftPadding:6
|
||||||
rightPadding:3
|
rightPadding:6
|
||||||
onClicked:{
|
onClicked:{
|
||||||
showError(JSON.stringify(dataObject))
|
showError(JSON.stringify(dataObject))
|
||||||
}
|
}
|
@ -3,7 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage{
|
FluScrollablePage{
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "./component"
|
import "../component"
|
||||||
|
|
||||||
FluScrollablePage {
|
FluScrollablePage {
|
||||||
|
|
@ -6,7 +6,7 @@ import FluentUI
|
|||||||
FluWindow {
|
FluWindow {
|
||||||
|
|
||||||
id:window
|
id:window
|
||||||
|
title:"关于"
|
||||||
width: 600
|
width: 600
|
||||||
height: 600
|
height: 600
|
||||||
minimumWidth: 600
|
minimumWidth: 600
|
||||||
@ -15,8 +15,6 @@ FluWindow {
|
|||||||
maximumHeight: 600
|
maximumHeight: 600
|
||||||
launchMode: FluWindow.SingleTask
|
launchMode: FluWindow.SingleTask
|
||||||
|
|
||||||
title:"关于"
|
|
||||||
|
|
||||||
FluAppBar{
|
FluAppBar{
|
||||||
id:appbar
|
id:appbar
|
||||||
title:"关于"
|
title:"关于"
|
@ -7,13 +7,12 @@ import QtQuick.Dialogs
|
|||||||
|
|
||||||
FluWindow {
|
FluWindow {
|
||||||
|
|
||||||
|
title:"ChatGPT"
|
||||||
width: 680
|
width: 680
|
||||||
height: 600
|
height: 600
|
||||||
minimumWidth: 500
|
minimumWidth: 500
|
||||||
minimumHeight: 600
|
minimumHeight: 600
|
||||||
|
|
||||||
title:"ChatGPT"
|
|
||||||
|
|
||||||
onInitArgument:
|
onInitArgument:
|
||||||
(argument)=>{
|
(argument)=>{
|
||||||
scrollview.focus = true
|
scrollview.focus = true
|
@ -6,13 +6,13 @@ import FluentUI
|
|||||||
FluWindow {
|
FluWindow {
|
||||||
|
|
||||||
id:window
|
id:window
|
||||||
|
title:"登录"
|
||||||
width: 400
|
width: 400
|
||||||
height: 400
|
height: 400
|
||||||
minimumWidth: 400
|
minimumWidth: 400
|
||||||
minimumHeight: 400
|
minimumHeight: 400
|
||||||
maximumWidth: 400
|
maximumWidth: 400
|
||||||
maximumHeight: 400
|
maximumHeight: 400
|
||||||
title:"登录"
|
|
||||||
|
|
||||||
onInitArgument:
|
onInitArgument:
|
||||||
(argument)=>{
|
(argument)=>{
|
@ -4,13 +4,14 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import Qt.labs.platform
|
import Qt.labs.platform
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "qrc:///global/"
|
import "qrc:///qml/global/"
|
||||||
|
|
||||||
FluWindow {
|
FluWindow {
|
||||||
|
|
||||||
id:window
|
id:window
|
||||||
|
title: "FluentUI"
|
||||||
width: 1000
|
width: 1000
|
||||||
height: 640
|
height: 640
|
||||||
title: "FluentUI"
|
|
||||||
closeDestory:false
|
closeDestory:false
|
||||||
minimumWidth: 520
|
minimumWidth: 520
|
||||||
minimumHeight: 460
|
minimumHeight: 460
|
||||||
@ -20,6 +21,15 @@ FluWindow {
|
|||||||
event.accepted = false
|
event.accepted = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections{
|
||||||
|
target: appInfo
|
||||||
|
function onActiveWindow(){
|
||||||
|
window.show()
|
||||||
|
window.raise()
|
||||||
|
window.requestActivate()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FluAppBar{
|
FluAppBar{
|
||||||
id:appbar
|
id:appbar
|
||||||
z:9
|
z:9
|
@ -5,13 +5,12 @@ import FluentUI
|
|||||||
|
|
||||||
FluWindow {
|
FluWindow {
|
||||||
|
|
||||||
|
title:"视频播放器"
|
||||||
width: 640
|
width: 640
|
||||||
height: 480
|
height: 480
|
||||||
minimumWidth: 640
|
minimumWidth: 640
|
||||||
minimumHeight: 480
|
minimumHeight: 480
|
||||||
|
|
||||||
title:"视频播放器"
|
|
||||||
|
|
||||||
onInitArgument:
|
onInitArgument:
|
||||||
(argument)=>{
|
(argument)=>{
|
||||||
player.source = argument.source
|
player.source = argument.source
|
||||||
@ -23,7 +22,6 @@ FluWindow {
|
|||||||
width:parent.width
|
width:parent.width
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FluMediaPlayer{
|
FluMediaPlayer{
|
||||||
id:player
|
id:player
|
||||||
anchors{
|
anchors{
|
@ -6,7 +6,7 @@ import FluentUI
|
|||||||
FluWindow {
|
FluWindow {
|
||||||
|
|
||||||
id:window
|
id:window
|
||||||
|
title:"SingleInstance"
|
||||||
width: 500
|
width: 500
|
||||||
height: 600
|
height: 600
|
||||||
minimumWidth: 500
|
minimumWidth: 500
|
||||||
@ -15,8 +15,6 @@ FluWindow {
|
|||||||
maximumHeight: 600
|
maximumHeight: 600
|
||||||
launchMode: FluWindow.SingleInstance
|
launchMode: FluWindow.SingleInstance
|
||||||
|
|
||||||
title:"SingleInstance"
|
|
||||||
|
|
||||||
FluAppBar{
|
FluAppBar{
|
||||||
id:appbar
|
id:appbar
|
||||||
title:"SingleInstance"
|
title:"SingleInstance"
|
@ -6,7 +6,7 @@ import FluentUI
|
|||||||
FluWindow {
|
FluWindow {
|
||||||
|
|
||||||
id:window
|
id:window
|
||||||
|
title:"SingleTask"
|
||||||
width: 500
|
width: 500
|
||||||
height: 600
|
height: 600
|
||||||
minimumWidth: 500
|
minimumWidth: 500
|
||||||
@ -15,8 +15,6 @@ FluWindow {
|
|||||||
maximumHeight: 600
|
maximumHeight: 600
|
||||||
launchMode: FluWindow.SingleTask
|
launchMode: FluWindow.SingleTask
|
||||||
|
|
||||||
title:"SingleTask"
|
|
||||||
|
|
||||||
FluAppBar{
|
FluAppBar{
|
||||||
id:appbar
|
id:appbar
|
||||||
title:"SingleTask"
|
title:"SingleTask"
|
@ -6,7 +6,7 @@ import FluentUI
|
|||||||
FluWindow {
|
FluWindow {
|
||||||
|
|
||||||
id:window
|
id:window
|
||||||
|
title:"Standard"
|
||||||
width: 500
|
width: 500
|
||||||
height: 600
|
height: 600
|
||||||
minimumWidth: 500
|
minimumWidth: 500
|
||||||
@ -15,8 +15,6 @@ FluWindow {
|
|||||||
maximumHeight: 600
|
maximumHeight: 600
|
||||||
launchMode: FluWindow.Standard
|
launchMode: FluWindow.Standard
|
||||||
|
|
||||||
title:"Standard"
|
|
||||||
|
|
||||||
FluAppBar{
|
FluAppBar{
|
||||||
id:appbar
|
id:appbar
|
||||||
title:"Standard"
|
title:"Standard"
|
@ -2,11 +2,10 @@
|
|||||||
#include "lang/En.h"
|
#include "lang/En.h"
|
||||||
#include "lang/Zh.h"
|
#include "lang/Zh.h"
|
||||||
|
|
||||||
|
|
||||||
AppInfo::AppInfo(QObject *parent)
|
AppInfo::AppInfo(QObject *parent)
|
||||||
: QObject{parent}
|
: QObject{parent}
|
||||||
{
|
{
|
||||||
version("1.2.6");
|
version("1.2.7");
|
||||||
lang(new En());
|
lang(new En());
|
||||||
}
|
}
|
||||||
|
|
@ -13,6 +13,7 @@ class AppInfo : public QObject
|
|||||||
public:
|
public:
|
||||||
explicit AppInfo(QObject *parent = nullptr);
|
explicit AppInfo(QObject *parent = nullptr);
|
||||||
Q_INVOKABLE void changeLang(const QString& locale);
|
Q_INVOKABLE void changeLang(const QString& locale);
|
||||||
|
Q_SIGNAL void activeWindow();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // APPINFO_H
|
#endif // APPINFO_H
|
@ -11,7 +11,7 @@
|
|||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include "stdafx.h"
|
#include "../stdafx.h"
|
||||||
|
|
||||||
class ChatController : public QObject
|
class ChatController : public QObject
|
||||||
{
|
{
|
@ -2,7 +2,7 @@
|
|||||||
#define LANG_H
|
#define LANG_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include "stdafx.h"
|
#include "../stdafx.h"
|
||||||
|
|
||||||
class Lang : public QObject
|
class Lang : public QObject
|
||||||
{
|
{
|
@ -6,7 +6,11 @@
|
|||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include "lang/Lang.h"
|
#include "lang/Lang.h"
|
||||||
#include "AppInfo.h"
|
#include "AppInfo.h"
|
||||||
#include "ChatController.h"
|
#include "controller/ChatController.h"
|
||||||
|
#include "tool/IPC.h"
|
||||||
|
#if defined(STATICLIB)
|
||||||
|
#include <FluentUI.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@ -19,12 +23,28 @@ int main(int argc, char *argv[])
|
|||||||
QGuiApplication::setOrganizationName("ZhuZiChu");
|
QGuiApplication::setOrganizationName("ZhuZiChu");
|
||||||
QGuiApplication::setOrganizationDomain("https://zhuzichu520.github.io");
|
QGuiApplication::setOrganizationDomain("https://zhuzichu520.github.io");
|
||||||
QGuiApplication::setApplicationName("FluentUI");
|
QGuiApplication::setApplicationName("FluentUI");
|
||||||
// QQuickWindow::setGraphicsApi(QSGRendererInterface::Software);
|
// QQuickWindow::setGraphicsApi(QSGRendererInterface::Software);
|
||||||
QGuiApplication app(argc, argv);
|
QGuiApplication app(argc, argv);
|
||||||
|
AppInfo* appInfo = new AppInfo();
|
||||||
|
IPC ipc(0);
|
||||||
|
QString activeWindowEvent = "activeWindow";
|
||||||
|
if(!ipc.isCurrentOwner()){
|
||||||
|
ipc.postEvent(activeWindowEvent,QString().toUtf8(),0);
|
||||||
|
delete appInfo;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if(ipc.isAttached()){
|
||||||
|
ipc.registerEventHandler(activeWindowEvent,[&appInfo](const QByteArray&){
|
||||||
|
Q_EMIT appInfo->activeWindow();
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
app.setQuitOnLastWindowClosed(false);
|
app.setQuitOnLastWindowClosed(false);
|
||||||
QQmlApplicationEngine engine;
|
QQmlApplicationEngine engine;
|
||||||
|
#if defined(STATICLIB)
|
||||||
|
FluentUI::initialize(&engine);
|
||||||
|
#endif
|
||||||
qmlRegisterType<ChatController>("Controller",1,0,"ChatController");
|
qmlRegisterType<ChatController>("Controller",1,0,"ChatController");
|
||||||
AppInfo* appInfo = new AppInfo();
|
|
||||||
QQmlContext * context = engine.rootContext();
|
QQmlContext * context = engine.rootContext();
|
||||||
Lang* lang = appInfo->lang();
|
Lang* lang = appInfo->lang();
|
||||||
context->setContextProperty("lang",lang);
|
context->setContextProperty("lang",lang);
|
||||||
@ -32,12 +52,12 @@ int main(int argc, char *argv[])
|
|||||||
context->setContextProperty("lang",appInfo->lang());
|
context->setContextProperty("lang",appInfo->lang());
|
||||||
});
|
});
|
||||||
context->setContextProperty("appInfo",appInfo);
|
context->setContextProperty("appInfo",appInfo);
|
||||||
const QUrl url(QStringLiteral("qrc:/App.qml"));
|
const QUrl url(QStringLiteral("qrc:/qml/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) {
|
||||||
if (!obj && url == objUrl)
|
if (!obj && url == objUrl)
|
||||||
QCoreApplication::exit(-1);
|
QCoreApplication::exit(-1);
|
||||||
}, Qt::QueuedConnection);
|
}, Qt::QueuedConnection);
|
||||||
engine.load(url);
|
engine.load(url);
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
250
example/src/tool/IPC.cpp
Normal file
250
example/src/tool/IPC.cpp
Normal file
@ -0,0 +1,250 @@
|
|||||||
|
#include "IPC.h"
|
||||||
|
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QThread>
|
||||||
|
#include <ctime>
|
||||||
|
#include <random>
|
||||||
|
|
||||||
|
|
||||||
|
IPC::IPC(uint32_t profileId)
|
||||||
|
: profileId{profileId}
|
||||||
|
, globalMemory{"ipc-" IPC_PROTOCOL_VERSION}
|
||||||
|
{
|
||||||
|
qRegisterMetaType<IPCEventHandler>("IPCEventHandler");
|
||||||
|
timer.setInterval(EVENT_TIMER_MS);
|
||||||
|
timer.setSingleShot(true);
|
||||||
|
connect(&timer, &QTimer::timeout, this, &IPC::processEvents);
|
||||||
|
std::default_random_engine randEngine((std::random_device())());
|
||||||
|
std::uniform_int_distribution<uint64_t> distribution;
|
||||||
|
globalId = distribution(randEngine);
|
||||||
|
qDebug() << "Our global IPC ID is " << globalId;
|
||||||
|
if (globalMemory.create(sizeof(IPCMemory))) {
|
||||||
|
if (globalMemory.lock()) {
|
||||||
|
IPCMemory* mem = global();
|
||||||
|
memset(mem, 0, sizeof(IPCMemory));
|
||||||
|
mem->globalId = globalId;
|
||||||
|
mem->lastProcessed = time(nullptr);
|
||||||
|
globalMemory.unlock();
|
||||||
|
} else {
|
||||||
|
qWarning() << "Couldn't lock to take ownership";
|
||||||
|
}
|
||||||
|
} else if (globalMemory.attach()) {
|
||||||
|
qDebug() << "Attaching to the global shared memory";
|
||||||
|
} else {
|
||||||
|
qDebug() << "Failed to attach to the global shared memory, giving up. Error:"
|
||||||
|
<< globalMemory.error();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
processEvents();
|
||||||
|
}
|
||||||
|
|
||||||
|
IPC::~IPC()
|
||||||
|
{
|
||||||
|
if (!globalMemory.lock()) {
|
||||||
|
qWarning() << "Failed to lock in ~IPC";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isCurrentOwnerNoLock()) {
|
||||||
|
global()->globalId = 0;
|
||||||
|
}
|
||||||
|
globalMemory.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
time_t IPC::postEvent(const QString& name, const QByteArray& data, uint32_t dest)
|
||||||
|
{
|
||||||
|
QByteArray binName = name.toUtf8();
|
||||||
|
if (binName.length() > (int32_t)sizeof(IPCEvent::name)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.length() > (int32_t)sizeof(IPCEvent::data)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!globalMemory.lock()) {
|
||||||
|
qDebug() << "Failed to lock in postEvent()";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
IPCEvent* evt = nullptr;
|
||||||
|
IPCMemory* mem = global();
|
||||||
|
time_t result = 0;
|
||||||
|
|
||||||
|
for (uint32_t i = 0; !evt && i < EVENT_QUEUE_SIZE; ++i) {
|
||||||
|
if (mem->events[i].posted == 0) {
|
||||||
|
evt = &mem->events[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (evt) {
|
||||||
|
memset(evt, 0, sizeof(IPCEvent));
|
||||||
|
memcpy(evt->name, binName.constData(), binName.length());
|
||||||
|
memcpy(evt->data, data.constData(), data.length());
|
||||||
|
mem->lastEvent = evt->posted = result = qMax(mem->lastEvent + 1, time(nullptr));
|
||||||
|
evt->dest = dest;
|
||||||
|
evt->sender = qApp->applicationPid();
|
||||||
|
qDebug() << "postEvent " << name << "to" << dest;
|
||||||
|
}
|
||||||
|
globalMemory.unlock();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IPC::isCurrentOwner()
|
||||||
|
{
|
||||||
|
if (globalMemory.lock()) {
|
||||||
|
const bool isOwner = isCurrentOwnerNoLock();
|
||||||
|
globalMemory.unlock();
|
||||||
|
return isOwner;
|
||||||
|
} else {
|
||||||
|
qWarning() << "isCurrentOwner failed to lock, returning false";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void IPC::registerEventHandler(const QString& name, IPCEventHandler handler)
|
||||||
|
{
|
||||||
|
eventHandlers[name] = handler;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IPC::isEventAccepted(time_t time)
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
if (!globalMemory.lock()) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (difftime(global()->lastProcessed, time) > 0) {
|
||||||
|
IPCMemory* mem = global();
|
||||||
|
for (uint32_t i = 0; i < EVENT_QUEUE_SIZE; ++i) {
|
||||||
|
if (mem->events[i].posted == time && mem->events[i].processed) {
|
||||||
|
result = mem->events[i].accepted;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
globalMemory.unlock();
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IPC::waitUntilAccepted(time_t postTime, int32_t timeout /*=-1*/)
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
time_t start = time(nullptr);
|
||||||
|
forever
|
||||||
|
{
|
||||||
|
result = isEventAccepted(postTime);
|
||||||
|
if (result || (timeout > 0 && difftime(time(nullptr), start) >= timeout)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
qApp->processEvents();
|
||||||
|
QThread::msleep(0);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IPC::isAttached() const
|
||||||
|
{
|
||||||
|
return globalMemory.isAttached();
|
||||||
|
}
|
||||||
|
|
||||||
|
void IPC::setProfileId(uint32_t profileId)
|
||||||
|
{
|
||||||
|
this->profileId = profileId;
|
||||||
|
}
|
||||||
|
|
||||||
|
IPC::IPCEvent* IPC::fetchEvent()
|
||||||
|
{
|
||||||
|
IPCMemory* mem = global();
|
||||||
|
for (uint32_t i = 0; i < EVENT_QUEUE_SIZE; ++i) {
|
||||||
|
IPCEvent* evt = &mem->events[i];
|
||||||
|
if ((evt->processed && difftime(time(nullptr), evt->processed) > EVENT_GC_TIMEOUT)
|
||||||
|
|| (!evt->processed && difftime(time(nullptr), evt->posted) > EVENT_GC_TIMEOUT)) {
|
||||||
|
memset(evt, 0, sizeof(IPCEvent));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (evt->posted && !evt->processed && evt->sender != qApp->applicationPid()
|
||||||
|
&& (evt->dest == profileId || (evt->dest == 0 && isCurrentOwnerNoLock()))) {
|
||||||
|
return evt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IPC::runEventHandler(IPCEventHandler handler, const QByteArray& arg)
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
if (QThread::currentThread() == qApp->thread()) {
|
||||||
|
result = handler(arg);
|
||||||
|
} else {
|
||||||
|
QMetaObject::invokeMethod(this, "runEventHandler", Qt::BlockingQueuedConnection,
|
||||||
|
Q_RETURN_ARG(bool, result), Q_ARG(IPCEventHandler, handler),
|
||||||
|
Q_ARG(const QByteArray&, arg));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IPC::processEvents()
|
||||||
|
{
|
||||||
|
if (!globalMemory.lock()) {
|
||||||
|
timer.start();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
IPCMemory* mem = global();
|
||||||
|
|
||||||
|
if (mem->globalId == globalId) {
|
||||||
|
mem->lastProcessed = time(nullptr);
|
||||||
|
} else {
|
||||||
|
if (difftime(time(nullptr), mem->lastProcessed) >= OWNERSHIP_TIMEOUT_S) {
|
||||||
|
qDebug() << "Previous owner timed out, taking ownership" << mem->globalId << "->"
|
||||||
|
<< globalId;
|
||||||
|
memset(mem, 0, sizeof(IPCMemory));
|
||||||
|
mem->globalId = globalId;
|
||||||
|
mem->lastProcessed = time(nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (IPCEvent* evt = fetchEvent()) {
|
||||||
|
QString name = QString::fromUtf8(evt->name);
|
||||||
|
auto it = eventHandlers.find(name);
|
||||||
|
if (it != eventHandlers.end()) {
|
||||||
|
evt->accepted = runEventHandler(it.value(), evt->data);
|
||||||
|
qDebug() << "Processed event:" << name << "posted:" << evt->posted
|
||||||
|
<< "accepted:" << evt->accepted;
|
||||||
|
if (evt->dest == 0) {
|
||||||
|
if (evt->accepted) {
|
||||||
|
evt->processed = time(nullptr);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
evt->processed = time(nullptr);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
qDebug() << "Received event:" << name << "without handler";
|
||||||
|
qDebug() << "Available handlers:" << eventHandlers.keys();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
globalMemory.unlock();
|
||||||
|
timer.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IPC::isCurrentOwnerNoLock()
|
||||||
|
{
|
||||||
|
const void* const data = globalMemory.data();
|
||||||
|
if (!data) {
|
||||||
|
qWarning() << "isCurrentOwnerNoLock failed to access the memory, returning false";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return (*static_cast<const uint64_t*>(data) == globalId);
|
||||||
|
}
|
||||||
|
|
||||||
|
IPC::IPCMemory* IPC::global()
|
||||||
|
{
|
||||||
|
return static_cast<IPCMemory*>(globalMemory.data());
|
||||||
|
}
|
75
example/src/tool/IPC.h
Normal file
75
example/src/tool/IPC.h
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
#ifndef IPC_H
|
||||||
|
#define IPC_H
|
||||||
|
|
||||||
|
#include <QMap>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QSharedMemory>
|
||||||
|
#include <QTimer>
|
||||||
|
#include <ctime>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
using IPCEventHandler = std::function<bool(const QByteArray&)>;
|
||||||
|
|
||||||
|
#define IPC_PROTOCOL_VERSION "1"
|
||||||
|
|
||||||
|
class IPC : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static const int EVENT_TIMER_MS = 1000;
|
||||||
|
static const int EVENT_GC_TIMEOUT = 5;
|
||||||
|
static const int EVENT_QUEUE_SIZE = 32;
|
||||||
|
static const int OWNERSHIP_TIMEOUT_S = 5;
|
||||||
|
|
||||||
|
public:
|
||||||
|
IPC(uint32_t profileId);
|
||||||
|
~IPC();
|
||||||
|
|
||||||
|
struct IPCEvent
|
||||||
|
{
|
||||||
|
uint32_t dest;
|
||||||
|
int32_t sender;
|
||||||
|
char name[16];
|
||||||
|
char data[128];
|
||||||
|
time_t posted;
|
||||||
|
time_t processed;
|
||||||
|
uint32_t flags;
|
||||||
|
bool accepted;
|
||||||
|
bool global;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct IPCMemory
|
||||||
|
{
|
||||||
|
uint64_t globalId;
|
||||||
|
time_t lastEvent;
|
||||||
|
time_t lastProcessed;
|
||||||
|
IPCEvent events[IPC::EVENT_QUEUE_SIZE];
|
||||||
|
};
|
||||||
|
|
||||||
|
time_t postEvent(const QString& name, const QByteArray& data = QByteArray(), uint32_t dest = 0);
|
||||||
|
bool isCurrentOwner();
|
||||||
|
void registerEventHandler(const QString& name, IPCEventHandler handler);
|
||||||
|
bool isEventAccepted(time_t time);
|
||||||
|
bool waitUntilAccepted(time_t time, int32_t timeout = -1);
|
||||||
|
bool isAttached() const;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void setProfileId(uint32_t profileId);
|
||||||
|
|
||||||
|
private:
|
||||||
|
IPCMemory* global();
|
||||||
|
bool runEventHandler(IPCEventHandler handler, const QByteArray& arg);
|
||||||
|
IPCEvent* fetchEvent();
|
||||||
|
void processEvents();
|
||||||
|
bool isCurrentOwnerNoLock();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QTimer timer;
|
||||||
|
uint64_t globalId;
|
||||||
|
uint32_t profileId;
|
||||||
|
QSharedMemory globalMemory;
|
||||||
|
QMap<QString, IPCEventHandler> eventHandlers;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // IPC_H
|
@ -45,7 +45,7 @@ set(TARGET_HEADERS
|
|||||||
)
|
)
|
||||||
|
|
||||||
add_definitions(-DVERSION_IN="1.0.0")
|
add_definitions(-DVERSION_IN="1.0.0")
|
||||||
add_definitions(-DVURI_STR="FluentUI")
|
add_definitions(-DURI_STR="FluentUI")
|
||||||
|
|
||||||
add_library(${PROJECT_NAME} ${TARGET_TYPE} ${TARGET_SOURCES} ${TARGET_HEADERS} ${TARGET_RESOURCES})
|
add_library(${PROJECT_NAME} ${TARGET_TYPE} ${TARGET_SOURCES} ${TARGET_HEADERS} ${TARGET_RESOURCES})
|
||||||
|
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
#include "Def.h"
|
#include "Def.h"
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
#pragma comment(lib, "Dwmapi.lib")
|
||||||
|
#pragma comment(lib, "User32.lib")
|
||||||
#include <dwmapi.h>
|
#include <dwmapi.h>
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
|
@ -34,6 +34,7 @@ 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/FluBreadcrumbBar.qml"),uri,major,minor,"FluBreadcrumbBar");
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluRatingControl.qml"),uri,major,minor,"FluRatingControl");
|
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/FluStatusView.qml"),uri,major,minor,"FluStatusView");
|
||||||
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluPagination.qml"),uri,major,minor,"FluPagination");
|
qmlRegisterType(QUrl("qrc:/com.zhuzichu/controls/FluPagination.qml"),uri,major,minor,"FluPagination");
|
||||||
|
@ -8,3 +8,8 @@ void FluentUI::registerTypes(const char *uri){
|
|||||||
void FluentUI::initializeEngine(QQmlEngine *engine, const char *uri){
|
void FluentUI::initializeEngine(QQmlEngine *engine, const char *uri){
|
||||||
Fluent::getInstance()->initializeEngine(engine,uri);
|
Fluent::getInstance()->initializeEngine(engine,uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FluentUI::initialize(QQmlEngine *engine){
|
||||||
|
Fluent::getInstance()->registerTypes(URI_STR);
|
||||||
|
Fluent::getInstance()->initializeEngine(engine,URI_STR);
|
||||||
|
}
|
||||||
|
@ -3,12 +3,13 @@
|
|||||||
|
|
||||||
#include <QQmlEngine>
|
#include <QQmlEngine>
|
||||||
|
|
||||||
class FluentUI
|
class Q_DECL_EXPORT FluentUI
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void registerTypes(const char *uri) ;
|
static void registerTypes(const char *uri) ;
|
||||||
static void initializeEngine(QQmlEngine *engine, const char *uri);
|
static void initializeEngine(QQmlEngine *engine, const char *uri);
|
||||||
|
static void initialize(QQmlEngine *engine);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FLUENTUI_H
|
#endif // FLUENTUI_H
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
#include "FluTheme.h"
|
#include "FluTheme.h"
|
||||||
#include "FluApp.h"
|
#include "FluApp.h"
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
#pragma comment(lib, "Dwmapi.lib")
|
||||||
|
#pragma comment(lib, "User32.lib")
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
#endif
|
#endif
|
||||||
@ -13,6 +15,9 @@ bool NativeEventFilter::nativeEventFilter(const QByteArray &eventType, void *mes
|
|||||||
MSG* msg = static_cast<MSG *>(message);
|
MSG* msg = static_cast<MSG *>(message);
|
||||||
if (msg == Q_NULLPTR)
|
if (msg == Q_NULLPTR)
|
||||||
return false;
|
return false;
|
||||||
|
if(!FluApp::getInstance()->wnds.contains((WId)msg->hwnd)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
switch(msg->message) {
|
switch(msg->message) {
|
||||||
case WM_NCCALCSIZE:{
|
case WM_NCCALCSIZE:{
|
||||||
NCCALCSIZE_PARAMS& params = *reinterpret_cast<NCCALCSIZE_PARAMS*>(msg->lParam);
|
NCCALCSIZE_PARAMS& params = *reinterpret_cast<NCCALCSIZE_PARAMS*>(msg->lParam);
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
#include "FluTheme.h"
|
#include "FluTheme.h"
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
#pragma comment(lib, "Dwmapi.lib")
|
||||||
|
#pragma comment(lib, "User32.lib")
|
||||||
#include <dwmapi.h>
|
#include <dwmapi.h>
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
|
@ -19,8 +19,6 @@ Rectangle{
|
|||||||
property color maximizeHoverColor: FluTheme.dark ? Qt.rgba(1,1,1,0.1) : Qt.rgba(0,0,0,0.06)
|
property color maximizeHoverColor: FluTheme.dark ? Qt.rgba(1,1,1,0.1) : Qt.rgba(0,0,0,0.06)
|
||||||
property color closeNormalColor: Qt.rgba(0,0,0,0)
|
property color closeNormalColor: Qt.rgba(0,0,0,0)
|
||||||
property color closeHoverColor: Qt.rgba(251/255,115/255,115/255,1)
|
property color closeHoverColor: Qt.rgba(251/255,115/255,115/255,1)
|
||||||
|
|
||||||
|
|
||||||
property bool showDark: false
|
property bool showDark: false
|
||||||
property color borerlessColor : FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
property color borerlessColor : FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
@ -12,12 +13,24 @@ Rectangle {
|
|||||||
property int bottomPadding : 0
|
property int bottomPadding : 0
|
||||||
|
|
||||||
radius: 4
|
radius: 4
|
||||||
color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
|
color: FluTheme.dark ? Window.active ? Qt.rgba(38/255,44/255,54/255,1) : Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
|
||||||
border.color: FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1)
|
border.color: FluTheme.dark ? Window.active ? Qt.rgba(55/255,55/255,55/255,1):Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1)
|
||||||
border.width: 1
|
border.width: 1
|
||||||
implicitHeight: height
|
implicitHeight: height
|
||||||
implicitWidth: width
|
implicitWidth: width
|
||||||
|
|
||||||
|
Behavior on color{
|
||||||
|
ColorAnimation {
|
||||||
|
duration: 300
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on border.color{
|
||||||
|
ColorAnimation {
|
||||||
|
duration: 300
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: container
|
id: container
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -3,20 +3,25 @@ import QtQuick.Controls
|
|||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
FluTextBox{
|
FluTextBox{
|
||||||
|
|
||||||
property var items:[]
|
property var items:[]
|
||||||
property string emptyText: "没有找到结果"
|
property string emptyText: "没有找到结果"
|
||||||
property int autoSuggestBoxReplacement: FluentIcons.Search
|
property int autoSuggestBoxReplacement: FluentIcons.Search
|
||||||
signal itemClicked(var data)
|
signal itemClicked(var data)
|
||||||
signal handleClicked
|
signal handleClicked
|
||||||
|
|
||||||
|
id:control
|
||||||
|
width: 300
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
loadData()
|
||||||
|
}
|
||||||
|
|
||||||
QtObject{
|
QtObject{
|
||||||
id:d
|
id:d
|
||||||
property bool flagVisible: true
|
property bool flagVisible: true
|
||||||
}
|
}
|
||||||
id:control
|
|
||||||
width: 300
|
|
||||||
Component.onCompleted: {
|
|
||||||
loadData()
|
|
||||||
}
|
|
||||||
Popup{
|
Popup{
|
||||||
id:control_popup
|
id:control_popup
|
||||||
y:control.height
|
y:control.height
|
||||||
@ -121,14 +126,6 @@ FluTextBox{
|
|||||||
control_popup.visible = true
|
control_popup.visible = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TapHandler {
|
|
||||||
acceptedButtons: Qt.RightButton
|
|
||||||
onTapped: control.echoMode !== TextInput.Password && menu.popup()
|
|
||||||
}
|
|
||||||
FluTextBoxMenu{
|
|
||||||
id:menu
|
|
||||||
inputItem: control
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleClick(modelData){
|
function handleClick(modelData){
|
||||||
control_popup.visible = false
|
control_popup.visible = false
|
||||||
|
100
src/controls/FluBreadcrumbBar.qml
Normal file
100
src/controls/FluBreadcrumbBar.qml
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import FluentUI
|
||||||
|
|
||||||
|
Item {
|
||||||
|
|
||||||
|
property int textSize: 15
|
||||||
|
property string separator: "/"
|
||||||
|
property var items: []
|
||||||
|
property int spacing: 5
|
||||||
|
signal clickItem(var model)
|
||||||
|
|
||||||
|
id:control
|
||||||
|
implicitWidth: 300
|
||||||
|
height: 30
|
||||||
|
|
||||||
|
onItemsChanged: {
|
||||||
|
list_model.clear()
|
||||||
|
list_model.append(items)
|
||||||
|
}
|
||||||
|
|
||||||
|
ListModel{
|
||||||
|
id:list_model
|
||||||
|
}
|
||||||
|
|
||||||
|
ListView{
|
||||||
|
id:list_view
|
||||||
|
width: parent.width
|
||||||
|
height: 30
|
||||||
|
orientation: ListView.Horizontal
|
||||||
|
model: list_model
|
||||||
|
clip: true
|
||||||
|
spacing : control.spacing
|
||||||
|
boundsBehavior: ListView.StopAtBounds
|
||||||
|
remove: Transition {
|
||||||
|
NumberAnimation {
|
||||||
|
properties: "opacity"
|
||||||
|
from: 1
|
||||||
|
to: 0
|
||||||
|
duration: 83
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add: Transition {
|
||||||
|
NumberAnimation {
|
||||||
|
properties: "opacity"
|
||||||
|
from: 0
|
||||||
|
to: 1
|
||||||
|
duration: 83
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delegate: Item{
|
||||||
|
height: item_layout.height
|
||||||
|
width: item_layout.width
|
||||||
|
RowLayout{
|
||||||
|
id:item_layout
|
||||||
|
spacing: list_view.spacing
|
||||||
|
height: list_view.height
|
||||||
|
|
||||||
|
FluText{
|
||||||
|
text:model.title
|
||||||
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
color: {
|
||||||
|
if(item_mouse.pressed){
|
||||||
|
return FluTheme.dark ? Qt.rgba(150/255,150/255,150/235,1) : Qt.rgba(134/255,134/255,134/235,1)
|
||||||
|
}
|
||||||
|
if(item_mouse.containsMouse){
|
||||||
|
return FluTheme.dark ? Qt.rgba(204/255,204/255,204/235,1) : Qt.rgba(92/255,92/255,92/235,1)
|
||||||
|
}
|
||||||
|
return FluTheme.dark ? Qt.rgba(255/255,255/255,255/235,1) : Qt.rgba(26/255,26/255,26/235,1)
|
||||||
|
}
|
||||||
|
MouseArea{
|
||||||
|
id:item_mouse
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
onClicked: {
|
||||||
|
control.clickItem(model)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FluText{
|
||||||
|
text:control.separator
|
||||||
|
font.pixelSize: control.textSize
|
||||||
|
visible: list_view.count-1 !== index
|
||||||
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function remove(index,count){
|
||||||
|
list_model.remove(index,count)
|
||||||
|
}
|
||||||
|
|
||||||
|
function count(){
|
||||||
|
return list_model.count
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -17,7 +17,6 @@ Button {
|
|||||||
rightPadding:15
|
rightPadding:15
|
||||||
enabled: !disabled
|
enabled: !disabled
|
||||||
focusPolicy:Qt.TabFocus
|
focusPolicy:Qt.TabFocus
|
||||||
|
|
||||||
Keys.onSpacePressed: control.visualFocus&&clicked()
|
Keys.onSpacePressed: control.visualFocus&&clicked()
|
||||||
|
|
||||||
background: Rectangle{
|
background: Rectangle{
|
||||||
|
@ -12,9 +12,11 @@ Item {
|
|||||||
id:control
|
id:control
|
||||||
width: 400
|
width: 400
|
||||||
height: 300
|
height: 300
|
||||||
|
|
||||||
ListModel{
|
ListModel{
|
||||||
id:content_model
|
id:content_model
|
||||||
}
|
}
|
||||||
|
|
||||||
FluRectangle{
|
FluRectangle{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
radius: [control.radius,control.radius,control.radius,control.radius]
|
radius: [control.radius,control.radius,control.radius,control.radius]
|
||||||
@ -105,9 +107,6 @@ Item {
|
|||||||
return false
|
return false
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
layer.samples: 4
|
|
||||||
layer.enabled: true
|
|
||||||
layer.smooth: true
|
|
||||||
border.width: 1
|
border.width: 1
|
||||||
border.color: FluColors.Grey100
|
border.color: FluColors.Grey100
|
||||||
color: list_view.currentIndex === index ? FluTheme.primaryColor.dark : Qt.rgba(1,1,1,0.5)
|
color: list_view.currentIndex === index ? FluTheme.primaryColor.dark : Qt.rgba(1,1,1,0.5)
|
||||||
|
@ -29,6 +29,28 @@ Popup {
|
|||||||
anchors.centerIn: Overlay.overlay
|
anchors.centerIn: Overlay.overlay
|
||||||
closePolicy: Popup.CloseOnEscape
|
closePolicy: Popup.CloseOnEscape
|
||||||
background:Item{}
|
background:Item{}
|
||||||
|
|
||||||
|
enter: Transition {
|
||||||
|
reversible: true
|
||||||
|
NumberAnimation {
|
||||||
|
properties: "opacity,scale"
|
||||||
|
from:0
|
||||||
|
to:1
|
||||||
|
duration: 167
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: [ 0, 0, 0, 1 ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exit:Transition {
|
||||||
|
NumberAnimation {
|
||||||
|
properties: "opacity,scale"
|
||||||
|
from:1
|
||||||
|
to:0
|
||||||
|
duration: 167
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: [ 1, 0, 0, 0 ]
|
||||||
|
}
|
||||||
|
}
|
||||||
contentItem: Rectangle {
|
contentItem: Rectangle {
|
||||||
id:layout_content
|
id:layout_content
|
||||||
implicitWidth:minWidth
|
implicitWidth:minWidth
|
||||||
|
@ -14,7 +14,6 @@ Rectangle {
|
|||||||
property bool changeFlag: true
|
property bool changeFlag: true
|
||||||
readonly property var rowData: ["","",""]
|
readonly property var rowData: ["","",""]
|
||||||
|
|
||||||
|
|
||||||
id:root
|
id:root
|
||||||
color: {
|
color: {
|
||||||
if(mouse_area.containsMouse){
|
if(mouse_area.containsMouse){
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
|
||||||
color: FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,230/255,234/255,1)
|
color: FluTheme.dark ? Window.active ? Qt.rgba(55/255,55/255,55/255,1):Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,230/255,234/255,1)
|
||||||
|
|
||||||
Behavior on color{
|
Behavior on color{
|
||||||
ColorAnimation {
|
ColorAnimation {
|
||||||
|
@ -91,7 +91,6 @@ Button {
|
|||||||
FluMenu{
|
FluMenu{
|
||||||
id:menu
|
id:menu
|
||||||
width: control.width
|
width: control.width
|
||||||
animEnabled: true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Window
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@ -20,8 +21,20 @@ Item {
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
height: 45
|
height: 45
|
||||||
radius: 4
|
radius: 4
|
||||||
color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
|
color: FluTheme.dark ? Window.active ? Qt.rgba(38/255,44/255,54/255,1) : Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
|
||||||
border.color: FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1)
|
border.color: FluTheme.dark ? Window.active ? Qt.rgba(55/255,55/255,55/255,1) : Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1)
|
||||||
|
|
||||||
|
Behavior on color{
|
||||||
|
ColorAnimation {
|
||||||
|
duration: 300
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on border.color{
|
||||||
|
ColorAnimation {
|
||||||
|
duration: 300
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MouseArea{
|
MouseArea{
|
||||||
id:root_mouse
|
id:root_mouse
|
||||||
|
@ -8,7 +8,6 @@ Item {
|
|||||||
id:root
|
id:root
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: -3
|
anchors.margins: -3
|
||||||
|
|
||||||
Rectangle{
|
Rectangle{
|
||||||
width: root.width
|
width: root.width
|
||||||
height: root.height
|
height: root.height
|
||||||
|
@ -39,7 +39,6 @@ Button {
|
|||||||
id:control
|
id:control
|
||||||
width: 30
|
width: 30
|
||||||
height: 30
|
height: 30
|
||||||
clip: true
|
|
||||||
implicitWidth: width
|
implicitWidth: width
|
||||||
implicitHeight: height
|
implicitHeight: height
|
||||||
padding: 0
|
padding: 0
|
||||||
|
@ -5,7 +5,7 @@ import QtQuick.Controls
|
|||||||
Menu {
|
Menu {
|
||||||
|
|
||||||
default property alias content: container.data
|
default property alias content: container.data
|
||||||
property bool animEnabled: false
|
property bool enableAnimation: true
|
||||||
id: popup
|
id: popup
|
||||||
width: 140
|
width: 140
|
||||||
height: container.height
|
height: container.height
|
||||||
@ -17,7 +17,7 @@ Menu {
|
|||||||
property: "opacity"
|
property: "opacity"
|
||||||
from:0
|
from:0
|
||||||
to:1
|
to:1
|
||||||
duration: 83
|
duration: enableAnimation ? 83 : 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ Menu {
|
|||||||
property: "opacity"
|
property: "opacity"
|
||||||
from:1
|
from:1
|
||||||
to:0
|
to:0
|
||||||
duration: 83
|
duration: enableAnimation ? 83 : 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,7 +39,9 @@ Menu {
|
|||||||
clip: true
|
clip: true
|
||||||
Rectangle{
|
Rectangle{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color:FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,0.97) : Qt.rgba(237/255,237/255,237/255,0.97)
|
color:FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(249/255,249/255,249/255,1)
|
||||||
|
border.color: FluTheme.dark ? Window.active ? Qt.rgba(55/255,55/255,55/255,1):Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1)
|
||||||
|
border.width: 1
|
||||||
radius: 5
|
radius: 5
|
||||||
}
|
}
|
||||||
Column{
|
Column{
|
||||||
|
@ -4,12 +4,13 @@ import QtQuick.Controls
|
|||||||
Item {
|
Item {
|
||||||
|
|
||||||
property string text: "MenuItem"
|
property string text: "MenuItem"
|
||||||
|
property var onClickFunc
|
||||||
signal clicked
|
signal clicked
|
||||||
|
|
||||||
id:root
|
id:control
|
||||||
width: {
|
width: {
|
||||||
if(root.parent){
|
if(control.parent){
|
||||||
return root.parent.width
|
return control.parent.width
|
||||||
}
|
}
|
||||||
return 140
|
return 140
|
||||||
}
|
}
|
||||||
@ -18,7 +19,7 @@ Item {
|
|||||||
|
|
||||||
Rectangle{
|
Rectangle{
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
width: root.width-40
|
width: control.width-40
|
||||||
height: 32
|
height: 32
|
||||||
radius: 4
|
radius: 4
|
||||||
color:{
|
color:{
|
||||||
@ -36,7 +37,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
text: root.text
|
text: control.text
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,8 +46,12 @@ Item {
|
|||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: {
|
onClicked: {
|
||||||
root.clicked()
|
if(control.onClickFunc){
|
||||||
root.parent.closePopup()
|
control.onClickFunc()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
control.parent.closePopup()
|
||||||
|
control.clicked()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -509,6 +509,7 @@ Item {
|
|||||||
onClicked: {
|
onClicked: {
|
||||||
d.enableNavigationPanel = !d.enableNavigationPanel
|
d.enableNavigationPanel = !d.enableNavigationPanel
|
||||||
}
|
}
|
||||||
|
visible: Layout.preferredWidth !== 0
|
||||||
Behavior on Layout.preferredWidth{
|
Behavior on Layout.preferredWidth{
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 167
|
duration: 167
|
||||||
@ -620,7 +621,7 @@ Item {
|
|||||||
return FluTheme.dark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(243/255,243/255,243/255,1)
|
return FluTheme.dark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(243/255,243/255,243/255,1)
|
||||||
}
|
}
|
||||||
if(window && window.active){
|
if(window && window.active){
|
||||||
return FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(238/255,244/255,249/255,1)
|
return FluTheme.dark ? Qt.rgba(26/255,34/255,41/255,1) : Qt.rgba(238/255,244/255,249/255,1)
|
||||||
}
|
}
|
||||||
return FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1)
|
return FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1)
|
||||||
}
|
}
|
||||||
@ -639,7 +640,7 @@ Item {
|
|||||||
width: layout_list.width
|
width: layout_list.width
|
||||||
clip: true
|
clip: true
|
||||||
y:nav_app_bar.height
|
y:nav_app_bar.height
|
||||||
height: 38
|
height: autoSuggestBox ? 38 : 0
|
||||||
Loader{
|
Loader{
|
||||||
id:loader_auto_suggest_box
|
id:loader_auto_suggest_box
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
@ -4,13 +4,12 @@ import FluentUI
|
|||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
|
||||||
|
|
||||||
id:control
|
|
||||||
default property alias content: d.children
|
default property alias content: d.children
|
||||||
property alias currentIndex: nav_list.currentIndex
|
property alias currentIndex: nav_list.currentIndex
|
||||||
property color normalColor: FluTheme.dark ? FluColors.Grey120 : FluColors.Grey120
|
property color normalColor: FluTheme.dark ? FluColors.Grey120 : FluColors.Grey120
|
||||||
property color hoverColor: FluTheme.dark ? FluColors.Grey10 : FluColors.Black
|
property color hoverColor: FluTheme.dark ? FluColors.Grey10 : FluColors.Black
|
||||||
|
|
||||||
|
id:control
|
||||||
width: 400
|
width: 400
|
||||||
height: 300
|
height: 300
|
||||||
implicitHeight: height
|
implicitHeight: height
|
||||||
|
@ -11,7 +11,7 @@ FluRectangle {
|
|||||||
height: 5
|
height: 5
|
||||||
radius: [3,3,3,3]
|
radius: [3,3,3,3]
|
||||||
clip: true
|
clip: true
|
||||||
color: FluTheme.dark ? Qt.rgba(41/255,41/255,41/255,1) : Qt.rgba(214/255,214/255,214/255,1)
|
color: FluTheme.dark ? Qt.rgba(99/255,99/255,99/255,1) : Qt.rgba(214/255,214/255,214/255,1)
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if(indeterminate){
|
if(indeterminate){
|
||||||
|
@ -15,7 +15,7 @@ Rectangle {
|
|||||||
radius: 22
|
radius: 22
|
||||||
border.width: linWidth
|
border.width: linWidth
|
||||||
color: "#00000000"
|
color: "#00000000"
|
||||||
border.color: FluTheme.dark ? Qt.rgba(41/255,41/255,41/255,1) : Qt.rgba(214/255,214/255,214/255,1)
|
border.color: FluTheme.dark ? Qt.rgba(99/255,99/255,99/255,1) : Qt.rgba(214/255,214/255,214/255,1)
|
||||||
|
|
||||||
onProgressChanged: {
|
onProgressChanged: {
|
||||||
canvas.requestPaint()
|
canvas.requestPaint()
|
||||||
|
@ -25,9 +25,6 @@ Button {
|
|||||||
width: 20
|
width: 20
|
||||||
height: 20
|
height: 20
|
||||||
radius: 10
|
radius: 10
|
||||||
layer.samples: 4
|
|
||||||
layer.enabled: true
|
|
||||||
layer.smooth: true
|
|
||||||
border.width: {
|
border.width: {
|
||||||
if(selected&&disabled){
|
if(selected&&disabled){
|
||||||
return 3
|
return 3
|
||||||
|
@ -3,12 +3,13 @@ import QtQuick.Controls
|
|||||||
import Qt5Compat.GraphicalEffects
|
import Qt5Compat.GraphicalEffects
|
||||||
|
|
||||||
Item{
|
Item{
|
||||||
id:control
|
|
||||||
property var radius:[0,0,0,0]
|
property var radius:[0,0,0,0]
|
||||||
property color color : "#FFFFFF"
|
property color color : "#FFFFFF"
|
||||||
property bool shadow: true
|
property bool shadow: true
|
||||||
default property alias contentItem: container.data
|
default property alias contentItem: container.data
|
||||||
|
|
||||||
|
id:control
|
||||||
FluShadow{
|
FluShadow{
|
||||||
anchors.fill: container
|
anchors.fill: container
|
||||||
radius: control.radius[0]
|
radius: control.radius[0]
|
||||||
|
@ -3,13 +3,13 @@ import QtQuick.Controls
|
|||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
ScrollBar {
|
ScrollBar {
|
||||||
id: control
|
|
||||||
|
|
||||||
property color handleNormalColor: Qt.rgba(134/255,134/255,134/255,1)
|
property color handleNormalColor: Qt.rgba(134/255,134/255,134/255,1)
|
||||||
property color handleHoverColor: Qt.lighter(handleNormalColor)
|
property color handleHoverColor: Qt.lighter(handleNormalColor)
|
||||||
property color handlePressColor: Qt.darker(handleNormalColor)
|
property color handlePressColor: Qt.darker(handleNormalColor)
|
||||||
property bool expand: false
|
property bool expand: false
|
||||||
|
|
||||||
|
id: control
|
||||||
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||||
implicitContentWidth + leftPadding + rightPadding)
|
implicitContentWidth + leftPadding + rightPadding)
|
||||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||||
@ -90,9 +90,6 @@ ScrollBar {
|
|||||||
implicitWidth: expand ? 8 : 2
|
implicitWidth: expand ? 8 : 2
|
||||||
implicitHeight: expand ? 8 : 2
|
implicitHeight: expand ? 8 : 2
|
||||||
radius: width / 2
|
radius: width / 2
|
||||||
layer.samples: 4
|
|
||||||
layer.enabled: true
|
|
||||||
layer.smooth: true
|
|
||||||
color: control.pressed?handlePressColor:control.hovered?handleHoverColor:handleNormalColor
|
color: control.pressed?handlePressColor:control.hovered?handleHoverColor:handleNormalColor
|
||||||
opacity:(control.policy === ScrollBar.AlwaysOn || control.size < 1.0)?1.0:0.0
|
opacity:(control.policy === ScrollBar.AlwaysOn || control.size < 1.0)?1.0:0.0
|
||||||
}
|
}
|
||||||
|
@ -5,21 +5,6 @@ import FluentUI
|
|||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
|
||||||
id:control
|
|
||||||
anchors.fill: {
|
|
||||||
if(parent)
|
|
||||||
return parent
|
|
||||||
return undefined
|
|
||||||
}
|
|
||||||
|
|
||||||
implicitHeight: height
|
|
||||||
implicitWidth: width
|
|
||||||
|
|
||||||
MouseArea{
|
|
||||||
anchors.fill: parent
|
|
||||||
preventStealing: true
|
|
||||||
}
|
|
||||||
|
|
||||||
enum TabWidthBehavior {
|
enum TabWidthBehavior {
|
||||||
Equal,
|
Equal,
|
||||||
SizeToContent,
|
SizeToContent,
|
||||||
@ -35,8 +20,18 @@ Item {
|
|||||||
property int tabWidthBehavior : FluTabView.Equal
|
property int tabWidthBehavior : FluTabView.Equal
|
||||||
property int closeButtonVisibility : FluTabView.Always
|
property int closeButtonVisibility : FluTabView.Always
|
||||||
property int itemWidth: 146
|
property int itemWidth: 146
|
||||||
|
property bool addButtonVisibility: true
|
||||||
signal newPressed
|
signal newPressed
|
||||||
|
|
||||||
|
id:control
|
||||||
|
implicitHeight: height
|
||||||
|
implicitWidth: width
|
||||||
|
anchors.fill: {
|
||||||
|
if(parent)
|
||||||
|
return parent
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: d
|
id: d
|
||||||
property int dragIndex: -1
|
property int dragIndex: -1
|
||||||
@ -45,12 +40,18 @@ Item {
|
|||||||
property int maxEqualWidth: 240
|
property int maxEqualWidth: 240
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MouseArea{
|
||||||
|
anchors.fill: parent
|
||||||
|
preventStealing: true
|
||||||
|
}
|
||||||
|
|
||||||
ListModel{
|
ListModel{
|
||||||
id:tab_model
|
id:tab_model
|
||||||
}
|
}
|
||||||
|
|
||||||
FluIconButton{
|
FluIconButton{
|
||||||
id:btn_new
|
id:btn_new
|
||||||
|
visible: addButtonVisibility
|
||||||
width: 34
|
width: 34
|
||||||
height: 34
|
height: 34
|
||||||
x:Math.min(tab_nav.contentWidth,tab_nav.width)
|
x:Math.min(tab_nav.contentWidth,tab_nav.width)
|
||||||
|
@ -5,7 +5,6 @@ import FluentUI
|
|||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
|
||||||
id:control
|
|
||||||
property var columns : []
|
property var columns : []
|
||||||
property var dataSource : []
|
property var dataSource : []
|
||||||
property int pageCurrent: 1
|
property int pageCurrent: 1
|
||||||
@ -14,6 +13,7 @@ Item {
|
|||||||
property int itemHeight: 56
|
property int itemHeight: 56
|
||||||
signal requestPage(int page,int count)
|
signal requestPage(int page,int count)
|
||||||
|
|
||||||
|
id:control
|
||||||
implicitHeight: layout_coumns.height + layout_table.height
|
implicitHeight: layout_coumns.height + layout_table.height
|
||||||
|
|
||||||
MouseArea{
|
MouseArea{
|
||||||
|
@ -3,10 +3,6 @@ import FluentUI
|
|||||||
|
|
||||||
Text {
|
Text {
|
||||||
|
|
||||||
property int fontStyle: FluText.Body
|
|
||||||
property color textColor: FluTheme.dark ? FluColors.White : FluColors.Grey220
|
|
||||||
property int pixelSize : FluTheme.textSize
|
|
||||||
|
|
||||||
enum FontStyle {
|
enum FontStyle {
|
||||||
Display,
|
Display,
|
||||||
TitleLarge,
|
TitleLarge,
|
||||||
@ -17,6 +13,10 @@ Text {
|
|||||||
Caption
|
Caption
|
||||||
}
|
}
|
||||||
|
|
||||||
|
property int fontStyle: FluText.Body
|
||||||
|
property color textColor: FluTheme.dark ? FluColors.White : FluColors.Grey220
|
||||||
|
property int pixelSize : FluTheme.textSize
|
||||||
|
|
||||||
id:text
|
id:text
|
||||||
color: textColor
|
color: textColor
|
||||||
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
import Qt5Compat.GraphicalEffects
|
import Qt5Compat.GraphicalEffects
|
||||||
|
|
||||||
Rectangle{
|
Rectangle{
|
||||||
id:content
|
|
||||||
|
|
||||||
property Item inputItem
|
property Item inputItem
|
||||||
|
|
||||||
|
id:content
|
||||||
radius: 4
|
radius: 4
|
||||||
layer.enabled: true
|
layer.enabled: true
|
||||||
color: {
|
color: {
|
||||||
@ -48,7 +48,9 @@ Rectangle{
|
|||||||
}
|
}
|
||||||
Behavior on height{
|
Behavior on height{
|
||||||
NumberAnimation{
|
NumberAnimation{
|
||||||
duration: 200
|
duration: 167
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: [ 1, 0, 0, 0 ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,34 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
FluMenu{
|
FluMenu{
|
||||||
|
|
||||||
property string cutText : "剪切"
|
property string cutText : "剪切"
|
||||||
property string copyText : "复制"
|
property string copyText : "复制"
|
||||||
property string pasteText : "粘贴"
|
property string pasteText : "粘贴"
|
||||||
property string selectAllText : "全选"
|
property string selectAllText : "全选"
|
||||||
property var inputItem
|
property var inputItem
|
||||||
|
|
||||||
id:menu
|
id:menu
|
||||||
focus: false
|
focus:false
|
||||||
|
enableAnimation:false
|
||||||
|
|
||||||
|
Connections{
|
||||||
|
target: inputItem
|
||||||
|
function onTextChanged() {
|
||||||
|
menu.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FluMenuItem{
|
FluMenuItem{
|
||||||
text: cutText
|
text: cutText
|
||||||
visible: inputItem.text !== "" && !inputItem.readOnly
|
visible: inputItem.selectedText !== "" && !inputItem.readOnly
|
||||||
onClicked: {
|
onClicked: {
|
||||||
inputItem.cut()
|
inputItem.cut()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluMenuItem{
|
FluMenuItem{
|
||||||
text: copyText
|
text: copyText
|
||||||
visible: inputItem.selectedText !== ""
|
visible: inputItem.selectedText !== ""
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user