mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-07-01 15:42:20 +08:00
Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
ee3ddf7732 | |||
6d238871ee | |||
9d3de073c0 | |||
7282a6f8d1 | |||
2b9e9b2159 | |||
23bc5cdf68 | |||
f75da5e3ce | |||
8cc828a56b |
@ -12,9 +12,9 @@ Window {
|
||||
FluApp.init(app,properties)
|
||||
FluTheme.isDark = false
|
||||
FluApp.routes = {
|
||||
"/":"qrc:/MainPage.qml",
|
||||
"/Setting":"qrc:/SettingPage.qml",
|
||||
"/About":"qrc:/AboutPage.qml",
|
||||
"/":"qrc:/page/MainPage.qml",
|
||||
"/about":"qrc:/page/AboutPage.qml",
|
||||
"/login":"qrc:/page/LoginPage.qml",
|
||||
}
|
||||
FluApp.initialRoute = "/"
|
||||
FluApp.run()
|
||||
|
@ -1,29 +0,0 @@
|
||||
import QtQuick 2.15
|
||||
import FluentUI 1.0
|
||||
|
||||
FluWindow {
|
||||
|
||||
width: 500
|
||||
height: 600
|
||||
title:"设置"
|
||||
|
||||
FluAppBar{
|
||||
id:appbar
|
||||
title:"设置"
|
||||
}
|
||||
|
||||
FluText{
|
||||
text:"设置"
|
||||
fontStyle: FluText.Display
|
||||
anchors.centerIn: parent
|
||||
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
FluApp.navigate("/About")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -47,7 +47,7 @@ FluContentPage {
|
||||
height: 80
|
||||
FluIconButton{
|
||||
id:item_icon
|
||||
icon:modelData.icon
|
||||
iconSource:modelData.icon
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
onClicked: {
|
||||
var text ="FluentIcons."+modelData.name;
|
||||
|
@ -10,8 +10,8 @@ FluScrollablePage{
|
||||
spacing: 20
|
||||
|
||||
FluText{
|
||||
Layout.topMargin: 20
|
||||
text:"支持Tab键切换焦点,Enter键执行点击事件"
|
||||
Layout.topMargin: 20
|
||||
text:"支持Tab键切换焦点,空格键执行点击事件"
|
||||
}
|
||||
|
||||
FluArea{
|
||||
@ -20,7 +20,8 @@ FluScrollablePage{
|
||||
paddings: 10
|
||||
|
||||
FluButton{
|
||||
disabled:button_switch.checked
|
||||
disabled:button_switch.selected
|
||||
text:"Standard Button"
|
||||
onClicked: {
|
||||
showInfo("点击StandardButton")
|
||||
}
|
||||
@ -52,9 +53,10 @@ FluScrollablePage{
|
||||
paddings: 10
|
||||
|
||||
FluFilledButton{
|
||||
disabled:filled_button_switch.checked
|
||||
disabled:filled_button_switch.selected
|
||||
text:"Filled Button"
|
||||
onClicked: {
|
||||
showWarning("点击FilledButton")
|
||||
showWarning("点击FilledButton")
|
||||
}
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
@ -85,8 +87,8 @@ FluScrollablePage{
|
||||
paddings: 10
|
||||
|
||||
FluIconButton{
|
||||
icon:FluentIcons.ChromeCloseContrast
|
||||
disabled:icon_button_switch.checked
|
||||
iconSource:FluentIcons.ChromeCloseContrast
|
||||
disabled:icon_button_switch.selected
|
||||
iconSize: 15
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
@ -129,8 +131,8 @@ FluScrollablePage{
|
||||
property int selecIndex : 0
|
||||
model: 3
|
||||
delegate: FluRadioButton{
|
||||
checked : repeater.selecIndex===index
|
||||
disabled:radio_button_switch.checked
|
||||
selected : repeater.selecIndex===index
|
||||
disabled:radio_button_switch.selected
|
||||
text:"Radio Button_"+index
|
||||
onClicked:{
|
||||
repeater.selecIndex = index
|
||||
@ -163,7 +165,8 @@ FluScrollablePage{
|
||||
paddings: 10
|
||||
|
||||
FluCheckBox{
|
||||
disabled:icon_button_check.checked
|
||||
disabled:check_box_switch.selected
|
||||
text:"Check Box"
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
@ -178,7 +181,7 @@ FluScrollablePage{
|
||||
right: parent.right
|
||||
}
|
||||
FluToggleSwitch{
|
||||
id:icon_button_check
|
||||
id:check_box_switch
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
FluText{
|
||||
|
@ -26,7 +26,7 @@ FluScrollablePage{
|
||||
property int selecIndex : 0
|
||||
model: 3
|
||||
delegate: FluRadioButton{
|
||||
checked : repeater.selecIndex===index
|
||||
selected : repeater.selecIndex===index
|
||||
text:"Radio Button_"+index
|
||||
onClicked:{
|
||||
repeater.selecIndex = index
|
||||
|
54
example/T_Menu.qml
Normal file
54
example/T_Menu.qml
Normal file
@ -0,0 +1,54 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtQuick.Window 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtGraphicalEffects 1.15
|
||||
import FluentUI 1.0
|
||||
|
||||
FluScrollablePage{
|
||||
|
||||
title:"Menu"
|
||||
|
||||
FluButton{
|
||||
text:"左击菜单"
|
||||
Layout.topMargin: 20
|
||||
Layout.leftMargin: 15
|
||||
onClicked:{
|
||||
menu.popup()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FluButton{
|
||||
text:"右击菜单"
|
||||
Layout.topMargin: 20
|
||||
Layout.leftMargin: 15
|
||||
onClicked: {
|
||||
showSuccess("请按鼠标右击")
|
||||
}
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.RightButton
|
||||
onClicked: {
|
||||
menu.popup()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FluMenu{
|
||||
id:menu
|
||||
FluMenuItem{
|
||||
text:"删除"
|
||||
onClicked: {
|
||||
showError("删除")
|
||||
}
|
||||
}
|
||||
FluMenuItem{
|
||||
text:"修改"
|
||||
onClicked: {
|
||||
showError("修改")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
77
example/T_MultiWindow.qml
Normal file
77
example/T_MultiWindow.qml
Normal file
@ -0,0 +1,77 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtQuick.Window 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import FluentUI 1.0
|
||||
|
||||
FluScrollablePage{
|
||||
|
||||
title:"MultiWindow"
|
||||
|
||||
property string password: ""
|
||||
|
||||
property var loginPageRegister: registerForPageResult("/login")
|
||||
|
||||
Connections{
|
||||
target: loginPageRegister
|
||||
function onResult(data)
|
||||
{
|
||||
password = data.password
|
||||
}
|
||||
}
|
||||
|
||||
FluArea{
|
||||
width: parent.width
|
||||
height: 100
|
||||
paddings: 10
|
||||
Layout.topMargin: 20
|
||||
|
||||
Column{
|
||||
spacing: 15
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
}
|
||||
FluText{
|
||||
text:"页面跳转,不携带任何参数"
|
||||
}
|
||||
FluButton{
|
||||
text:"点击跳转"
|
||||
onClicked: {
|
||||
FluApp.navigate("/about")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FluArea{
|
||||
width: parent.width
|
||||
height: 130
|
||||
paddings: 10
|
||||
Layout.topMargin: 20
|
||||
|
||||
Column{
|
||||
spacing: 15
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
}
|
||||
FluText{
|
||||
text:"页面跳转,并携带参数用户名:zhuzichu"
|
||||
}
|
||||
FluButton{
|
||||
text:"点击跳转到登录"
|
||||
onClicked: {
|
||||
loginPageRegister.launch({username:"zhuzichu"})
|
||||
}
|
||||
}
|
||||
|
||||
FluText{
|
||||
text:"登录窗口返回过来的密码->"+password
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -20,7 +20,7 @@ FluScrollablePage{
|
||||
color: mouse_item.containsMouse ? Qt.lighter(modelData.normal,1.1) : modelData.normal
|
||||
FluIcon {
|
||||
anchors.centerIn: parent
|
||||
icon: FluentIcons.AcceptMedium
|
||||
iconSource: FluentIcons.AcceptMedium
|
||||
iconSize: 15
|
||||
visible: modelData === FluTheme.primaryColor
|
||||
color: FluTheme.isDark ? Qt.rgba(0,0,0,1) : Qt.rgba(1,1,1,1)
|
||||
@ -41,8 +41,8 @@ FluScrollablePage{
|
||||
Layout.topMargin: 20
|
||||
}
|
||||
FluToggleSwitch{
|
||||
checked: FluTheme.isDark
|
||||
onClickFunc:function(){
|
||||
selected: FluTheme.isDark
|
||||
clickFunc:function(){
|
||||
FluTheme.isDark = !FluTheme.isDark
|
||||
}
|
||||
}
|
||||
@ -51,8 +51,8 @@ FluScrollablePage{
|
||||
Layout.topMargin: 20
|
||||
}
|
||||
FluToggleSwitch{
|
||||
checked: FluTheme.isFrameless
|
||||
onClickFunc:function(){
|
||||
selected: FluTheme.isFrameless
|
||||
clickFunc:function(){
|
||||
FluTheme.isFrameless = !FluTheme.isFrameless
|
||||
}
|
||||
}
|
||||
@ -61,8 +61,8 @@ FluScrollablePage{
|
||||
Layout.topMargin: 20
|
||||
}
|
||||
FluToggleSwitch{
|
||||
checked: FluTheme.isNativeText
|
||||
onClickFunc:function(){
|
||||
selected: FluTheme.isNativeText
|
||||
clickFunc:function(){
|
||||
FluTheme.isNativeText = !FluTheme.isNativeText
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ FluWindow {
|
||||
fontStyle: FluText.Title
|
||||
}
|
||||
FluText{
|
||||
text:"v1.0.5"
|
||||
text:"v1.0.7"
|
||||
fontStyle: FluText.Body
|
||||
Layout.alignment: Qt.AlignBottom
|
||||
}
|
||||
@ -70,6 +70,28 @@ FluWindow {
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout{
|
||||
spacing: 14
|
||||
Layout.topMargin: 20
|
||||
Layout.leftMargin: 15
|
||||
FluText{
|
||||
id:text_info
|
||||
text:"如果该项目对你有作用,就请点击上方链接给一个免费的star吧!"
|
||||
ColorAnimation {
|
||||
id: animation
|
||||
target: text_info
|
||||
property: "color"
|
||||
from: "red"
|
||||
to: "blue"
|
||||
duration: 1000
|
||||
running: true
|
||||
loops: Animation.Infinite
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
72
example/page/LoginPage.qml
Normal file
72
example/page/LoginPage.qml
Normal file
@ -0,0 +1,72 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import FluentUI 1.0
|
||||
|
||||
FluWindow {
|
||||
|
||||
id:window
|
||||
width: 400
|
||||
height: 400
|
||||
minimumWidth: 400
|
||||
minimumHeight: 400
|
||||
maximumWidth: 400
|
||||
maximumHeight: 400
|
||||
modality:2
|
||||
|
||||
title:"登录"
|
||||
|
||||
onInitArgument:
|
||||
(argument)=>{
|
||||
textbox_uesrname.text = argument.username
|
||||
textbox_password.focus = true
|
||||
}
|
||||
|
||||
FluAppBar{
|
||||
id:appbar
|
||||
title:"登录"
|
||||
}
|
||||
|
||||
ColumnLayout{
|
||||
anchors{
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
|
||||
FluAutoSuggestBox{
|
||||
id:textbox_uesrname
|
||||
values:["Admin","User"]
|
||||
placeholderText: "请输入账号"
|
||||
Layout.preferredWidth: 260
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
}
|
||||
|
||||
FluTextBox{
|
||||
id:textbox_password
|
||||
Layout.topMargin: 20
|
||||
Layout.preferredWidth: 260
|
||||
placeholderText: "请输入密码"
|
||||
echoMode:TextInput.Password
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
}
|
||||
|
||||
FluFilledButton{
|
||||
text:"登录"
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
Layout.topMargin: 20
|
||||
onClicked:{
|
||||
if(textbox_password.text === ""){
|
||||
showError("请随便输入一个密码")
|
||||
return
|
||||
}
|
||||
onResult({password:textbox_password.text})
|
||||
window.close()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -9,7 +9,7 @@ import FluentUI 1.0
|
||||
FluWindow {
|
||||
id:rootwindow
|
||||
width: 860
|
||||
height: 680
|
||||
height: 600
|
||||
title: "FluentUI"
|
||||
minimumWidth: 500
|
||||
minimumHeight: 400
|
||||
@ -59,6 +59,13 @@ FluWindow {
|
||||
}
|
||||
}
|
||||
|
||||
FluPaneItem{
|
||||
title:"Menu"
|
||||
onTap:{
|
||||
nav_view.push("qrc:/T_Menu.qml")
|
||||
}
|
||||
}
|
||||
|
||||
FluPaneItem{
|
||||
title:"TimePicker"
|
||||
onTap:{
|
||||
@ -126,6 +133,14 @@ FluWindow {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FluPaneItem{
|
||||
title:"MultiWindow"
|
||||
onTap:{
|
||||
nav_view.push("qrc:/T_MultiWindow.qml")
|
||||
}
|
||||
}
|
||||
|
||||
FluPaneItemHeader{
|
||||
title:"Theming"
|
||||
}
|
||||
@ -164,7 +179,7 @@ FluWindow {
|
||||
FluPaneItem{
|
||||
title:"关于"
|
||||
onTap:{
|
||||
FluApp.navigate("/About")
|
||||
FluApp.navigate("/about")
|
||||
}
|
||||
}
|
||||
}
|
@ -1,15 +1,8 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>T_ToggleSwitch.qml</file>
|
||||
<file>T_Typography.qml</file>
|
||||
|
||||
<file>App.qml</file>
|
||||
<file>SettingPage.qml</file>
|
||||
<file>AboutPage.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>res/image/image_huoyin.webp</file>
|
||||
<file>res/svg/avatar_1.svg</file>
|
||||
<file>res/svg/avatar_2.svg</file>
|
||||
@ -23,14 +16,27 @@
|
||||
<file>res/svg/avatar_10.svg</file>
|
||||
<file>res/svg/avatar_11.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>MainPage.qml</file>
|
||||
<file>T_TimePicker.qml</file>
|
||||
<file>T_DatePicker.qml</file>
|
||||
<file>T_MultiWindow.qml</file>
|
||||
<file>T_Menu.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -33,14 +33,18 @@ void FluApp::run(){
|
||||
navigate(initialRoute());
|
||||
}
|
||||
|
||||
void FluApp::navigate(const QString& route){
|
||||
void FluApp::navigate(const QString& route,const QJsonObject& argument,FluRegister* fluRegister){
|
||||
if(!routes().contains(route)){
|
||||
qErrnoWarning("没有找到当前路由");
|
||||
return;
|
||||
}
|
||||
bool isAppWindow = route == initialRoute();
|
||||
FramelessView *view = new FramelessView();
|
||||
|
||||
if(fluRegister){
|
||||
fluRegister->to(view);
|
||||
view->setProperty("pageRegister",QVariant::fromValue(fluRegister));
|
||||
}
|
||||
view->setProperty("argument",argument);
|
||||
QMapIterator<QString, QVariant> iterator(properties);
|
||||
while (iterator.hasNext()) {
|
||||
iterator.next();
|
||||
@ -59,7 +63,6 @@ void FluApp::navigate(const QString& route){
|
||||
view->setSource((routes().value(route).toString()));
|
||||
if(isAppWindow){
|
||||
QObject::connect(view->engine(), &QQmlEngine::quit, qApp, &QCoreApplication::quit);
|
||||
// QObject::connect(qApp, &QGuiApplication::aboutToQuit, qApp, [&view](){view->setSource({});});
|
||||
}else{
|
||||
view->closeDeleteLater();
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <QQmlContext>
|
||||
#include <QJsonObject>
|
||||
#include <QQmlEngine>
|
||||
#include "FluRegister.h"
|
||||
#include "FramelessView.h"
|
||||
#include "stdafx.h"
|
||||
|
||||
@ -24,7 +25,7 @@ public:
|
||||
|
||||
Q_INVOKABLE void run();
|
||||
|
||||
Q_INVOKABLE void navigate(const QString& route);
|
||||
Q_INVOKABLE void navigate(const QString& route,const QJsonObject& argument = {},FluRegister* fluRegister = nullptr);
|
||||
|
||||
Q_INVOKABLE void init(QWindow *window,QMap<QString, QVariant> properties);
|
||||
|
||||
@ -37,9 +38,8 @@ public:
|
||||
Q_INVOKABLE void clipText(const QString& text);
|
||||
|
||||
private:
|
||||
|
||||
static FluApp* m_instance;
|
||||
QMap<QString, QVariant> properties;
|
||||
static FluApp* m_instance;
|
||||
QWindow *appWindow;
|
||||
|
||||
};
|
||||
|
20
src/FluRegister.cpp
Normal file
20
src/FluRegister.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
#include "FluRegister.h"
|
||||
|
||||
#include "FluApp.h"
|
||||
#include <QCoreApplication>
|
||||
|
||||
FluRegister::FluRegister(QObject *parent)
|
||||
: QObject{parent}
|
||||
{
|
||||
from(nullptr);
|
||||
to(nullptr);
|
||||
path("");
|
||||
}
|
||||
|
||||
void FluRegister::launch(const QJsonObject& argument){
|
||||
FluApp::getInstance()->navigate(path(),argument,this);
|
||||
}
|
||||
|
||||
void FluRegister::onResult(const QJsonObject& data){
|
||||
Q_EMIT result(data);
|
||||
}
|
24
src/FluRegister.h
Normal file
24
src/FluRegister.h
Normal file
@ -0,0 +1,24 @@
|
||||
#ifndef FLUREGISTER_H
|
||||
#define FLUREGISTER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <FramelessView.h>
|
||||
#include <QJsonObject>
|
||||
#include "stdafx.h"
|
||||
|
||||
class FluRegister : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY_AUTO(FramelessView*,from)
|
||||
Q_PROPERTY_AUTO(FramelessView*,to)
|
||||
Q_PROPERTY_AUTO(QString,path);
|
||||
public:
|
||||
explicit FluRegister(QObject *parent = nullptr);
|
||||
|
||||
Q_INVOKABLE void launch(const QJsonObject& argument = {});
|
||||
Q_INVOKABLE void onResult(const QJsonObject& data = {});
|
||||
Q_SIGNAL void result(const QJsonObject& data);
|
||||
|
||||
};
|
||||
|
||||
#endif // FLUREGISTER_H
|
@ -15,6 +15,7 @@ HEADERS += \
|
||||
FluApp.h \
|
||||
FluColorSet.h \
|
||||
FluColors.h \
|
||||
FluRegister.h \
|
||||
FluTheme.h \
|
||||
Fluent.h \
|
||||
FluentUI.h \
|
||||
@ -28,6 +29,7 @@ SOURCES += \
|
||||
FluApp.cpp \
|
||||
FluColorSet.cpp \
|
||||
FluColors.cpp \
|
||||
FluRegister.cpp \
|
||||
FluTheme.cpp \
|
||||
Fluent.cpp \
|
||||
FluentUI.cpp \
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "WindowHelper.h"
|
||||
|
||||
#include "FluRegister.h"
|
||||
|
||||
WindowHelper::WindowHelper(QObject *parent)
|
||||
: QObject{parent}
|
||||
{
|
||||
@ -10,11 +12,18 @@ void WindowHelper::setTitle(const QString& text){
|
||||
window->setTitle(text);
|
||||
}
|
||||
|
||||
|
||||
void WindowHelper::initWindow(FramelessView* window){
|
||||
this->window = window;
|
||||
}
|
||||
|
||||
QJsonObject WindowHelper::getArgument(){
|
||||
return window->property("argument").toJsonObject();
|
||||
}
|
||||
|
||||
QVariant WindowHelper::getPageRegister(){
|
||||
return window->property("pageRegister");
|
||||
}
|
||||
|
||||
void WindowHelper::setMinimumWidth(int width){
|
||||
this->window->setMinimumWidth(width);
|
||||
}
|
||||
@ -27,3 +36,25 @@ void WindowHelper::setMinimumHeight(int 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::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);
|
||||
return QVariant::fromValue(p);
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <QQuickWindow>
|
||||
#include <QQuickItem>
|
||||
#include <QWindow>
|
||||
#include <QJsonObject>
|
||||
#include "FramelessView.h"
|
||||
|
||||
class WindowHelper : public QObject
|
||||
@ -20,6 +21,11 @@ public:
|
||||
Q_INVOKABLE void setMaximumWidth(int width);
|
||||
Q_INVOKABLE void setMinimumHeight(int height);
|
||||
Q_INVOKABLE void setMaximumHeight(int height);
|
||||
Q_INVOKABLE QJsonObject getArgument();
|
||||
Q_INVOKABLE QVariant getPageRegister();
|
||||
Q_INVOKABLE void updateWindow();
|
||||
Q_INVOKABLE void setModality(int type);
|
||||
Q_INVOKABLE QVariant createRegister(const QString& path);
|
||||
|
||||
private:
|
||||
FramelessView* window;
|
||||
|
@ -93,15 +93,15 @@ Rectangle{
|
||||
fontStyle: FluText.Body
|
||||
}
|
||||
FluToggleSwitch{
|
||||
checked: FluTheme.isDark
|
||||
onClickFunc:function(){
|
||||
selected: FluTheme.isDark
|
||||
clickFunc:function(){
|
||||
FluTheme.isDark = !FluTheme.isDark
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FluIconButton{
|
||||
icon : FluentIcons.ChromeMinimizeContrast
|
||||
iconSource : FluentIcons.ChromeMinimizeContrast
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
iconSize: 15
|
||||
text:"最小化"
|
||||
@ -117,7 +117,7 @@ Rectangle{
|
||||
return false
|
||||
return Window.Maximized === window.visibility
|
||||
}
|
||||
icon : isRestore ? FluentIcons.ChromeRestoreContrast : FluentIcons.ChromeMaximizeContrast
|
||||
iconSource : isRestore ? FluentIcons.ChromeRestoreContrast : FluentIcons.ChromeMaximizeContrast
|
||||
color:hovered ? "#20000000" : "#00000000"
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
visible: resizable
|
||||
@ -129,7 +129,7 @@ Rectangle{
|
||||
}
|
||||
}
|
||||
FluIconButton{
|
||||
icon : FluentIcons.ChromeCloseContrast
|
||||
iconSource : FluentIcons.ChromeCloseContrast
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
text:"关闭"
|
||||
iconSize: 13
|
||||
|
@ -7,7 +7,7 @@ TextField{
|
||||
property var values:[]
|
||||
property int fontStyle: FluText.Body
|
||||
property int pixelSize : FluTheme.textSize
|
||||
property int icon: -1
|
||||
property int iconSource: 0
|
||||
signal itemClicked(string data)
|
||||
|
||||
id:input
|
||||
@ -91,7 +91,7 @@ TextField{
|
||||
inputItem: input
|
||||
|
||||
FluIconButton{
|
||||
icon:FluentIcons.ChromeClose
|
||||
iconSource:FluentIcons.ChromeClose
|
||||
iconSize: 10
|
||||
width: 20
|
||||
height: 20
|
||||
@ -109,10 +109,10 @@ TextField{
|
||||
|
||||
FluIcon{
|
||||
id:icon_right
|
||||
icon: input.icon
|
||||
iconSource: input.iconSource
|
||||
iconSize: 15
|
||||
opacity: 0.5
|
||||
visible: input.icon != -1
|
||||
visible: input.iconSource != 0
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
right: parent.right
|
||||
|
@ -2,39 +2,22 @@
|
||||
import QtQuick.Controls 2.15
|
||||
import FluentUI 1.0
|
||||
|
||||
Control {
|
||||
id: control
|
||||
Button {
|
||||
|
||||
property string text: "Standard Button"
|
||||
property bool disabled: false
|
||||
|
||||
|
||||
property color normalColor: FluTheme.isDark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(254/255,254/255,254/255,1)
|
||||
property color hoverColor: FluTheme.isDark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
|
||||
property color disableColor: FluTheme.isDark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(252/255,252/255,252/255,1)
|
||||
|
||||
signal clicked
|
||||
|
||||
id: control
|
||||
topPadding:5
|
||||
bottomPadding:5
|
||||
leftPadding:15
|
||||
rightPadding:15
|
||||
|
||||
enabled: !disabled
|
||||
focusPolicy:Qt.TabFocus
|
||||
Keys.onEnterPressed:(visualFocus&&handleClick())
|
||||
Keys.onReturnPressed:(visualFocus&&handleClick())
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: handleClick()
|
||||
}
|
||||
|
||||
function handleClick(){
|
||||
if(disabled){
|
||||
return
|
||||
}
|
||||
control.clicked()
|
||||
}
|
||||
Keys.onSpacePressed: control.visualFocus&&clicked()
|
||||
|
||||
background: Rectangle{
|
||||
border.color: FluTheme.isDark ? "#505050" : "#DFDFDF"
|
||||
@ -51,7 +34,6 @@ Control {
|
||||
return hovered ? hoverColor :normalColor
|
||||
}
|
||||
}
|
||||
|
||||
contentItem: FluText {
|
||||
text: control.text
|
||||
anchors.centerIn: parent
|
||||
@ -71,5 +53,4 @@ Control {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,55 +3,42 @@ import QtQuick.Controls 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import FluentUI 1.0
|
||||
|
||||
Control {
|
||||
|
||||
id:control
|
||||
property bool checked: false
|
||||
property string text: "Check Box"
|
||||
property var checkClicked
|
||||
Button {
|
||||
|
||||
property bool selected: false
|
||||
property var clickFunc
|
||||
property bool disabled: false
|
||||
|
||||
property color borderNormalColor: FluTheme.isDark ? Qt.rgba(160/255,160/255,160/255,1) : Qt.rgba(136/255,136/255,136/255,1)
|
||||
property color borderCheckedColor: FluTheme.isDark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
||||
property color borderSelectedColor: FluTheme.isDark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
||||
property color borderHoverColor: FluTheme.isDark ? Qt.rgba(167/255,167/255,167/255,1) : Qt.rgba(135/255,135/255,135/255,1)
|
||||
property color borderDisableColor: FluTheme.isDark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1)
|
||||
|
||||
property color normalColor: FluTheme.isDark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(247/255,247/255,247/255,1)
|
||||
property color checkedColor: FluTheme.isDark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
||||
property color selectedColor: FluTheme.isDark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
||||
property color hoverColor: FluTheme.isDark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(244/255,244/255,244/255,1)
|
||||
property color checkedHoverColor: FluTheme.isDark ? Qt.darker(checkedColor,1.1) : Qt.lighter(checkedColor,1.1)
|
||||
|
||||
property color checkedDisableColor: FluTheme.isDark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1)
|
||||
property color selectedHoverColor: FluTheme.isDark ? Qt.darker(selectedColor,1.1) : Qt.lighter(selectedColor,1.1)
|
||||
property color selectedDisableColor: FluTheme.isDark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1)
|
||||
property color disableColor: FluTheme.isDark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(253/255,253/255,253/255,1)
|
||||
|
||||
|
||||
id:control
|
||||
enabled: !disabled
|
||||
focusPolicy:Qt.TabFocus
|
||||
Keys.onEnterPressed:(visualFocus&&handleClick())
|
||||
Keys.onReturnPressed:(visualFocus&&handleClick())
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: handleClick()
|
||||
}
|
||||
|
||||
function handleClick(){
|
||||
Keys.onSpacePressed: control.visualFocus&&clicked()
|
||||
padding:0
|
||||
onClicked: {
|
||||
if(disabled){
|
||||
return
|
||||
}
|
||||
if(checkClicked){
|
||||
checkClicked()
|
||||
if(clickFunc){
|
||||
clickFunc()
|
||||
return
|
||||
}
|
||||
checked = !checked
|
||||
selected = !selected
|
||||
}
|
||||
|
||||
background: Item{
|
||||
FluFocusRectangle{
|
||||
visible: control.visualFocus
|
||||
}
|
||||
}
|
||||
|
||||
contentItem: RowLayout{
|
||||
spacing: 4
|
||||
Rectangle{
|
||||
@ -62,8 +49,8 @@ Control {
|
||||
if(disabled){
|
||||
return borderDisableColor
|
||||
}
|
||||
if(checked){
|
||||
return borderCheckedColor
|
||||
if(selected){
|
||||
return borderSelectedColor
|
||||
}
|
||||
if(hovered){
|
||||
return borderHoverColor
|
||||
@ -72,26 +59,25 @@ Control {
|
||||
}
|
||||
border.width: 1
|
||||
color: {
|
||||
if(checked){
|
||||
if(selected){
|
||||
if(disabled){
|
||||
return checkedDisableColor
|
||||
return selectedDisableColor
|
||||
}
|
||||
if(hovered){
|
||||
return checkedHoverColor
|
||||
return selectedHoverColor
|
||||
}
|
||||
return checkedColor
|
||||
return selectedColor
|
||||
}
|
||||
if(hovered){
|
||||
return hoverColor
|
||||
}
|
||||
return normalColor
|
||||
}
|
||||
|
||||
FluIcon {
|
||||
anchors.centerIn: parent
|
||||
icon: FluentIcons.AcceptMedium
|
||||
iconSource: FluentIcons.AcceptMedium
|
||||
iconSize: 15
|
||||
visible: checked
|
||||
visible: selected
|
||||
color: FluTheme.isDark ? Qt.rgba(0,0,0,1) : Qt.rgba(1,1,1,1)
|
||||
}
|
||||
}
|
||||
@ -99,5 +85,4 @@ Control {
|
||||
text:control.text
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ Item {
|
||||
return FluTheme.isDark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(254/255,254/255,254/255,1)
|
||||
}
|
||||
iconSize: 15
|
||||
icon: expand ? FluentIcons.ChevronUp : FluentIcons.ChevronDown
|
||||
iconSource: expand ? FluentIcons.ChevronUp : FluentIcons.ChevronDown
|
||||
onClicked: {
|
||||
expand = !expand
|
||||
}
|
||||
|
@ -2,35 +2,21 @@
|
||||
import QtQuick.Controls 2.15
|
||||
import FluentUI 1.0
|
||||
|
||||
Control {
|
||||
Button {
|
||||
id: control
|
||||
|
||||
property string text: "Filled Button"
|
||||
property bool disabled: false
|
||||
property color normalColor: FluTheme.isDark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
||||
property color hoverColor: FluTheme.isDark ? Qt.darker(normalColor,1.1) : Qt.lighter(normalColor,1.1)
|
||||
property color disableColor: FluTheme.isDark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1)
|
||||
signal clicked
|
||||
|
||||
enabled: !disabled
|
||||
topPadding:5
|
||||
bottomPadding:5
|
||||
leftPadding:15
|
||||
rightPadding:15
|
||||
Keys.onSpacePressed: control.visualFocus&&clicked()
|
||||
focusPolicy:Qt.TabFocus
|
||||
Keys.onEnterPressed:(visualFocus&&handleClick())
|
||||
Keys.onReturnPressed:(visualFocus&&handleClick())
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: handleClick()
|
||||
}
|
||||
|
||||
function handleClick(){
|
||||
if(disabled)
|
||||
return
|
||||
control.clicked()
|
||||
}
|
||||
|
||||
background: Rectangle{
|
||||
radius: 4
|
||||
FluFocusRectangle{
|
||||
@ -44,7 +30,6 @@ Control {
|
||||
return hovered ? hoverColor :normalColor
|
||||
}
|
||||
}
|
||||
|
||||
contentItem: FluText {
|
||||
text: control.text
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
@ -61,6 +46,4 @@ Control {
|
||||
}
|
||||
font.pixelSize: 14
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
Text {
|
||||
|
||||
property int icon
|
||||
property int iconSource
|
||||
property int iconSize: 20
|
||||
property color iconColor: FluTheme.isDark ? "#FFFFFF" : "#000000"
|
||||
|
||||
@ -12,5 +12,5 @@ Text {
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: iconColor
|
||||
text: (String.fromCharCode(icon).toString(16));
|
||||
text: (String.fromCharCode(iconSource).toString(16));
|
||||
}
|
||||
|
@ -2,29 +2,20 @@
|
||||
import QtQuick.Controls 2.15
|
||||
import FluentUI 1.0
|
||||
|
||||
Control {
|
||||
|
||||
id:control
|
||||
width: 30
|
||||
height: 30
|
||||
Button {
|
||||
|
||||
property int iconSize: 20
|
||||
property int icon
|
||||
property alias text: tool_tip.text
|
||||
signal clicked
|
||||
property int iconSource
|
||||
property bool disabled: false
|
||||
|
||||
property color hoverColor: FluTheme.isDark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(0,0,0,0.03)
|
||||
property color normalColor: FluTheme.isDark ? Qt.rgba(0,0,0,0) : Qt.rgba(0,0,0,0)
|
||||
property color disableColor: FluTheme.isDark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(0,0,0,0)
|
||||
|
||||
property color color: {
|
||||
if(disabled){
|
||||
return disableColor
|
||||
}
|
||||
return hovered ? hoverColor : normalColor
|
||||
}
|
||||
|
||||
property color textColor: {
|
||||
if(FluTheme.isDark){
|
||||
if(disabled){
|
||||
@ -39,22 +30,15 @@ Control {
|
||||
}
|
||||
}
|
||||
|
||||
id:control
|
||||
width: 30
|
||||
height: 30
|
||||
implicitWidth: width
|
||||
implicitHeight: height
|
||||
padding: 0
|
||||
enabled: !disabled
|
||||
focusPolicy:Qt.TabFocus
|
||||
Keys.onEnterPressed:(visualFocus&&handleClick())
|
||||
Keys.onReturnPressed:(visualFocus&&handleClick())
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: handleClick()
|
||||
}
|
||||
|
||||
function handleClick(){
|
||||
if(disabled){
|
||||
return
|
||||
}
|
||||
control.clicked()
|
||||
}
|
||||
|
||||
Keys.onSpacePressed: control.visualFocus&&clicked()
|
||||
background: Rectangle{
|
||||
radius: 4
|
||||
color:control.color
|
||||
@ -62,19 +46,19 @@ Control {
|
||||
visible: control.visualFocus
|
||||
}
|
||||
}
|
||||
|
||||
contentItem: Item{
|
||||
Text {
|
||||
id:text_icon
|
||||
font.family: "Segoe Fluent Icons"
|
||||
font.pixelSize: iconSize
|
||||
width: iconSize
|
||||
height: iconSize
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
anchors.centerIn: parent
|
||||
color:control.textColor
|
||||
text: (String.fromCharCode(icon).toString(16));
|
||||
text: (String.fromCharCode(iconSource).toString(16));
|
||||
}
|
||||
|
||||
FluTooltip{
|
||||
id:tool_tip
|
||||
visible: {
|
||||
@ -83,11 +67,8 @@ Control {
|
||||
}
|
||||
return hovered
|
||||
}
|
||||
text:control.text
|
||||
delay: 1000
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ FluObject {
|
||||
spacing: 10
|
||||
|
||||
FluIcon{
|
||||
icon:{
|
||||
iconSource:{
|
||||
switch(_super.type){
|
||||
case mcontrol.const_success: return FluentIcons.CompletedSolid;
|
||||
case mcontrol.const_warning: return FluentIcons.InfoSolid;
|
||||
|
@ -2,9 +2,9 @@
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtQuick.Controls 2.15
|
||||
|
||||
Popup {
|
||||
Menu {
|
||||
id: popup
|
||||
default property alias content: container.children
|
||||
default property alias content: container.data
|
||||
|
||||
background: Rectangle {
|
||||
implicitWidth: 140
|
||||
|
@ -145,7 +145,7 @@ Item {
|
||||
height:parent.height
|
||||
spacing: 0
|
||||
FluIconButton{
|
||||
icon: FluentIcons.ChromeBack
|
||||
iconSource: FluentIcons.ChromeBack
|
||||
Layout.leftMargin: 5
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
disabled: nav_swipe.depth === 1
|
||||
@ -160,7 +160,7 @@ Item {
|
||||
}
|
||||
}
|
||||
FluIconButton{
|
||||
icon: FluentIcons.GlobalNavButton
|
||||
iconSource: FluentIcons.GlobalNavButton
|
||||
Layout.leftMargin: 5
|
||||
iconSize: 15
|
||||
visible: displayMode === FluNavigationView.Minimal
|
||||
@ -184,8 +184,8 @@ Item {
|
||||
fontStyle: FluText.Body
|
||||
}
|
||||
FluToggleSwitch{
|
||||
checked: FluTheme.isDark
|
||||
onClickFunc:function(){
|
||||
selected: FluTheme.isDark
|
||||
clickFunc:function(){
|
||||
FluTheme.isDark = !FluTheme.isDark
|
||||
}
|
||||
}
|
||||
@ -269,7 +269,7 @@ Item {
|
||||
FluAutoSuggestBox{
|
||||
width: 280
|
||||
anchors.centerIn: parent
|
||||
icon: FluentIcons.Zoom
|
||||
iconSource: FluentIcons.Zoom
|
||||
values: {
|
||||
var arr = []
|
||||
if(items==null)
|
||||
|
@ -4,38 +4,21 @@ import QtQuick.Layouts 1.15
|
||||
import FluentUI 1.0
|
||||
|
||||
|
||||
Control {
|
||||
Button {
|
||||
|
||||
id:control
|
||||
property bool checked: false
|
||||
property string text: "RodioButton"
|
||||
signal clicked
|
||||
property bool selected: false
|
||||
property bool disabled: false
|
||||
|
||||
id:control
|
||||
enabled: !disabled
|
||||
focusPolicy:Qt.TabFocus
|
||||
Keys.onEnterPressed:(visualFocus&&handleClick())
|
||||
Keys.onReturnPressed:(visualFocus&&handleClick())
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: handleClick()
|
||||
}
|
||||
|
||||
function handleClick(){
|
||||
if(disabled){
|
||||
return
|
||||
}
|
||||
|
||||
control.clicked()
|
||||
}
|
||||
|
||||
|
||||
padding:0
|
||||
background: Item{
|
||||
FluFocusRectangle{
|
||||
visible: control.visualFocus
|
||||
}
|
||||
}
|
||||
|
||||
Keys.onSpacePressed: control.visualFocus&&clicked()
|
||||
contentItem: RowLayout{
|
||||
Rectangle{
|
||||
id:rect_check
|
||||
@ -46,22 +29,22 @@ Control {
|
||||
layer.enabled: true
|
||||
layer.smooth: true
|
||||
border.width: {
|
||||
if(checked&&disabled){
|
||||
if(selected&&disabled){
|
||||
return 3
|
||||
}
|
||||
if(hovered){
|
||||
if(checked){
|
||||
if(selected){
|
||||
return 5
|
||||
}
|
||||
return 1
|
||||
}
|
||||
if(hovered){
|
||||
if(checked){
|
||||
if(selected){
|
||||
return 3
|
||||
}
|
||||
return 1
|
||||
}
|
||||
return checked ? 5 : 1
|
||||
return selected ? 5 : 1
|
||||
}
|
||||
Behavior on border.width {
|
||||
NumberAnimation{
|
||||
@ -76,7 +59,7 @@ Control {
|
||||
return Qt.rgba(198/255,198/255,198/255,1)
|
||||
}
|
||||
}
|
||||
if(checked){
|
||||
if(selected){
|
||||
if(FluTheme.isDark){
|
||||
return FluTheme.primaryColor.lighter
|
||||
}else{
|
||||
@ -93,7 +76,7 @@ Control {
|
||||
}
|
||||
}
|
||||
color:{
|
||||
if(disabled&&checked){
|
||||
if(disabled&&selected){
|
||||
return Qt.rgba(159/255,159/255,159/255,1)
|
||||
}
|
||||
if(FluTheme.isDark){
|
||||
@ -103,7 +86,7 @@ Control {
|
||||
return Qt.rgba(50/255,50/255,50/255,1)
|
||||
}else{
|
||||
if(hovered){
|
||||
if(checked){
|
||||
if(selected){
|
||||
return Qt.rgba(1,1,1,1)
|
||||
}
|
||||
return Qt.rgba(222/255,222/255,222/255,1)
|
||||
@ -112,14 +95,10 @@ Control {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FluText{
|
||||
text: control.text
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -2,76 +2,66 @@
|
||||
import QtQuick.Controls 2.0
|
||||
import FluentUI 1.0
|
||||
|
||||
Switch {
|
||||
id: root
|
||||
property var onClickFunc
|
||||
Button {
|
||||
|
||||
property bool selected: false
|
||||
property var clickFunc
|
||||
|
||||
id: control
|
||||
width: 40
|
||||
implicitWidth: 40
|
||||
height: 20
|
||||
implicitHeight: 20
|
||||
checkable: false
|
||||
|
||||
background:FluFocusRectangle{
|
||||
visible: root.visualFocus
|
||||
radius: 20
|
||||
focusPolicy:Qt.TabFocus
|
||||
Keys.onSpacePressed: control.visualFocus&&clicked()
|
||||
onClicked: {
|
||||
if(clickFunc){
|
||||
clickFunc()
|
||||
return
|
||||
}
|
||||
selected = !selected
|
||||
}
|
||||
|
||||
Keys.onEnterPressed:(visualFocus&&handleClick())
|
||||
Keys.onReturnPressed:(visualFocus&&handleClick())
|
||||
|
||||
indicator: Rectangle {
|
||||
width: root.width
|
||||
height: root.height
|
||||
background : Rectangle {
|
||||
width: control.width
|
||||
height: control.height
|
||||
radius: height / 2
|
||||
FluFocusRectangle{
|
||||
visible: control.visualFocus
|
||||
radius: 20
|
||||
}
|
||||
color: {
|
||||
if(FluTheme.isDark){
|
||||
if(root.checked){
|
||||
if(selected){
|
||||
return FluTheme.primaryColor.dark
|
||||
}
|
||||
if(switch_mouse.containsMouse){
|
||||
if(hovered){
|
||||
return "#3E3E3C"
|
||||
}
|
||||
return "#323232"
|
||||
}else{
|
||||
if(root.checked){
|
||||
if(selected){
|
||||
return FluTheme.primaryColor.dark
|
||||
}
|
||||
if(switch_mouse.containsMouse){
|
||||
if(hovered){
|
||||
return "#F4F4F4"
|
||||
}
|
||||
return "#FFFFFF"
|
||||
}
|
||||
}
|
||||
border.width: 1
|
||||
border.color: root.checked ? Qt.lighter(FluTheme.primaryColor.dark,1.2) : "#666666"
|
||||
|
||||
border.color: selected ? Qt.lighter(FluTheme.primaryColor.dark,1.2) : "#666666"
|
||||
Rectangle {
|
||||
x: root.checked ? root.implicitWidth - width - 4 : 4
|
||||
width: root.height - 8
|
||||
height: root.height - 8
|
||||
x: selected ? control.implicitWidth - width - 4 : 4
|
||||
width: control.height - 8
|
||||
height: control.height - 8
|
||||
radius: width / 2
|
||||
scale: switch_mouse.containsMouse ? 1.2 : 1.0
|
||||
scale: hovered ? 1.2 : 1.0
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: root.checked ? "#FFFFFF" : "#666666"
|
||||
// border.color: "#D5D5D5"
|
||||
color: selected ? "#FFFFFF" : "#666666"
|
||||
Behavior on x {
|
||||
NumberAnimation { duration: 200 }
|
||||
}
|
||||
}
|
||||
}
|
||||
MouseArea{
|
||||
id:switch_mouse
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onClicked: handleClick()
|
||||
}
|
||||
|
||||
function handleClick(){
|
||||
if(root.onClickFunc){
|
||||
root.onClickFunc()
|
||||
}else{
|
||||
root.checked = !root.checked
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ Item {
|
||||
FluCheckBox{
|
||||
id:item_layout_checkbox
|
||||
text:""
|
||||
checked: itemModel.multipSelected
|
||||
selected: itemModel.multipSelected
|
||||
visible: selectionMode === FluTreeView.Multiple
|
||||
Layout.leftMargin: 5
|
||||
|
||||
@ -199,7 +199,7 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
checkClicked:function(){
|
||||
clickFunc:function(){
|
||||
if(hasChild){
|
||||
const stack = [itemModel];
|
||||
while (stack.length > 0) {
|
||||
@ -222,7 +222,7 @@ Item {
|
||||
FluIconButton{
|
||||
id:item_layout_expanded
|
||||
color:"#00000000"
|
||||
icon:item_layout.expanded?FluentIcons.ChevronDown:FluentIcons.ChevronRight
|
||||
iconSource:item_layout.expanded?FluentIcons.ChevronDown:FluentIcons.ChevronRight
|
||||
opacity: item_layout.hasChild
|
||||
iconSize: 15
|
||||
onClicked: {
|
||||
|
@ -26,6 +26,11 @@ Item {
|
||||
property int maximumWidth
|
||||
property int minimumHeight
|
||||
property int maximumHeight
|
||||
property int modality:0
|
||||
|
||||
signal initArgument(var argument)
|
||||
|
||||
property var pageRegister
|
||||
|
||||
property int borderless:{
|
||||
if(!FluTheme.isFrameless){
|
||||
@ -76,8 +81,10 @@ Item {
|
||||
target: FluApp
|
||||
function onWindowReady(view){
|
||||
if(FluApp.equalsWindow(view,window)){
|
||||
helper.initWindow(view);
|
||||
helper.setTitle(title);
|
||||
helper.initWindow(view)
|
||||
initArgument(helper.getArgument())
|
||||
pageRegister = helper.getPageRegister()
|
||||
helper.setTitle(title)
|
||||
if(minimumWidth){
|
||||
helper.setMinimumWidth(minimumWidth)
|
||||
}
|
||||
@ -90,6 +97,8 @@ Item {
|
||||
if(maximumHeight){
|
||||
helper.setMaximumHeight(maximumHeight)
|
||||
}
|
||||
helper.setModality(root.modality);
|
||||
helper.updateWindow()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -106,17 +115,31 @@ Item {
|
||||
function showSuccess(text,duration,moremsg){
|
||||
infoBar.showSuccess(text,duration,moremsg);
|
||||
}
|
||||
|
||||
function showInfo(text,duration,moremsg){
|
||||
infoBar.showInfo(text,duration,moremsg);
|
||||
}
|
||||
|
||||
function showWarning(text,duration,moremsg){
|
||||
infoBar.showWarning(text,duration,moremsg);
|
||||
}
|
||||
|
||||
function showError(text,duration,moremsg){
|
||||
infoBar.showError(text,duration,moremsg);
|
||||
}
|
||||
|
||||
function close(){
|
||||
window.close()
|
||||
}
|
||||
|
||||
function registerForPageResult(path){
|
||||
return helper.createRegister(path)
|
||||
}
|
||||
|
||||
function onResult(data){
|
||||
if(pageRegister){
|
||||
pageRegister.onResult(data)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
0
src/macos_install.sh
Executable file → Normal file
0
src/macos_install.sh
Executable file → Normal file
Reference in New Issue
Block a user