Compare commits

...

15 Commits

Author SHA1 Message Date
bd8c80feb8 update 2024-04-04 17:43:58 +08:00
6b617d10d5 update 2024-04-04 17:08:45 +08:00
cf163f5e3b update 2024-04-04 16:53:31 +08:00
b4329fdd0a update 2024-04-04 12:11:08 +08:00
84b2045b5f update 2024-04-04 02:48:26 +08:00
18193a18be update 2024-04-04 02:01:52 +08:00
fe08b08c1f update 2024-04-04 01:10:14 +08:00
ef96618151 update 2024-04-03 21:52:26 +08:00
be34220652 update 2024-04-03 19:31:01 +08:00
5cf0812562 update 2024-04-03 19:30:15 +08:00
c2b845658d update 2024-04-03 13:24:30 +08:00
eb4ec242b1 update 2024-04-03 11:28:18 +08:00
a95916ab03 update 2024-04-03 11:19:35 +08:00
bf5bedc9ed update 2024-04-03 11:09:35 +08:00
7d1666597f update 2024-04-02 00:32:06 +08:00
82 changed files with 680 additions and 707 deletions

View File

@ -194,7 +194,6 @@
<file>res/image/ic_crash.png</file> <file>res/image/ic_crash.png</file>
<file>qml/window/CrashWindow.qml</file> <file>qml/window/CrashWindow.qml</file>
<file>qml/page/T_SplitLayout.qml</file> <file>qml/page/T_SplitLayout.qml</file>
<file>qml/window/FluentInitalizrWindow.qml</file>
<file>res/template/CMakeLists.txt.in</file> <file>res/template/CMakeLists.txt.in</file>
<file>res/template/src/App.qml.in</file> <file>res/template/src/App.qml.in</file>
<file>res/template/src/CMakeLists.txt.in</file> <file>res/template/src/CMakeLists.txt.in</file>
@ -209,5 +208,6 @@
<file>qml/page/T_Sheet.qml</file> <file>qml/page/T_Sheet.qml</file>
<file>qml/page/T_GroupBox.qml</file> <file>qml/page/T_GroupBox.qml</file>
<file>res/image/bg_scenic.jpg</file> <file>res/image/bg_scenic.jpg</file>
<file>qml/window/FluentInitializrWindow.qml</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -38,35 +38,35 @@
</message> </message>
</context> </context>
<context> <context>
<name>FluentInitalizrWindow</name> <name>FluentInitializrWindow</name>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="11"/> <location filename="qml/window/FluentInitializrWindow.qml" line="11"/>
<location filename="qml/window/FluentInitalizrWindow.qml" line="30"/> <location filename="qml/window/FluentInitializrWindow.qml" line="30"/>
<source>FluentUI Initalizr</source> <source>FluentUI Initializr</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="51"/> <location filename="qml/window/FluentInitializrWindow.qml" line="51"/>
<source>Name</source> <source>Name</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="59"/> <location filename="qml/window/FluentInitializrWindow.qml" line="59"/>
<source>Create In</source> <source>Create In</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="63"/> <location filename="qml/window/FluentInitializrWindow.qml" line="63"/>
<source>Browse</source> <source>Browse</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="93"/> <location filename="qml/window/FluentInitializrWindow.qml" line="93"/>
<source>Cancel</source> <source>Cancel</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="101"/> <location filename="qml/window/FluentInitializrWindow.qml" line="101"/>
<source>Create</source> <source>Create</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -85,24 +85,24 @@
</message> </message>
</context> </context>
<context> <context>
<name>InitalizrHelper</name> <name>InitializrHelper</name>
<message> <message>
<location filename="src/helper/InitalizrHelper.cpp" line="77"/> <location filename="src/helper/InitializrHelper.cpp" line="77"/>
<source>The name cannot be empty</source> <source>The name cannot be empty</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="src/helper/InitalizrHelper.cpp" line="81"/> <location filename="src/helper/InitializrHelper.cpp" line="81"/>
<source>The creation path cannot be empty</source> <source>The creation path cannot be empty</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="src/helper/InitalizrHelper.cpp" line="86"/> <location filename="src/helper/InitializrHelper.cpp" line="86"/>
<source>The path does not exist</source> <source>The path does not exist</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="src/helper/InitalizrHelper.cpp" line="92"/> <location filename="src/helper/InitializrHelper.cpp" line="92"/>
<source>%1 folder already exists</source> <source>%1 folder already exists</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -375,6 +375,7 @@
<message> <message>
<location filename="qml/global/ItemsOriginal.qml" line="318"/> <location filename="qml/global/ItemsOriginal.qml" line="318"/>
<source>TableView</source> <source>TableView</source>
<oldsource>TreeView2</oldsource>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
@ -1371,7 +1372,7 @@ My only desire is to be permitted to drive out the traitors and restore the Han.
</message> </message>
<message> <message>
<location filename="qml/page/T_Home.qml" line="32"/> <location filename="qml/page/T_Home.qml" line="32"/>
<source>FluentUI Initalizr</source> <source>FluentUI Initializr</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>

View File

@ -38,35 +38,35 @@
</message> </message>
</context> </context>
<context> <context>
<name>FluentInitalizrWindow</name> <name>FluentInitializrWindow</name>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="11"/> <location filename="qml/window/FluentInitializrWindow.qml" line="11"/>
<location filename="qml/window/FluentInitalizrWindow.qml" line="30"/> <location filename="qml/window/FluentInitializrWindow.qml" line="30"/>
<source>FluentUI Initalizr</source> <source>FluentUI Initializr</source>
<translation type="unfinished">FluentUI脚手架</translation> <translation type="unfinished">FluentUI脚手架</translation>
</message> </message>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="51"/> <location filename="qml/window/FluentInitializrWindow.qml" line="51"/>
<source>Name</source> <source>Name</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="59"/> <location filename="qml/window/FluentInitializrWindow.qml" line="59"/>
<source>Create In</source> <source>Create In</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="63"/> <location filename="qml/window/FluentInitializrWindow.qml" line="63"/>
<source>Browse</source> <source>Browse</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="93"/> <location filename="qml/window/FluentInitializrWindow.qml" line="93"/>
<source>Cancel</source> <source>Cancel</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="qml/window/FluentInitalizrWindow.qml" line="101"/> <location filename="qml/window/FluentInitializrWindow.qml" line="101"/>
<source>Create</source> <source>Create</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -85,26 +85,26 @@
</message> </message>
</context> </context>
<context> <context>
<name>InitalizrHelper</name> <name>InitializrHelper</name>
<message> <message>
<location filename="src/helper/InitalizrHelper.cpp" line="77"/> <location filename="src/helper/InitializrHelper.cpp" line="77"/>
<source>The name cannot be empty</source> <source>The name cannot be empty</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="src/helper/InitalizrHelper.cpp" line="81"/> <location filename="src/helper/InitializrHelper.cpp" line="81"/>
<source>The creation path cannot be empty</source> <source>The creation path cannot be empty</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="src/helper/InitalizrHelper.cpp" line="86"/> <location filename="src/helper/InitializrHelper.cpp" line="86"/>
<source>The path does not exist</source> <source>The path does not exist</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="src/helper/InitalizrHelper.cpp" line="92"/> <location filename="src/helper/InitializrHelper.cpp" line="92"/>
<source>%1 folder already exists</source> <source>%1 folder already exists</source>
<translation type="unfinished"></translation> <translation type="unfinished">%1 </translation>
</message> </message>
</context> </context>
<context> <context>
@ -375,6 +375,7 @@
<message> <message>
<location filename="qml/global/ItemsOriginal.qml" line="318"/> <location filename="qml/global/ItemsOriginal.qml" line="318"/>
<source>TableView</source> <source>TableView</source>
<oldsource>TreeView2</oldsource>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
@ -1402,7 +1403,7 @@ My only desire is to be permitted to drive out the traitors and restore the Han.
</message> </message>
<message> <message>
<location filename="qml/page/T_Home.qml" line="32"/> <location filename="qml/page/T_Home.qml" line="32"/>
<source>FluentUI Initalizr</source> <source>FluentUI Initializr</source>
<translation type="unfinished">FluentUI脚手架</translation> <translation type="unfinished">FluentUI脚手架</translation>
</message> </message>
<message> <message>

View File

@ -70,8 +70,8 @@ FluScrollablePage{
} }
FluFrame{ FluFrame{
width: 500 Layout.preferredWidth: 500
height: 370 Layout.preferredHeight: 370
padding: 10 padding: 10
Layout.topMargin: 20 Layout.topMargin: 20
FluChart{ FluChart{

View File

@ -71,7 +71,7 @@ FluScrollablePage{
anchors.centerIn: parent anchors.centerIn: parent
text: "Acrylic" text: "Acrylic"
color: "#FFFFFF" color: "#FFFFFF"
font.bold: true font: FluTextStyle.Subtitle
} }
MouseArea { MouseArea {
property point clickPos: Qt.point(0,0) property point clickPos: Qt.point(0,0)

View File

@ -58,6 +58,7 @@ FluContentPage {
FluText { FluText {
id:item_name id:item_name
font.pixelSize: 10 font.pixelSize: 10
font.family: FluTextStyle.family
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.top: item_icon.bottom anchors.top: item_icon.bottom
width:parent.width width:parent.width

View File

@ -103,7 +103,6 @@ FluScrollablePage{
horizontalAlignment: Qt.AlignHCenter horizontalAlignment: Qt.AlignHCenter
text:model.title text:model.title
color: FluColors.Grey10 color: FluColors.Grey10
font.pixelSize: 15
} }
} }
} }

View File

@ -12,8 +12,8 @@ FluScrollablePage{
animationEnabled: false animationEnabled: false
header: Item{} header: Item{}
FluentInitalizrWindow{ FluentInitializrWindow{
id:fluent_initalizr id:fluent_Initializr
} }
ListModel{ ListModel{
@ -29,11 +29,11 @@ FluScrollablePage{
} }
ListElement{ ListElement{
icon: "qrc:/example/res/image/favicon.ico" icon: "qrc:/example/res/image/favicon.ico"
title: qsTr("FluentUI Initalizr") title: qsTr("FluentUI Initializr")
desc: qsTr("FluentUI Initializr is a Tool that helps you create and customize Fluent UI projects with various options.") desc: qsTr("FluentUI Initializr is a Tool that helps you create and customize Fluent UI projects with various options.")
url: "https://github.com/zhuzichu520/FluentUI" url: "https://github.com/zhuzichu520/FluentUI"
clicked: function(model){ clicked: function(model){
fluent_initalizr.showDialog() fluent_Initializr.showDialog()
} }
} }
} }
@ -122,6 +122,7 @@ FluScrollablePage{
Layout.leftMargin: 20 Layout.leftMargin: 20
color: FluColors.Grey120 color: FluColors.Grey120
font.pixelSize: 12 font.pixelSize: 12
font.family: FluTextStyle.family
wrapMode: Text.WrapAnywhere wrapMode: Text.WrapAnywhere
} }
} }

View File

@ -42,8 +42,7 @@ FluContentPage{
FluText{ FluText{
color:"#FFFFFF" color:"#FFFFFF"
text:model.index text:model.index
font.bold: true font: FluTextStyle.Title
font.pixelSize: 18
anchors.centerIn: parent anchors.centerIn: parent
} }
} }

View File

@ -8,14 +8,14 @@ import "../component"
FluWindowDialog { FluWindowDialog {
id:window id:window
title:qsTr("FluentUI Initalizr") title:qsTr("FluentUI Initializr")
width: 600 width: 600
height: 400 height: 400
contentDelegate:Component{ contentDelegate:Component{
Item{ Item{
Connections{ Connections{
target: InitalizrHelper target: InitializrHelper
function onError(message){ function onError(message){
showError(message) showError(message)
} }
@ -27,7 +27,7 @@ FluWindowDialog {
FluText{ FluText{
id:text_title id:text_title
text:qsTr("FluentUI Initalizr") text:qsTr("FluentUI Initializr")
font: FluTextStyle.Title font: FluTextStyle.Title
anchors{ anchors{
left: parent.left left: parent.left
@ -102,7 +102,7 @@ FluWindowDialog {
width: 120 width: 120
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
onClicked: { onClicked: {
InitalizrHelper.generate(text_box_name.text,text_box_path.text) InitializrHelper.generate(text_box_name.text,text_box_path.text)
} }
} }
} }

View File

@ -41,7 +41,7 @@ FluWindow {
} }
FluText{ FluText{
text: qsTr("Drag in a qml file") text: qsTr("Drag in a qml file")
font.pixelSize: 26 font: FluTextStyle.Title
anchors.centerIn: parent anchors.centerIn: parent
visible: !loader.itemLodaer().item && loader.statusMode === FluStatusLayoutType.Success visible: !loader.itemLodaer().item && loader.statusMode === FluStatusLayoutType.Success
} }

View File

@ -101,7 +101,7 @@ FluWindow {
width: 186 width: 186
FluMenuItem{ FluMenuItem{
text: qsTr("Open in Separate Window") text: qsTr("Open in Separate Window")
font.pixelSize: 12 font: FluTextStyle.Caption
onClicked: { onClicked: {
FluRouter.navigate("/pageWindow",{title:modelData.title,url:modelData.url}) FluRouter.navigate("/pageWindow",{title:modelData.title,url:modelData.url})
} }

View File

@ -1,16 +1,16 @@
#include "InitalizrHelper.h" #include "InitializrHelper.h"
#include <QDir> #include <QDir>
#include <QGuiApplication> #include <QGuiApplication>
InitalizrHelper::InitalizrHelper(QObject *parent) : QObject(parent) InitializrHelper::InitializrHelper(QObject *parent) : QObject(parent)
{ {
} }
InitalizrHelper::~InitalizrHelper() = default; InitializrHelper::~InitializrHelper() = default;
bool InitalizrHelper::copyDir(const QDir& fromDir, const QDir& toDir, bool coverIfFileExists){ bool InitializrHelper::copyDir(const QDir& fromDir, const QDir& toDir, bool coverIfFileExists){
QDir _formDir = fromDir; QDir _formDir = fromDir;
QDir _toDir = toDir; QDir _toDir = toDir;
if(!_toDir.exists()) if(!_toDir.exists())
@ -44,7 +44,7 @@ bool InitalizrHelper::copyDir(const QDir& fromDir, const QDir& toDir, bool cover
} }
template <typename...Args> template <typename...Args>
void InitalizrHelper::templateToFile(const QString& source,const QString& dest,Args &&...args){ void InitializrHelper::templateToFile(const QString& source,const QString& dest,Args &&...args){
QFile file(source); QFile file(source);
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
QTextStream in(&file); QTextStream in(&file);
@ -67,12 +67,12 @@ void InitalizrHelper::templateToFile(const QString& source,const QString& dest,A
} }
} }
void InitalizrHelper::copyFile(const QString& source,const QString& dest){ void InitializrHelper::copyFile(const QString& source,const QString& dest){
QFile::copy(source,dest); QFile::copy(source,dest);
QFile::setPermissions(dest, QFile::WriteOwner | QFile::WriteUser | QFile::WriteGroup | QFile::WriteOther); QFile::setPermissions(dest, QFile::WriteOwner | QFile::WriteUser | QFile::WriteGroup | QFile::WriteOther);
} }
void InitalizrHelper::generate(const QString& name,const QString& path){ void InitializrHelper::generate(const QString& name,const QString& path){
if(name.isEmpty()){ if(name.isEmpty()){
error(tr("The name cannot be empty")); error(tr("The name cannot be empty"));
return; return;

View File

@ -1,26 +1,26 @@
#ifndef INITALIZRHELPER_H #ifndef INITIALIZRHELPER_H
#define INITALIZRHELPER_H #define INITIALIZRHELPER_H
#include <QObject> #include <QObject>
#include <QtQml/qqml.h> #include <QtQml/qqml.h>
#include <QDir> #include <QDir>
#include "src/singleton.h" #include "src/singleton.h"
class InitalizrHelper : public QObject class InitializrHelper : public QObject
{ {
Q_OBJECT Q_OBJECT
private: private:
explicit InitalizrHelper(QObject* parent = nullptr); explicit InitializrHelper(QObject* parent = nullptr);
bool copyDir(const QDir& fromDir, const QDir& toDir, bool coverIfFileExists = true); bool copyDir(const QDir& fromDir, const QDir& toDir, bool coverIfFileExists = true);
void copyFile(const QString& source,const QString& dest); void copyFile(const QString& source,const QString& dest);
template <typename...Args> template <typename...Args>
void templateToFile(const QString& source,const QString& dest,Args &&...args); void templateToFile(const QString& source,const QString& dest,Args &&...args);
public: public:
SINGLETON(InitalizrHelper) SINGLETON(InitializrHelper)
~InitalizrHelper() override; ~InitializrHelper() override;
Q_INVOKABLE void generate(const QString& name,const QString& path); Q_INVOKABLE void generate(const QString& name,const QString& path);
Q_SIGNAL void error(const QString& message); Q_SIGNAL void error(const QString& message);
Q_SIGNAL void success(const QString& path); Q_SIGNAL void success(const QString& path);
}; };
#endif // INITALIZRHELPER_H #endif // INITIALIZRHELPER_H

View File

@ -15,7 +15,7 @@
#include "src/component/FileWatcher.h" #include "src/component/FileWatcher.h"
#include "src/component/FpsItem.h" #include "src/component/FpsItem.h"
#include "src/helper/SettingsHelper.h" #include "src/helper/SettingsHelper.h"
#include "src/helper/InitalizrHelper.h" #include "src/helper/InitializrHelper.h"
#include "src/helper/TranslateHelper.h" #include "src/helper/TranslateHelper.h"
#include "src/helper/Network.h" #include "src/helper/Network.h"
@ -32,6 +32,9 @@ Q_IMPORT_QML_PLUGIN(FluentUIPlugin)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
const char *uri = "example";
int major = 1;
int minor = 0;
#ifdef WIN32 #ifdef WIN32
::SetUnhandledExceptionFilter(MyUnhandledExceptionFilter); ::SetUnhandledExceptionFilter(MyUnhandledExceptionFilter);
qputenv("QT_QPA_PLATFORM","windows:darkmode=2"); qputenv("QT_QPA_PLATFORM","windows:darkmode=2");
@ -54,8 +57,8 @@ int main(int argc, char *argv[])
QGuiApplication::setApplicationVersion(APPLICATION_VERSION); QGuiApplication::setApplicationVersion(APPLICATION_VERSION);
QGuiApplication::setQuitOnLastWindowClosed(false); QGuiApplication::setQuitOnLastWindowClosed(false);
SettingsHelper::getInstance()->init(argv); SettingsHelper::getInstance()->init(argv);
Log::setup(argv,"example"); Log::setup(argv,uri);
#if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)) #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL); QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
#endif #endif
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
@ -66,9 +69,6 @@ int main(int argc, char *argv[])
#endif #endif
#endif #endif
QGuiApplication app(argc, argv); QGuiApplication app(argc, argv);
const char *uri = "example";
int major = 1;
int minor = 0;
//@uri example //@uri example
qmlRegisterType<CircularReveal>(uri, major, minor, "CircularReveal"); qmlRegisterType<CircularReveal>(uri, major, minor, "CircularReveal");
qmlRegisterType<FileWatcher>(uri, major, minor, "FileWatcher"); qmlRegisterType<FileWatcher>(uri, major, minor, "FileWatcher");
@ -79,7 +79,7 @@ int main(int argc, char *argv[])
TranslateHelper::getInstance()->init(&engine); TranslateHelper::getInstance()->init(&engine);
engine.rootContext()->setContextProperty("AppInfo",AppInfo::getInstance()); engine.rootContext()->setContextProperty("AppInfo",AppInfo::getInstance());
engine.rootContext()->setContextProperty("SettingsHelper",SettingsHelper::getInstance()); engine.rootContext()->setContextProperty("SettingsHelper",SettingsHelper::getInstance());
engine.rootContext()->setContextProperty("InitalizrHelper",InitalizrHelper::getInstance()); engine.rootContext()->setContextProperty("InitializrHelper",InitializrHelper::getInstance());
engine.rootContext()->setContextProperty("TranslateHelper",TranslateHelper::getInstance()); engine.rootContext()->setContextProperty("TranslateHelper",TranslateHelper::getInstance());
engine.rootContext()->setContextProperty("Network",Network::getInstance()); engine.rootContext()->setContextProperty("Network",Network::getInstance());
#ifdef FLUENTUI_BUILD_STATIC_LIB #ifdef FLUENTUI_BUILD_STATIC_LIB

View File

@ -1,4 +1,5 @@
#include "FluColors.h" #include "FluColors.h"
#include "FluTools.h"
FluColors::FluColors(QObject *parent):QObject{parent}{ FluColors::FluColors(QObject *parent):QObject{parent}{
Transparent(QColor(0, 0, 0, 0)); Transparent(QColor(0, 0, 0, 0));
@ -111,17 +112,12 @@ FluColors::FluColors(QObject *parent):QObject{parent}{
FluAccentColor* FluColors::createAccentColor(QColor primaryColor){ FluAccentColor* FluColors::createAccentColor(QColor primaryColor){
FluAccentColor *accentColor = new FluAccentColor(this); FluAccentColor *accentColor = new FluAccentColor(this);
accentColor->darkest(withOpacity(primaryColor,0.7)); accentColor->darkest(FluTools::getInstance()->withOpacity(primaryColor,0.7));
accentColor->darker(withOpacity(primaryColor,0.8)); accentColor->darker(FluTools::getInstance()->withOpacity(primaryColor,0.8));
accentColor->dark(withOpacity(primaryColor,0.9)); accentColor->dark(FluTools::getInstance()->withOpacity(primaryColor,0.9));
accentColor->normal(primaryColor); accentColor->normal(primaryColor);
accentColor->light(withOpacity(primaryColor,0.9)); accentColor->light(FluTools::getInstance()->withOpacity(primaryColor,0.9));
accentColor->lighter(withOpacity(primaryColor,0.8)); accentColor->lighter(FluTools::getInstance()->withOpacity(primaryColor,0.8));
accentColor->lightest(withOpacity(primaryColor,0.7)); accentColor->lightest(FluTools::getInstance()->withOpacity(primaryColor,0.7));
return accentColor; return accentColor;
} }
QColor FluColors::withOpacity(QColor color,qreal opacity){
int alpha = qRound(opacity * 255) & 0xff;
return QColor::fromRgba((alpha << 24) | (color.rgba() & 0xffffff));
}

View File

@ -3,6 +3,7 @@
#include <QObject> #include <QObject>
#include <QtQml/qqml.h> #include <QtQml/qqml.h>
#include "FluAccentColor.h" #include "FluAccentColor.h"
#include "stdafx.h" #include "stdafx.h"
#include "singleton.h" #include "singleton.h"
@ -50,7 +51,6 @@ class FluColors : public QObject
QML_SINGLETON QML_SINGLETON
private: private:
explicit FluColors(QObject *parent = nullptr); explicit FluColors(QObject *parent = nullptr);
QColor withOpacity(QColor color,qreal opacity);
public: public:
SINGLETON(FluColors) SINGLETON(FluColors)
Q_INVOKABLE FluAccentColor* createAccentColor(QColor primaryColor); Q_INVOKABLE FluAccentColor* createAccentColor(QColor primaryColor);

View File

@ -3,6 +3,7 @@
#include <QQuickWindow> #include <QQuickWindow>
#include <QGuiApplication> #include <QGuiApplication>
#include <QScreen> #include <QScreen>
#include <QDateTime>
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#pragma comment (lib,"user32.lib") #pragma comment (lib,"user32.lib")
@ -57,14 +58,16 @@ void FluFrameless::componentComplete(){
} }
_current = window()->winId(); _current = window()->winId();
window()->setFlags(( window()->flags()) | Qt::CustomizeWindowHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint | Qt::FramelessWindowHint); window()->setFlags(( window()->flags()) | Qt::CustomizeWindowHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint | Qt::FramelessWindowHint);
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
if(QQuickWindow::sceneGraphBackend() == "software"){
window()->setFlag(Qt::FramelessWindowHint,false);
}
#endif
if(!_fixSize){ if(!_fixSize){
window()->setFlag(Qt::WindowMaximizeButtonHint); window()->setFlag(Qt::WindowMaximizeButtonHint);
} }
window()->installEventFilter(this); window()->installEventFilter(this);
qApp->installNativeEventFilter(this); qApp->installNativeEventFilter(this);
if(_appbar){
_appbar->installEventFilter(this);
}
if(_maximizeButton){ if(_maximizeButton){
setHitTestVisible(_maximizeButton); setHitTestVisible(_maximizeButton);
} }
@ -230,12 +233,6 @@ bool FluFrameless::nativeEventFilter(const QByteArray &eventType, void *message,
return true; return true;
}else if(uMsg == WM_GETMINMAXINFO){ }else if(uMsg == WM_GETMINMAXINFO){
MINMAXINFO* minmaxInfo = reinterpret_cast<MINMAXINFO *>(lParam); MINMAXINFO* minmaxInfo = reinterpret_cast<MINMAXINFO *>(lParam);
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
minmaxInfo->ptMaxPosition.x = 0;
minmaxInfo->ptMaxPosition.y = 0;
minmaxInfo->ptMaxSize.x = 0;
minmaxInfo->ptMaxSize.y = 0;
#else
auto pixelRatio = window()->devicePixelRatio(); auto pixelRatio = window()->devicePixelRatio();
auto geometry = window()->screen()->availableGeometry(); auto geometry = window()->screen()->availableGeometry();
RECT rect; RECT rect;
@ -244,7 +241,6 @@ bool FluFrameless::nativeEventFilter(const QByteArray &eventType, void *message,
minmaxInfo->ptMaxPosition.y = rect.top - offsetXY.x(); minmaxInfo->ptMaxPosition.y = rect.top - offsetXY.x();
minmaxInfo->ptMaxSize.x = geometry.width()*pixelRatio + offsetXY.x() * 2; minmaxInfo->ptMaxSize.x = geometry.width()*pixelRatio + offsetXY.x() * 2;
minmaxInfo->ptMaxSize.y = geometry.height()*pixelRatio + offsetXY.y() * 2; minmaxInfo->ptMaxSize.y = geometry.height()*pixelRatio + offsetXY.y() * 2;
#endif
return false; return false;
}else if(uMsg == WM_NCRBUTTONDOWN){ }else if(uMsg == WM_NCRBUTTONDOWN){
if (wParam == HTCAPTION) { if (wParam == HTCAPTION) {
@ -425,7 +421,18 @@ bool FluFrameless::eventFilter(QObject *obj, QEvent *ev){
} }
}else{ }else{
if(_hitAppBar()){ if(_hitAppBar()){
window()->startSystemMove(); qint64 clickTimer = QDateTime::currentMSecsSinceEpoch();
qint64 offset = clickTimer - this->_clickTimer;
this->_clickTimer = clickTimer;
if(offset<300){
if(_isMaximized()){
showNormal();
}else{
showMaximized();
}
}else{
window()->startSystemMove();
}
} }
} }
break; break;

View File

@ -54,6 +54,7 @@ private:
qint64 _current; qint64 _current;
int _edges = 0; int _edges = 0;
int _margins = 8; int _margins = 8;
qint64 _clickTimer = 0;
QList<QPointer<QQuickItem>> _hitTestList; QList<QPointer<QQuickItem>> _hitTestList;
}; };

View File

@ -1,35 +1,47 @@
#include "FluTextStyle.h" #include "FluTextStyle.h"
FluTextStyle::FluTextStyle(QObject *parent):QObject{parent}{ FluTextStyle::FluTextStyle(QObject *parent):QObject{parent}{
_family = QFont().defaultFamily();
#ifdef Q_OS_WIN
_family = "微软雅黑";
#endif
QFont caption; QFont caption;
caption.setFamily(_family);
caption.setPixelSize(12); caption.setPixelSize(12);
Caption(caption); Caption(caption);
QFont body; QFont body;
body.setFamily(_family);
body.setPixelSize(13); body.setPixelSize(13);
Body(body); Body(body);
QFont bodyStrong; QFont bodyStrong;
bodyStrong.setFamily(_family);
bodyStrong.setPixelSize(13); bodyStrong.setPixelSize(13);
bodyStrong.setWeight(QFont::DemiBold); bodyStrong.setWeight(QFont::DemiBold);
BodyStrong(bodyStrong); BodyStrong(bodyStrong);
QFont subtitle; QFont subtitle;
subtitle.setFamily(_family);
subtitle.setPixelSize(20); subtitle.setPixelSize(20);
subtitle.setWeight(QFont::DemiBold); subtitle.setWeight(QFont::DemiBold);
Subtitle(subtitle); Subtitle(subtitle);
QFont title; QFont title;
title.setFamily(_family);
title.setPixelSize(28); title.setPixelSize(28);
title.setWeight(QFont::DemiBold); title.setWeight(QFont::DemiBold);
Title(title); Title(title);
QFont titleLarge; QFont titleLarge;
titleLarge.setFamily(_family);
titleLarge.setPixelSize(40); titleLarge.setPixelSize(40);
titleLarge.setWeight(QFont::DemiBold); titleLarge.setWeight(QFont::DemiBold);
TitleLarge(titleLarge); TitleLarge(titleLarge);
QFont display; QFont display;
display.setFamily(_family);
display.setPixelSize(68); display.setPixelSize(68);
display.setWeight(QFont::DemiBold); display.setWeight(QFont::DemiBold);
Display(display); Display(display);

View File

@ -14,6 +14,7 @@ class FluTextStyle : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
Q_PROPERTY_AUTO(QString,family)
Q_PROPERTY_AUTO(QFont,Caption); Q_PROPERTY_AUTO(QFont,Caption);
Q_PROPERTY_AUTO(QFont,Body); Q_PROPERTY_AUTO(QFont,Body);
Q_PROPERTY_AUTO(QFont,BodyStrong); Q_PROPERTY_AUTO(QFont,BodyStrong);

View File

@ -119,8 +119,9 @@ QUrl FluTools::getUrlByFilePath(const QString& path){
return QUrl::fromLocalFile(path); return QUrl::fromLocalFile(path);
} }
QColor FluTools::colorAlpha(const QColor& color,qreal alpha){ QColor FluTools::withOpacity(const QColor& color,qreal opacity){
return QColor(color.red(),color.green(),color.blue(),255*alpha); int alpha = qRound(opacity * 255) & 0xff;
return QColor::fromRgba((alpha << 24) | (color.rgba() & 0xffffff));
} }
QString FluTools::md5(QString text){ QString FluTools::md5(QString text){

View File

@ -39,7 +39,7 @@ public:
Q_INVOKABLE QRect getVirtualGeometry(); Q_INVOKABLE QRect getVirtualGeometry();
Q_INVOKABLE QString getApplicationDirPath(); Q_INVOKABLE QString getApplicationDirPath();
Q_INVOKABLE QUrl getUrlByFilePath(const QString& path); Q_INVOKABLE QUrl getUrlByFilePath(const QString& path);
Q_INVOKABLE QColor colorAlpha(const QColor&,qreal alpha); Q_INVOKABLE QColor withOpacity(const QColor&,qreal alpha);
Q_INVOKABLE QString md5(QString text); Q_INVOKABLE QString md5(QString text);
Q_INVOKABLE QString sha256(QString text); Q_INVOKABLE QString sha256(QString text);
Q_INVOKABLE QString toBase64(QString text); Q_INVOKABLE QString toBase64(QString text);

View File

@ -2,7 +2,7 @@
#include <QMetaEnum> #include <QMetaEnum>
FluNode::FluNode(QObject *parent): QObject{parent}{ FluTreeNode::FluTreeNode(QObject *parent): QObject{parent}{
} }
FluTreeModel::FluTreeModel(QObject *parent): QAbstractItemModel{parent}{ FluTreeModel::FluTreeModel(QObject *parent): QAbstractItemModel{parent}{
@ -41,7 +41,7 @@ QHash<int, QByteArray> FluTreeModel::roleNames() const {
return { {Qt::DisplayRole, "dataModel"} }; return { {Qt::DisplayRole, "dataModel"} };
}; };
void FluTreeModel::setData(QList<FluNode*> data){ void FluTreeModel::setData(QList<FluTreeNode*> data){
beginResetModel(); beginResetModel();
_rows = data; _rows = data;
endResetModel(); endResetModel();
@ -51,20 +51,20 @@ void FluTreeModel::removeRows(int row,int count){
if (row < 0 || row + count > _rows.size() || count==0) if (row < 0 || row + count > _rows.size() || count==0)
return; return;
beginRemoveRows(QModelIndex(),row, row + count - 1); beginRemoveRows(QModelIndex(),row, row + count - 1);
QList<FluNode*> firstPart = _rows.mid(0,row); QList<FluTreeNode*> firstPart = _rows.mid(0,row);
QList<FluNode*> secondPart = _rows.mid(row + count); QList<FluTreeNode*> secondPart = _rows.mid(row + count);
_rows.clear(); _rows.clear();
_rows.append(firstPart); _rows.append(firstPart);
_rows.append(secondPart); _rows.append(secondPart);
endRemoveRows(); endRemoveRows();
} }
void FluTreeModel::insertRows(int row,QList<FluNode*> data){ void FluTreeModel::insertRows(int row,QList<FluTreeNode*> data){
if (row < 0 || row > _rows.size() || data.size() == 0) if (row < 0 || row > _rows.size() || data.size() == 0)
return;; return;;
beginInsertRows(QModelIndex(), row, row + data.size() - 1); beginInsertRows(QModelIndex(), row, row + data.size() - 1);
QList<FluNode*> firstPart = _rows.mid(0, row); QList<FluTreeNode*> firstPart = _rows.mid(0, row);
QList<FluNode*> secondPart = _rows.mid(row); QList<FluTreeNode*> secondPart = _rows.mid(row);
_rows.clear(); _rows.clear();
_rows.append(firstPart); _rows.append(firstPart);
_rows.append(data); _rows.append(data);
@ -79,7 +79,7 @@ QObject* FluTreeModel::getRow(int row){
void FluTreeModel::checkRow(int row,bool checked){ void FluTreeModel::checkRow(int row,bool checked){
auto itemData = _rows.at(row); auto itemData = _rows.at(row);
if(itemData->hasChildren()){ if(itemData->hasChildren()){
QList<FluNode*> stack = itemData->_children; QList<FluTreeNode*> stack = itemData->_children;
std::reverse(stack.begin(), stack.end()); std::reverse(stack.begin(), stack.end());
while (stack.count() > 0) { while (stack.count() > 0) {
auto item = stack.at(stack.count()-1); auto item = stack.at(stack.count()-1);
@ -87,7 +87,7 @@ void FluTreeModel::checkRow(int row,bool checked){
if(!item->hasChildren()){ if(!item->hasChildren()){
item->_checked = checked; item->_checked = checked;
} }
QList<FluNode*> children = item->_children; QList<FluTreeNode*> children = item->_children;
if(!children.isEmpty()){ if(!children.isEmpty()){
std::reverse(children.begin(), children.end()); std::reverse(children.begin(), children.end());
foreach (auto c, children) { foreach (auto c, children) {
@ -101,8 +101,8 @@ void FluTreeModel::checkRow(int row,bool checked){
} }
itemData->_checked = checked; itemData->_checked = checked;
} }
Q_EMIT layoutChanged(QList<QPersistentModelIndex>(),QAbstractItemModel::VerticalSortHint); Q_EMIT dataChanged(index(0,0),index(rowCount()-1,0));
QList<FluNode*> data; QList<FluTreeNode*> data;
foreach (auto item, _dataSource) { foreach (auto item, _dataSource) {
if(!item->hasChildren()){ if(!item->hasChildren()){
if(item->_checked){ if(item->_checked){
@ -119,16 +119,16 @@ void FluTreeModel::setDataSource(QList<QMap<QString,QVariant>> data){
delete _root; delete _root;
_root = nullptr; _root = nullptr;
} }
_root = new FluNode(this); _root = new FluTreeNode(this);
std::reverse(data.begin(), data.end()); std::reverse(data.begin(), data.end());
while (data.count() > 0) { while (data.count() > 0) {
auto item = data.at(data.count()-1); auto item = data.at(data.count()-1);
data.pop_back(); data.pop_back();
FluNode* node = new FluNode(this); FluTreeNode* node = new FluTreeNode(this);
node->_title = item.value("title").toString(); node->_title = item.value("title").toString();
node->_key = item.value("key").toString(); node->_key = item.value("key").toString();
node->_depth = item.value("__depth").toInt(); node->_depth = item.value("__depth").toInt();
node->_parent = item.value("__parent").value<FluNode*>(); node->_parent = item.value("__parent").value<FluTreeNode*>();
node->_isExpanded = true; node->_isExpanded = true;
if(node->_parent){ if(node->_parent){
node->_parent->_children.append(node); node->_parent->_children.append(node);
@ -181,8 +181,8 @@ void FluTreeModel::expand(int row){
_rows.at(row)->_isExpanded = true; _rows.at(row)->_isExpanded = true;
Q_EMIT dataChanged(index(row,0),index(row,0)); Q_EMIT dataChanged(index(row,0),index(row,0));
auto modelData = _rows.at(row); auto modelData = _rows.at(row);
QList<FluNode*> insertData; QList<FluTreeNode*> insertData;
QList<FluNode*> stack = modelData->_children; QList<FluTreeNode*> stack = modelData->_children;
std::reverse(stack.begin(), stack.end()); std::reverse(stack.begin(), stack.end());
while (stack.count() > 0) { while (stack.count() > 0) {
auto item = stack.at(stack.count()-1); auto item = stack.at(stack.count()-1);
@ -190,7 +190,7 @@ void FluTreeModel::expand(int row){
if(item->isShown()){ if(item->isShown()){
insertData.append(item); insertData.append(item);
} }
QList<FluNode*> children = item->_children; QList<FluTreeNode*> children = item->_children;
if(!children.isEmpty()){ if(!children.isEmpty()){
std::reverse(children.begin(), children.end()); std::reverse(children.begin(), children.end());
foreach (auto c, children) { foreach (auto c, children) {
@ -242,7 +242,7 @@ void FluTreeModel::dragAndDrop(int dragIndex,int dropIndex,bool isDropTopArea){
Q_EMIT layoutAboutToBeChanged(); Q_EMIT layoutAboutToBeChanged();
if(dragItem->_parent == dropItem->_parent){ if(dragItem->_parent == dropItem->_parent){
QList<FluNode*>* children = &(dragItem->_parent->_children); QList<FluTreeNode*>* children = &(dragItem->_parent->_children);
int srcIndex = children->indexOf(dragItem); int srcIndex = children->indexOf(dragItem);
int destIndex = children->indexOf(dropItem); int destIndex = children->indexOf(dropItem);
if(dropIndex > dragIndex){ if(dropIndex > dragIndex){
@ -260,14 +260,14 @@ void FluTreeModel::dragAndDrop(int dragIndex,int dropIndex,bool isDropTopArea){
} }
children->move(srcIndex,targetIndex); children->move(srcIndex,targetIndex);
}else{ }else{
QList<FluNode*>* srcChildren = &(dragItem->_parent->_children); QList<FluTreeNode*>* srcChildren = &(dragItem->_parent->_children);
QList<FluNode*>* destChildren = &(dropItem->_parent->_children); QList<FluTreeNode*>* destChildren = &(dropItem->_parent->_children);
int srcIndex = srcChildren->indexOf(dragItem); int srcIndex = srcChildren->indexOf(dragItem);
int destIndex = destChildren->indexOf(dropItem); int destIndex = destChildren->indexOf(dropItem);
dragItem->_depth = dropItem->_depth; dragItem->_depth = dropItem->_depth;
dragItem->_parent = dropItem->_parent; dragItem->_parent = dropItem->_parent;
if(dragItem->hasChildren()){ if(dragItem->hasChildren()){
QList<FluNode*> stack = dragItem->_children; QList<FluTreeNode*> stack = dragItem->_children;
foreach (auto node, stack) { foreach (auto node, stack) {
node->_depth = dragItem->_depth+1; node->_depth = dragItem->_depth+1;
} }
@ -275,7 +275,7 @@ void FluTreeModel::dragAndDrop(int dragIndex,int dropIndex,bool isDropTopArea){
while (stack.count() > 0) { while (stack.count() > 0) {
auto item = stack.at(stack.count()-1); auto item = stack.at(stack.count()-1);
stack.pop_back(); stack.pop_back();
QList<FluNode*> children = item->_children; QList<FluTreeNode*> children = item->_children;
if(!children.isEmpty()){ if(!children.isEmpty()){
std::reverse(children.begin(), children.end()); std::reverse(children.begin(), children.end());
foreach (auto c, children) { foreach (auto c, children) {
@ -302,8 +302,7 @@ void FluTreeModel::dragAndDrop(int dragIndex,int dropIndex,bool isDropTopArea){
destChildren->insert(targetIndex,dragItem); destChildren->insert(targetIndex,dragItem);
} }
changePersistentIndex(index(qMin(dragIndex,dropIndex),0),index(qMax(dragIndex,dropIndex),0)); changePersistentIndex(index(qMin(dragIndex,dropIndex),0),index(qMax(dragIndex,dropIndex),0));
Q_EMIT layoutChanged(QList<QPersistentModelIndex>(),QAbstractItemModel::VerticalSortHint); Q_EMIT dataChanged(index(0,0),index(rowCount()-1,0));
} }
bool FluTreeModel::hitHasChildrenExpanded(int row){ bool FluTreeModel::hitHasChildrenExpanded(int row){
@ -318,14 +317,14 @@ void FluTreeModel::refreshNode(int row){
Q_EMIT dataChanged(index(row,0),index(row,0)); Q_EMIT dataChanged(index(row,0),index(row,0));
}; };
FluNode* FluTreeModel::getNode(int row){ FluTreeNode* FluTreeModel::getNode(int row){
return _rows.at(row); return _rows.at(row);
} }
void FluTreeModel::allExpand(){ void FluTreeModel::allExpand(){
beginResetModel(); beginResetModel();
QList<FluNode*> data; QList<FluTreeNode*> data;
QList<FluNode*> stack = _root->_children; QList<FluTreeNode*> stack = _root->_children;
std::reverse(stack.begin(), stack.end()); std::reverse(stack.begin(), stack.end());
while (stack.count() > 0) { while (stack.count() > 0) {
auto item = stack.at(stack.count()-1); auto item = stack.at(stack.count()-1);
@ -334,7 +333,7 @@ void FluTreeModel::allExpand(){
item->_isExpanded = true; item->_isExpanded = true;
} }
data.append(item); data.append(item);
QList<FluNode*> children = item->_children; QList<FluTreeNode*> children = item->_children;
if(!children.isEmpty()){ if(!children.isEmpty()){
std::reverse(children.begin(), children.end()); std::reverse(children.begin(), children.end());
foreach (auto c, children) { foreach (auto c, children) {
@ -347,7 +346,7 @@ void FluTreeModel::allExpand(){
} }
void FluTreeModel::allCollapse(){ void FluTreeModel::allCollapse(){
beginResetModel(); beginResetModel();
QList<FluNode*> stack = _root->_children; QList<FluTreeNode*> stack = _root->_children;
std::reverse(stack.begin(), stack.end()); std::reverse(stack.begin(), stack.end());
while (stack.count() > 0) { while (stack.count() > 0) {
auto item = stack.at(stack.count()-1); auto item = stack.at(stack.count()-1);
@ -355,7 +354,7 @@ void FluTreeModel::allCollapse(){
if(item->hasChildren()){ if(item->hasChildren()){
item->_isExpanded = false; item->_isExpanded = false;
} }
QList<FluNode*> children = item->_children; QList<FluTreeNode*> children = item->_children;
if(!children.isEmpty()){ if(!children.isEmpty()){
std::reverse(children.begin(), children.end()); std::reverse(children.begin(), children.end());
foreach (auto c, children) { foreach (auto c, children) {

View File

@ -8,9 +8,9 @@
#include "stdafx.h" #include "stdafx.h"
/** /**
* @brief The FluNode class * @brief The FluTreeNode class
*/ */
class FluNode : public QObject{ class FluTreeNode : public QObject{
Q_OBJECT Q_OBJECT
Q_PROPERTY(QString key READ key CONSTANT) Q_PROPERTY(QString key READ key CONSTANT)
Q_PROPERTY(QString title READ title CONSTANT) Q_PROPERTY(QString title READ title CONSTANT)
@ -18,14 +18,14 @@ class FluNode : public QObject{
Q_PROPERTY(bool isExpanded READ isExpanded CONSTANT) Q_PROPERTY(bool isExpanded READ isExpanded CONSTANT)
Q_PROPERTY(bool checked READ checked CONSTANT) Q_PROPERTY(bool checked READ checked CONSTANT)
public: public:
explicit FluNode(QObject *parent = nullptr); explicit FluTreeNode(QObject *parent = nullptr);
Q_INVOKABLE QString key(){return _key;}; Q_INVOKABLE QString key(){return _key;};
Q_INVOKABLE QString title(){return _title;}; Q_INVOKABLE QString title(){return _title;};
Q_INVOKABLE int depth(){return _depth;}; Q_INVOKABLE int depth(){return _depth;};
Q_INVOKABLE bool isExpanded(){return _isExpanded;}; Q_INVOKABLE bool isExpanded(){return _isExpanded;};
Q_INVOKABLE bool hasChildren(){ return !_children.isEmpty();}; Q_INVOKABLE bool hasChildren(){ return !_children.isEmpty();};
Q_INVOKABLE bool hasNextNodeByIndex(int index){ Q_INVOKABLE bool hasNextNodeByIndex(int index){
FluNode* p = this; FluTreeNode* p = this;
for(int i=0;i<(_depth - index -1);i++){ for(int i=0;i<(_depth - index -1);i++){
p = p->_parent; p = p->_parent;
} }
@ -75,15 +75,15 @@ public:
int _depth=0; int _depth=0;
bool _checked = false; bool _checked = false;
bool _isExpanded=true; bool _isExpanded=true;
QList<FluNode*> _children; QList<FluTreeNode*> _children;
FluNode* _parent = nullptr; FluTreeNode* _parent = nullptr;
}; };
class FluTreeModel : public QAbstractItemModel class FluTreeModel : public QAbstractItemModel
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY_AUTO(int,dataSourceSize) Q_PROPERTY_AUTO(int,dataSourceSize)
Q_PROPERTY_AUTO(QList<FluNode*>,selectionModel) Q_PROPERTY_AUTO(QList<FluTreeNode*>,selectionModel)
QML_NAMED_ELEMENT(FluTreeModel) QML_NAMED_ELEMENT(FluTreeModel)
QML_ADDED_IN_MINOR_VERSION(1) QML_ADDED_IN_MINOR_VERSION(1)
public: public:
@ -96,23 +96,23 @@ public:
QModelIndex index(int row, int column,const QModelIndex &parent = QModelIndex()) const override; QModelIndex index(int row, int column,const QModelIndex &parent = QModelIndex()) const override;
Q_INVOKABLE void removeRows(int row,int count); Q_INVOKABLE void removeRows(int row,int count);
Q_INVOKABLE void insertRows(int row,QList<FluNode*> data); Q_INVOKABLE void insertRows(int row,QList<FluTreeNode*> data);
Q_INVOKABLE QObject* getRow(int row); Q_INVOKABLE QObject* getRow(int row);
Q_INVOKABLE void setData(QList<FluNode*> data); Q_INVOKABLE void setData(QList<FluTreeNode*> data);
Q_INVOKABLE void setDataSource(QList<QMap<QString,QVariant>> data); Q_INVOKABLE void setDataSource(QList<QMap<QString,QVariant>> data);
Q_INVOKABLE void collapse(int row); Q_INVOKABLE void collapse(int row);
Q_INVOKABLE void expand(int row); Q_INVOKABLE void expand(int row);
Q_INVOKABLE void dragAndDrop(int dragIndex,int dropIndex,bool isDropTopArea); Q_INVOKABLE void dragAndDrop(int dragIndex,int dropIndex,bool isDropTopArea);
Q_INVOKABLE FluNode* getNode(int row); Q_INVOKABLE FluTreeNode* getNode(int row);
Q_INVOKABLE void refreshNode(int row); Q_INVOKABLE void refreshNode(int row);
Q_INVOKABLE void checkRow(int row,bool checked); Q_INVOKABLE void checkRow(int row,bool checked);
Q_INVOKABLE bool hitHasChildrenExpanded(int row); Q_INVOKABLE bool hitHasChildrenExpanded(int row);
Q_INVOKABLE void allExpand(); Q_INVOKABLE void allExpand();
Q_INVOKABLE void allCollapse(); Q_INVOKABLE void allCollapse();
private: private:
QList<FluNode*> _rows; QList<FluTreeNode*> _rows;
QList<FluNode*> _dataSource; QList<FluTreeNode*> _dataSource;
FluNode* _root = nullptr; FluTreeNode* _root = nullptr;
}; };
#endif // FLUTREEMODEL_H #endif // FLUTREEMODEL_H

View File

@ -126,6 +126,7 @@ void FluentUI::registerTypes(const char *uri){
qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluEvent.qml"),uri,major,minor,"FluEvent"); qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluEvent.qml"),uri,major,minor,"FluEvent");
qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluSheet.qml"),uri,major,minor,"FluSheet"); qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluSheet.qml"),uri,major,minor,"FluSheet");
qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluGroupBox.qml"),uri,major,minor,"FluGroupBox"); qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluGroupBox.qml"),uri,major,minor,"FluGroupBox");
qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluControlBackground.qml"),uri,major,minor,"FluControlBackground");
qmlRegisterSingletonType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluRouter.qml"),uri,major,minor,"FluRouter"); qmlRegisterSingletonType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluRouter.qml"),uri,major,minor,"FluRouter");
qmlRegisterSingletonType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluEventBus.qml"),uri,major,minor,"FluEventBus"); qmlRegisterSingletonType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluEventBus.qml"),uri,major,minor,"FluEventBus");
@ -148,11 +149,6 @@ void FluentUI::registerTypes(const char *uri){
} }
void FluentUI::initializeEngine(QQmlEngine *engine, const char *uri){ void FluentUI::initializeEngine(QQmlEngine *engine, const char *uri){
#ifdef Q_OS_WIN
QFont font;
font.setFamily("微软雅黑");
QGuiApplication::setFont(font);
#endif
engine->rootContext()->setContextProperty("FluApp",FluApp::getInstance()); engine->rootContext()->setContextProperty("FluApp",FluApp::getInstance());
engine->rootContext()->setContextProperty("FluColors",FluColors::getInstance()); engine->rootContext()->setContextProperty("FluColors",FluColors::getInstance());
engine->rootContext()->setContextProperty("FluTheme",FluTheme::getInstance()); engine->rootContext()->setContextProperty("FluTheme",FluTheme::getInstance());

View File

@ -7,7 +7,7 @@ Button {
property string contentDescription: "" property string contentDescription: ""
property color normalColor: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(254/255,254/255,254/255,1) property color normalColor: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(254/255,254/255,254/255,1)
property color hoverColor: FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(246/255,246/255,246/255,1) property color hoverColor: FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(246/255,246/255,246/255,1)
property color disableColor: FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(244/255,244/255,244/255,1) property color disableColor: FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(251/255,251/255,251/255,1)
property color dividerColor: FluTheme.dark ? Qt.rgba(80/255,80/255,80/255,1) : Qt.rgba(233/255,233/255,233/255,1) property color dividerColor: FluTheme.dark ? Qt.rgba(80/255,80/255,80/255,1) : Qt.rgba(233/255,233/255,233/255,1)
property color textColor: { property color textColor: {
if(FluTheme.dark){ if(FluTheme.dark){
@ -38,18 +38,17 @@ Button {
horizontalPadding:12 horizontalPadding:12
font:FluTextStyle.Body font:FluTextStyle.Body
focusPolicy:Qt.TabFocus focusPolicy:Qt.TabFocus
background: Rectangle{ background: FluControlBackground{
implicitWidth: 28 implicitWidth: 30
implicitHeight: 28 implicitHeight: 30
border.color: control.dividerColor
border.width: 1
radius: 4 radius: 4
color:{ color: {
if(!enabled){ if(!enabled){
return disableColor return disableColor
} }
return hovered ? hoverColor :normalColor return hovered ? hoverColor :normalColor
} }
shadow: !pressed && enabled
FluFocusRectangle{ FluFocusRectangle{
visible: control.activeFocus visible: control.activeFocus
radius:4 radius:4

View File

@ -449,7 +449,7 @@ FluButton {
DayOfWeekRow { DayOfWeekRow {
id: dayOfWeekRow id: dayOfWeekRow
locale: FluApp.locale locale: FluApp.locale
font.bold: false font: FluTextStyle.Body
delegate: Label { delegate: Label {
text: model.shortName text: model.shortName
font: dayOfWeekRow.font font: dayOfWeekRow.font

View File

@ -45,7 +45,7 @@ T.ComboBox {
topPadding: 6 - control.padding topPadding: 6 - control.padding
bottomPadding: 6 - control.padding bottomPadding: 6 - control.padding
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
selectionColor: FluTools.colorAlpha(FluTheme.primaryColor,0.5) selectionColor: FluTools.withOpacity(FluTheme.primaryColor,0.5)
selectedTextColor: color selectedTextColor: color
text: control.editable ? control.editText : control.displayText text: control.editable ? control.editText : control.displayText
enabled: control.editable enabled: control.editable
@ -62,12 +62,14 @@ T.ComboBox {
validator: control.validator validator: control.validator
selectByMouse: true selectByMouse: true
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
leftInset:1
topInset:1
bottomInset:1
rightInset:1
background: FluTextBoxBackground{ background: FluTextBoxBackground{
borderWidth: 0 border.width: 1
bottomMargin: {
if(!control.editable){
return 1
}
return contentItem && contentItem.activeFocus ? 2 : 1
}
inputItem: contentItem inputItem: contentItem
} }
Component.onCompleted: { Component.onCompleted: {

View File

@ -0,0 +1,52 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import FluentUI 1.0
Item{
id:control
property int radius: 4
property bool shadow: true
property alias border: d.border
property var bottomMargin: undefined
property var topMargin: undefined
property var leftMargin: undefined
property var rightMargin: undefined
property color color: FluTheme.dark ? Qt.rgba(42/255,42/255,42/255,1) : Qt.rgba(254/255,254/255,254/255,1)
property alias gradient : rect_border.gradient
Rectangle{
id:d
property color startColor: Qt.lighter(d.border.color,1.25)
property color endColor: shadow ? control.border.color : startColor
visible: false
border.color: FluTheme.dark ? Qt.rgba(48/255,48/255,48/255,1) : Qt.rgba(188/255,188/255,188/255,1)
}
Rectangle{
id:rect_border
anchors.fill: parent
radius: control.radius
gradient: Gradient {
GradientStop { position: 0.0; color: d.startColor }
GradientStop { position: 1 - 3/control.height; color: d.startColor }
GradientStop { position: 1.0; color: d.endColor}
}
}
Rectangle{
id:rect_back
anchors{
fill: parent
margins: control.border.width
topMargin: control.topMargin
bottomMargin: control.bottomMargin
leftMargin: control.leftMargin
rightMargin: control.rightMargin
}
Behavior on anchors.bottomMargin {
NumberAnimation{
easing.type: Easing.OutCubic
duration: 167
}
}
radius: control.radius
color: control.color
}
}

View File

@ -17,7 +17,7 @@ TextEdit {
selectByMouse: true selectByMouse: true
selectedTextColor: color selectedTextColor: color
bottomPadding: 0 bottomPadding: 0
selectionColor: FluTools.colorAlpha(FluTheme.primaryColor,0.5) selectionColor: FluTools.withOpacity(FluTheme.primaryColor,0.5)
font:FluTextStyle.Body font:FluTextStyle.Body
onSelectedTextChanged: { onSelectedTextChanged: {
control.forceActiveFocus() control.forceActiveFocus()

View File

@ -42,7 +42,7 @@ FluButton {
id:divider_1 id:divider_1
width: 1 width: 1
x: parent.width/3 x: parent.width/3
height: parent.height height: parent.height - 1
color: control.dividerColor color: control.dividerColor
visible: showYear visible: showYear
} }
@ -50,7 +50,7 @@ FluButton {
id:divider_2 id:divider_2
width: 1 width: 1
x: showYear ? parent.width*2/3 : parent.width/2 x: showYear ? parent.width*2/3 : parent.width/2
height: parent.height height: parent.height - 1
color: control.dividerColor color: control.dividerColor
} }
FluText{ FluText{

View File

@ -3,75 +3,21 @@ import QtQuick.Controls 2.15
import QtQuick.Window 2.15 import QtQuick.Window 2.15
import FluentUI 1.0 import FluentUI 1.0
Button { FluButton {
property bool disabled: false
property string contentDescription: ""
property color normalColor: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(254/255,254/255,254/255,1)
property color hoverColor: FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(246/255,246/255,246/255,1)
property color disableColor: FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(244/255,244/255,244/255,1)
property color textColor: {
if(FluTheme.dark){
if(!enabled){
return Qt.rgba(131/255,131/255,131/255,1)
}
if(pressed){
return Qt.rgba(162/255,162/255,162/255,1)
}
return Qt.rgba(1,1,1,1)
}else{
if(!enabled){
return Qt.rgba(160/255,160/255,160/255,1)
}
if(pressed){
return Qt.rgba(96/255,96/255,96/255,1)
}
return Qt.rgba(0,0,0,1)
}
}
property var window : Window.window
default property alias contentData: menu.contentData
Accessible.role: Accessible.Button
Accessible.name: control.text
Accessible.description: contentDescription
Accessible.onPressAction: control.clicked()
id: control id: control
default property alias contentData: menu.contentData
rightPadding:35 rightPadding:35
enabled: !disabled
focusPolicy:Qt.TabFocus
verticalPadding: 0 verticalPadding: 0
horizontalPadding:12 horizontalPadding:12
background: Rectangle{ FluIcon{
implicitWidth: 28 iconSource:FluentIcons.ChevronDown
implicitHeight: 28 iconSize: 15
border.color: FluTheme.dark ? "#505050" : "#DFDFDF" anchors{
border.width: 1 right: parent.right
radius: 4 rightMargin: 10
FluFocusRectangle{ verticalCenter: parent.verticalCenter
visible: control.activeFocus
radius:8
} }
color:{ iconColor:control.textColor
if(!enabled){
return disableColor
}
return hovered ? hoverColor :normalColor
}
FluIcon{
iconSource:FluentIcons.ChevronDown
iconSize: 15
anchors{
right: parent.right
rightMargin: 10
verticalCenter: parent.verticalCenter
}
iconColor:title.color
}
}
contentItem: FluText {
id:title
text: control.text
verticalAlignment: Text.AlignVCenter
color: control.textColor
} }
onClicked: { onClicked: {
if(menu.count !==0){ if(menu.count !==0){

View File

@ -26,8 +26,8 @@ Item {
width: parent.width width: parent.width
height: 45 height: 45
radius: 4 radius: 4
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.dividerColor
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) color: FluTheme.dark ? Window.active ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
MouseArea{ MouseArea{
id:control_mouse id:control_mouse
anchors.fill: parent anchors.fill: parent
@ -90,7 +90,7 @@ Item {
radius: 4 radius: 4
clip: true clip: true
color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
border.color: FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1) border.color: FluTheme.dividerColor
anchors.topMargin: -contentHeight anchors.topMargin: -contentHeight
states: [ states: [
State{ State{

View File

@ -29,37 +29,26 @@ Button {
font:FluTextStyle.Body font:FluTextStyle.Body
verticalPadding: 0 verticalPadding: 0
horizontalPadding:12 horizontalPadding:12
background: Rectangle{ background: FluControlBackground{
implicitWidth: 28 implicitWidth: 30
implicitHeight: 28 implicitHeight: 30
radius: 4 radius: 4
bottomMargin: enabled ? 2 : 0
border.width: enabled ? 1 : 0
border.color: enabled ? Qt.darker(control.normalColor,1.2) : disableColor
color:{
if(!enabled){
return disableColor
}
if(pressed){
return pressedColor
}
return hovered ? hoverColor :normalColor
}
FluFocusRectangle{ FluFocusRectangle{
visible: control.visualFocus visible: control.visualFocus
radius:4 radius:4
} }
gradient: Gradient {
GradientStop { position: 0.33; color: control.enabled ? control.normalColor : Qt.rgba(0,0,0,0) }
GradientStop { position: 1.0; color: control.enabled ? Qt.darker(control.normalColor,1.3) : Qt.rgba(0,0,0,0) }
}
Rectangle{
radius: parent.radius
anchors{
fill: parent
topMargin: control.enabled ? 0 : 0
leftMargin: control.enabled ? 1 : 0
rightMargin: control.enabled ? 1 : 0
bottomMargin: control.enabled ? 2 : 0
}
color:{
if(!enabled){
return disableColor
}
if(pressed){
return pressedColor
}
return hovered ? hoverColor :normalColor
}
}
} }
contentItem: FluText { contentItem: FluText {
text: control.text text: control.text

View File

@ -18,7 +18,7 @@ T.Frame {
background: Rectangle { background: Rectangle {
id:d id:d
radius: 4 radius: 4
border.color: FluTheme.dark ? Window.active ? Qt.rgba(55/255,55/255,55/255,1):Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1) border.color: FluTheme.dividerColor
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) color: FluTheme.dark ? Window.active ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(251/255,251/255,253/255,1)
} }
} }

View File

@ -51,9 +51,9 @@ T.Menu {
FluShadow{} FluShadow{}
} }
T.Overlay.modal: Rectangle { T.Overlay.modal: Rectangle {
color: FluTools.colorAlpha(control.palette.shadow, 0.5) color: FluTools.withOpacity(control.palette.shadow, 0.5)
} }
T.Overlay.modeless: Rectangle { T.Overlay.modeless: Rectangle {
color: FluTools.colorAlpha(control.palette.shadow, 0.12) color: FluTools.withOpacity(control.palette.shadow, 0.12)
} }
} }

View File

@ -25,7 +25,7 @@ TextArea{
leftPadding: padding+4 leftPadding: padding+4
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
selectedTextColor: color selectedTextColor: color
selectionColor: FluTools.colorAlpha(FluTheme.primaryColor,0.5) selectionColor: FluTools.withOpacity(FluTheme.primaryColor,0.5)
placeholderTextColor: { placeholderTextColor: {
if(!enabled){ if(!enabled){
return placeholderDisableColor return placeholderDisableColor

View File

@ -25,7 +25,7 @@ TextField{
leftPadding: padding+4 leftPadding: padding+4
echoMode:btn_reveal.pressed ? TextField.Normal : TextField.Password echoMode:btn_reveal.pressed ? TextField.Normal : TextField.Password
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
selectionColor: FluTools.colorAlpha(FluTheme.primaryColor,0.5) selectionColor: FluTools.withOpacity(FluTheme.primaryColor,0.5)
selectedTextColor: color selectedTextColor: color
placeholderTextColor: { placeholderTextColor: {
if(!enabled){ if(!enabled){

View File

@ -7,19 +7,18 @@ Page {
property alias currentIndex: nav_list.currentIndex property alias currentIndex: nav_list.currentIndex
property color textNormalColor: FluTheme.dark ? FluColors.Grey120 : FluColors.Grey120 property color textNormalColor: FluTheme.dark ? FluColors.Grey120 : FluColors.Grey120
property color textHoverColor: FluTheme.dark ? FluColors.Grey10 : FluColors.Black property color textHoverColor: FluTheme.dark ? FluColors.Grey10 : FluColors.Black
property int textSize: 28
property bool textBold: true
property int textSpacing: 10 property int textSpacing: 10
property int headerSpacing: 20 property int headerSpacing: 20
property int headerHeight: 40 property int headerHeight: 40
id:control id:control
width: 400 width: 400
height: 300 height: 300
font: FluTextStyle.Title
implicitHeight: height implicitHeight: height
implicitWidth: width implicitWidth: width
FluObject{ FluObject{
id:d id:d
property int tabY: control.headerHeight/2+control.textSize/2 + 3 property int tabY: control.headerHeight/2+control.font.pixelSize/2 + 3
} }
background:Item{} background:Item{}
header:ListView{ header:ListView{
@ -65,8 +64,7 @@ Page {
id:item_title id:item_title
text: modelData.title text: modelData.title
anchors.centerIn: parent anchors.centerIn: parent
font.pixelSize: control.textSize font: control.font
font.bold: control.textBold
color: { color: {
if(item_button.hovered) if(item_button.hovered)
return textHoverColor return textHoverColor

View File

@ -11,7 +11,7 @@ Popup {
parent: Overlay.overlay parent: Overlay.overlay
x: Math.round((d.parentWidth - width) / 2) x: Math.round((d.parentWidth - width) / 2)
y: Math.round((d.parentHeight - height) / 2) y: Math.round((d.parentHeight - height) / 2)
closePolicy: Popup.CloseOnEscape closePolicy: Popup.NoAutoClose
enter: Transition { enter: Transition {
NumberAnimation { NumberAnimation {
property: "opacity" property: "opacity"

View File

@ -2,14 +2,13 @@ import QtQuick 2.15
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import FluentUI 1.0 import FluentUI 1.0
Button { FluButton {
property real progress property real progress
property bool disabled: false
property string contentDescription: ""
QtObject{ QtObject{
id:d id:d
property bool checked: (rect_back.height === background.height) && (progress === 1) property bool checked: (Number(rect_back.height) === Number(background.height)) && (progress === 1)
} }
id: control
property color normalColor: { property color normalColor: {
if(d.checked){ if(d.checked){
return FluTheme.primaryColor return FluTheme.primaryColor
@ -32,59 +31,50 @@ Button {
} }
} }
property color pressedColor: FluTheme.dark ? Qt.darker(normalColor,1.2) : Qt.lighter(normalColor,1.2) property color pressedColor: FluTheme.dark ? Qt.darker(normalColor,1.2) : Qt.lighter(normalColor,1.2)
Accessible.role: Accessible.Button background: FluControlBackground{
Accessible.name: control.text implicitWidth: 30
Accessible.description: contentDescription implicitHeight: 30
Accessible.onPressAction: control.clicked() radius: 4
focusPolicy:Qt.TabFocus border.color: FluTheme.dark ? Qt.rgba(48/255,48/255,48/255,1) : Qt.rgba(188/255,188/255,188/255,1)
id: control border.width: d.checked ? 0 : 1
enabled: !disabled color:{
verticalPadding: 0 if(!enabled){
horizontalPadding:12 return disableColor
background: FluClip{
implicitWidth: 28
implicitHeight: 28
radius: [4,4,4,4]
Rectangle{
anchors.fill: parent
border.color: FluTheme.dark ? "#505050" : "#DFDFDF"
border.width: d.checked ? 0 : 1
radius: 4
color:{
if(!enabled){
return disableColor
}
if(d.checked){
if(pressed){
return pressedColor
}
}
return hovered ? hoverColor :normalColor
} }
if(d.checked){
if(pressed){
return pressedColor
}
}
return hovered ? hoverColor :normalColor
} }
Rectangle{ FluClip{
id:rect_back anchors.fill: parent
width: parent.width * control.progress radius: [4,4,4,4]
height: control.progress === 1 ? background.height : 3 Rectangle{
visible: !d.checked id:rect_back
color: FluTheme.primaryColor width: parent.width * control.progress
anchors.bottom: parent.bottom height: control.progress === 1 ? background.height : 3
Behavior on height{ visible: !d.checked
enabled: control.progress !== 0 color: FluTheme.primaryColor
SequentialAnimation { anchors.bottom: parent.bottom
PauseAnimation { Behavior on height{
duration: FluTheme.animationEnabled ? 167 : 0 enabled: control.progress !== 0
} SequentialAnimation {
NumberAnimation{ PauseAnimation {
duration: FluTheme.animationEnabled ? 167 : 0 duration: FluTheme.animationEnabled ? 167 : 0
from: 3 }
to: background.height NumberAnimation{
duration: FluTheme.animationEnabled ? 167 : 0
from: 3
to: background.height
}
} }
} }
} Behavior on width{
Behavior on width{ NumberAnimation{
NumberAnimation{ duration: 167
duration: 167 }
} }
} }
} }

View File

@ -5,7 +5,7 @@ import FluentUI 1.0
Item { Item {
//高性能阴影比DropShadow阴影性能高出数倍 //高性能阴影比DropShadow阴影性能高出数倍
property color color: FluTheme.dark ? "#AAAAAA" : "#999999" property color color: FluTheme.dark ? "#AAAAAA" : "#999999"
property int elevation: 6 property int elevation: 5
property int radius: 4 property int radius: 4
id:control id:control
anchors.fill: parent anchors.fill: parent

View File

@ -131,10 +131,9 @@ FluIconButton {
width: Math.max(item_text.implicitWidth+12,28) width: Math.max(item_text.implicitWidth+12,28)
height: Math.max(item_text.implicitHeight,28) height: Math.max(item_text.implicitHeight,28)
radius: 4 radius: 4
Text{ FluText{
id:item_text id:item_text
color: FluTheme.dark ? Qt.rgba(0,0,0,1) : Qt.rgba(1,1,1,1) color: FluTheme.dark ? Qt.rgba(0,0,0,1) : Qt.rgba(1,1,1,1)
font.pixelSize: 13
text: keyText text: keyText
anchors.centerIn: parent anchors.centerIn: parent
} }

View File

@ -39,7 +39,7 @@ T.SpinBox {
} }
return normalColor return normalColor
} }
selectionColor: FluTools.colorAlpha(FluTheme.primaryColor,0.5) selectionColor: FluTools.withOpacity(FluTheme.primaryColor,0.5)
selectedTextColor: color selectedTextColor: color
horizontalAlignment: Qt.AlignHCenter horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter verticalAlignment: Qt.AlignVCenter

View File

@ -5,16 +5,17 @@ import Qt.labs.qmlmodels 1.0
import FluentUI 1.0 import FluentUI 1.0
Rectangle { Rectangle {
readonly property alias rows: table_view.rows
readonly property alias columns: table_view.columns
readonly property alias current: d.current
readonly property alias sourceModel: table_model
property var columnSource property var columnSource
property var dataSource property var dataSource
property color borderColor: FluTheme.dark ? "#252525" : "#e4e4e4" property color borderColor: FluTheme.dark ? Qt.rgba(37/255,37/255,37/255,1) : Qt.rgba(228/255,228/255,228/255,1)
property alias rows: table_view.rows
property alias columns: table_view.columns
property bool horizonalHeaderVisible: true property bool horizonalHeaderVisible: true
property bool verticalHeaderVisible: true property bool verticalHeaderVisible: true
property color selectedBorderColor: FluTheme.primaryColor property color selectedBorderColor: FluTheme.primaryColor
property color selectedColor: FluTools.colorAlpha(FluTheme.primaryColor,0.3) property color selectedColor: FluTools.withOpacity(FluTheme.primaryColor,0.3)
property alias sourceModel: table_model
id:control id:control
color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
onColumnSourceChanged: { onColumnSourceChanged: {
@ -379,7 +380,7 @@ Rectangle {
model: table_sort_model model: table_sort_model
clip: true clip: true
onRowsChanged: { onRowsChanged: {
closeEditor() control.closeEditor()
} }
delegate: com_table_delegate delegate: com_table_delegate
FluLoader{ FluLoader{
@ -492,7 +493,7 @@ Rectangle {
} }
onClicked: onClicked:
(event)=>{ (event)=>{
closeEditor() control.closeEditor()
} }
} }
FluLoader{ FluLoader{
@ -623,7 +624,7 @@ Rectangle {
} }
onClicked: onClicked:
(event)=>{ (event)=>{
closeEditor() control.closeEditor()
} }
} }
MouseArea{ MouseArea{

View File

@ -25,7 +25,7 @@ TextField{
} }
font:FluTextStyle.Body font:FluTextStyle.Body
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
selectionColor: FluTools.colorAlpha(FluTheme.primaryColor,0.5) selectionColor: FluTools.withOpacity(FluTheme.primaryColor,0.5)
selectedTextColor: color selectedTextColor: color
placeholderTextColor: { placeholderTextColor: {
if(!enabled){ if(!enabled){

View File

@ -2,55 +2,38 @@ import QtQuick 2.15
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import FluentUI 1.0 import FluentUI 1.0
FluClip{ FluControlBackground{
property Item inputItem property Item inputItem
property int borderWidth: 1
id:control id:control
radius: [4,4,4,4] color: {
Rectangle{ if(inputItem && inputItem.disabled){
radius: 4 return FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(252/255,252/255,252/255,1)
anchors.fill: parent
color: {
if(inputItem && inputItem.disabled){
return FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(252/255,252/255,252/255,1)
}
if(inputItem && inputItem.activeFocus){
return FluTheme.dark ? Qt.rgba(36/255,36/255,36/255,1) : Qt.rgba(1,1,1,1)
}
if(inputItem && inputItem.hovered){
return FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
}
return FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(1,1,1,1)
} }
border.width: control.borderWidth if(inputItem && inputItem.activeFocus){
border.color: { return FluTheme.dark ? Qt.rgba(36/255,36/255,36/255,1) : Qt.rgba(1,1,1,1)
if(inputItem && inputItem.disabled){
return FluTheme.dark ? Qt.rgba(73/255,73/255,73/255,1) : Qt.rgba(237/255,237/255,237/255,1)
}
return FluTheme.dark ? Qt.rgba(76/255,76/255,76/255,1) : Qt.rgba(240/255,240/255,240/255,1)
} }
if(inputItem && inputItem.hovered){
return FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
}
return FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(1,1,1,1)
} }
Rectangle{ border.width: 1
width: parent.width gradient: Gradient {
height: inputItem && inputItem.activeFocus ? 2 : 1 GradientStop { position: 0.0; color: d.startColor }
anchors.bottom: parent.bottom GradientStop { position: 1 - d.offsetSize/control.height; color: d.startColor }
visible: !(inputItem && inputItem.disabled) GradientStop { position: 1 - 1/control.height; color: d.endColor }
color: { GradientStop { position: 1.0; color: d.endColor }
if(inputItem && inputItem.activeFocus){ }
return FluTheme.primaryColor bottomMargin: inputItem && inputItem.activeFocus ? 2 : 1
} QtObject{
if(FluTheme.dark){ id:d
return Qt.rgba(166/255,166/255,166/255,1) property int offsetSize : inputItem && inputItem.activeFocus ? 2 : 3
}else{ property color startColor: FluTheme.dark ? Qt.rgba(66/255,66/255,66/255,1) : Qt.rgba(232/255,232/255,232/255,1)
return Qt.rgba(134/255,134/255,134/255,1) property color endColor: {
} if(!control.enabled){
} return d.startColor
Behavior on height{
enabled: FluTheme.animationEnabled
NumberAnimation{
duration: 83
easing.type: Easing.OutCubic
} }
return inputItem && inputItem.activeFocus ? FluTheme.primaryColor : FluTheme.dark ? Qt.rgba(123/255,123/255,123/255,1) : Qt.rgba(132/255,132/255,132/255,1)
} }
} }
} }

View File

@ -28,8 +28,8 @@ Button {
enabled: !disabled enabled: !disabled
font:FluTextStyle.Body font:FluTextStyle.Body
background: Rectangle{ background: Rectangle{
implicitWidth: 28 implicitWidth: 30
implicitHeight: 28 implicitHeight: 30
radius: 4 radius: 4
color: { color: {
if(!enabled){ if(!enabled){

View File

@ -58,14 +58,14 @@ FluButton {
id: divider_1 id: divider_1
width: 1 width: 1
x: isH ? parent.width/3 : parent.width/2 x: isH ? parent.width/3 : parent.width/2
height: parent.height height: parent.height - 1
color: dividerColor color: dividerColor
} }
Rectangle{ Rectangle{
id: divider_2 id: divider_2
width: 1 width: 1
x: parent.width*2/3 x: parent.width*2/3
height: parent.height height: parent.height - 1
color: dividerColor color: dividerColor
visible: isH visible: isH
} }

View File

@ -23,7 +23,7 @@ Button {
if(checked){ if(checked){
return FluTheme.dark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1) return FluTheme.dark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1)
}else{ }else{
return FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(244/255,244/255,244/255,1) return FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(251/255,251/255,251/255,1)
} }
} }
property var clickListener : function(){ property var clickListener : function(){
@ -45,45 +45,52 @@ Button {
} }
} }
onClicked: clickListener() onClicked: clickListener()
background: Rectangle{ background: FluControlBackground{
implicitWidth: 28 implicitWidth: 30
implicitHeight: 28 implicitHeight: 30
radius: 4 radius: 4
FluFocusRectangle{ FluFocusRectangle{
visible: control.activeFocus visible: control.activeFocus
radius:4 radius:4
} }
gradient: Gradient { color:{
GradientStop { position: 0.33; color: control.enabled ? control.normalColor : Qt.rgba(0,0,0,0) } if(!enabled){
GradientStop { position: 1.0; color: control.enabled ? Qt.darker(control.normalColor,1.3) : Qt.rgba(0,0,0,0) } return disableColor
}
Rectangle{
radius: parent.radius
anchors{
fill: parent
topMargin: checked && enabled ? 0 : 0
leftMargin: checked && enabled ? 1 : 0
rightMargin: checked && enabled ? 1 : 0
bottomMargin: checked && enabled ? 2 : 0
} }
color:{ if(checked){
if(!enabled){ if(pressed){
return disableColor return pressedColor
} }
if(checked){ }
if(pressed){ return hovered ? hoverColor :normalColor
return pressedColor }
} bottomMargin: {
} if(checked){
return hovered ? hoverColor :normalColor return enabled ? 2 : 0
}else{
return 1
} }
} }
Rectangle{ border.width: {
color:"#00000000" if(checked){
anchors.fill: parent return enabled ? 1 : 0
border.color: FluTheme.dark ? "#505050" : "#DFDFDF" }else{
border.width: checked ? 0 : 1 return 1
radius: parent.radius }
}
shadow: {
if(checked){
return true
}else{
return !pressed && enabled
}
}
border.color: {
if(checked){
return enabled ? Qt.darker(control.normalColor,1.2) : disableColor
}else{
return FluTheme.dark ? Qt.rgba(48/255,48/255,48/255,1) : Qt.rgba(188/255,188/255,188/255,1)
}
} }
} }
contentItem: FluText { contentItem: FluText {

View File

@ -43,9 +43,9 @@ Window {
property bool useSystemAppBar property bool useSystemAppBar
property color resizeBorderColor: { property color resizeBorderColor: {
if(window.active){ if(window.active){
return FluTheme.dark ? "#333333" : "#6E6E6E" return FluTheme.dark ? Qt.rgba(51/255,51/255,51/255,1) : Qt.rgba(110/255,110/255,110/255,1)
} }
return FluTheme.dark ? "#3D3D3E" : "#A7A7A7" return FluTheme.dark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(167/255,167/255,167/255,1)
} }
property int resizeBorderWidth: 1 property int resizeBorderWidth: 1
property var closeListener: function(event){ property var closeListener: function(event){
@ -65,7 +65,7 @@ Window {
Component.onCompleted: { Component.onCompleted: {
FluRouter.addWindow(window) FluRouter.addWindow(window)
useSystemAppBar = FluApp.useSystemAppBar useSystemAppBar = FluApp.useSystemAppBar
if(useSystemAppBar && autoCenter){ if(!useSystemAppBar && autoCenter){
moveWindowToDesktopCenter() moveWindowToDesktopCenter()
} }
fixWindowSize() fixWindowSize()

View File

@ -85,6 +85,7 @@ Module {
name: "setHitTestVisible" name: "setHitTestVisible"
Parameter { type: "QQuickItem"; isPointer: true } Parameter { type: "QQuickItem"; isPointer: true }
} }
Method { name: "onDestruction" }
} }
Component { Component {
name: "FluNavigationViewType" name: "FluNavigationViewType"
@ -272,7 +273,7 @@ Module {
exports: ["FluentUI/FluTreeModel 1.0"] exports: ["FluentUI/FluTreeModel 1.0"]
exportMetaObjectRevisions: [0] exportMetaObjectRevisions: [0]
Property { name: "dataSourceSize"; type: "int" } Property { name: "dataSourceSize"; type: "int" }
Property { name: "selectionModel"; type: "QList<FluNode*>" } Property { name: "selectionModel"; type: "QList<FluTreeNode*>" }
Method { Method {
name: "removeRows" name: "removeRows"
Parameter { name: "row"; type: "int" } Parameter { name: "row"; type: "int" }
@ -281,7 +282,7 @@ Module {
Method { Method {
name: "insertRows" name: "insertRows"
Parameter { name: "row"; type: "int" } Parameter { name: "row"; type: "int" }
Parameter { name: "data"; type: "QList<FluNode*>" } Parameter { name: "data"; type: "QList<FluTreeNode*>" }
} }
Method { Method {
name: "getRow" name: "getRow"
@ -290,7 +291,7 @@ Module {
} }
Method { Method {
name: "setData" name: "setData"
Parameter { name: "data"; type: "QList<FluNode*>" } Parameter { name: "data"; type: "QList<FluTreeNode*>" }
} }
Method { Method {
name: "setDataSource" name: "setDataSource"
@ -305,14 +306,14 @@ Module {
Parameter { name: "row"; type: "int" } Parameter { name: "row"; type: "int" }
} }
Method { Method {
name: "dragAnddrop" name: "dragAndDrop"
Parameter { name: "dragIndex"; type: "int" } Parameter { name: "dragIndex"; type: "int" }
Parameter { name: "dropIndex"; type: "int" } Parameter { name: "dropIndex"; type: "int" }
Parameter { name: "isDropTopArea"; type: "bool" } Parameter { name: "isDropTopArea"; type: "bool" }
} }
Method { Method {
name: "getNode" name: "getNode"
type: "FluNode*" type: "FluTreeNode*"
Parameter { name: "row"; type: "int" } Parameter { name: "row"; type: "int" }
} }
Method { Method {
@ -322,7 +323,7 @@ Module {
Method { Method {
name: "checkRow" name: "checkRow"
Parameter { name: "row"; type: "int" } Parameter { name: "row"; type: "int" }
Parameter { name: "chekced"; type: "bool" } Parameter { name: "checked"; type: "bool" }
} }
Method { Method {
name: "hitHasChildrenExpanded" name: "hitHasChildrenExpanded"
@ -2512,6 +2513,23 @@ Module {
defaultProperty: "data" defaultProperty: "data"
Property { name: "contentDescription"; type: "string" } Property { name: "contentDescription"; type: "string" }
} }
Component {
prototype: "QQuickItem"
name: "FluentUI/FluControlBackground 1.0"
exports: ["FluentUI/FluControlBackground 1.0"]
exportMetaObjectRevisions: [0]
isComposite: true
defaultProperty: "data"
Property { name: "radius"; type: "int" }
Property { name: "shadow"; type: "bool" }
Property { name: "bottomMargin"; type: "QVariant" }
Property { name: "topMargin"; type: "QVariant" }
Property { name: "leftMargin"; type: "QVariant" }
Property { name: "rightMargin"; type: "QVariant" }
Property { name: "color"; type: "QColor" }
Property { name: "border"; type: "QQuickPen"; isReadonly: true; isPointer: true }
Property { name: "gradient"; type: "QJSValue" }
}
Component { Component {
prototype: "QQuickTextEdit" prototype: "QQuickTextEdit"
name: "FluentUI/FluCopyableText 1.0" name: "FluentUI/FluCopyableText 1.0"
@ -2580,14 +2598,14 @@ Module {
exportMetaObjectRevisions: [0] exportMetaObjectRevisions: [0]
isComposite: true isComposite: true
defaultProperty: "contentData" defaultProperty: "contentData"
Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true }
Property { name: "disabled"; type: "bool" } Property { name: "disabled"; type: "bool" }
Property { name: "contentDescription"; type: "string" } Property { name: "contentDescription"; type: "string" }
Property { name: "normalColor"; type: "QColor" } Property { name: "normalColor"; type: "QColor" }
Property { name: "hoverColor"; type: "QColor" } Property { name: "hoverColor"; type: "QColor" }
Property { name: "disableColor"; type: "QColor" } Property { name: "disableColor"; type: "QColor" }
Property { name: "dividerColor"; type: "QColor" }
Property { name: "textColor"; type: "QColor" } Property { name: "textColor"; type: "QColor" }
Property { name: "window"; type: "QVariant" }
Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true }
} }
Component { Component {
prototype: "QObject" prototype: "QObject"
@ -2914,15 +2932,15 @@ Module {
defaultProperty: "data" defaultProperty: "data"
Property { name: "logo"; type: "QUrl" } Property { name: "logo"; type: "QUrl" }
Property { name: "title"; type: "string" } Property { name: "title"; type: "string" }
Property { name: "items"; type: "FluObject_QMLTYPE_134"; isPointer: true } Property { name: "items"; type: "FluObject_QMLTYPE_137"; isPointer: true }
Property { name: "footerItems"; type: "FluObject_QMLTYPE_134"; isPointer: true } Property { name: "footerItems"; type: "FluObject_QMLTYPE_137"; isPointer: true }
Property { name: "displayMode"; type: "int" } Property { name: "displayMode"; type: "int" }
Property { name: "autoSuggestBox"; type: "QQmlComponent"; isPointer: true } Property { name: "autoSuggestBox"; type: "QQmlComponent"; isPointer: true }
Property { name: "actionItem"; type: "QQmlComponent"; isPointer: true } Property { name: "actionItem"; type: "QQmlComponent"; isPointer: true }
Property { name: "topPadding"; type: "int" } Property { name: "topPadding"; type: "int" }
Property { name: "pageMode"; type: "int" } Property { name: "pageMode"; type: "int" }
Property { name: "navItemRightMenu"; type: "FluMenu_QMLTYPE_42"; isPointer: true } Property { name: "navItemRightMenu"; type: "FluMenu_QMLTYPE_38"; isPointer: true }
Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_42"; isPointer: true } Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_38"; isPointer: true }
Property { name: "navCompactWidth"; type: "int" } Property { name: "navCompactWidth"; type: "int" }
Property { name: "navTopMargin"; type: "int" } Property { name: "navTopMargin"; type: "int" }
Property { name: "cellHeight"; type: "int" } Property { name: "cellHeight"; type: "int" }
@ -3121,8 +3139,6 @@ Module {
defaultProperty: "content" defaultProperty: "content"
Property { name: "textNormalColor"; type: "QColor" } Property { name: "textNormalColor"; type: "QColor" }
Property { name: "textHoverColor"; type: "QColor" } Property { name: "textHoverColor"; type: "QColor" }
Property { name: "textSize"; type: "int" }
Property { name: "textBold"; type: "bool" }
Property { name: "textSpacing"; type: "int" } Property { name: "textSpacing"; type: "int" }
Property { name: "headerSpacing"; type: "int" } Property { name: "headerSpacing"; type: "int" }
Property { name: "headerHeight"; type: "int" } Property { name: "headerHeight"; type: "int" }
@ -3168,12 +3184,14 @@ Module {
isComposite: true isComposite: true
defaultProperty: "data" defaultProperty: "data"
Property { name: "progress"; type: "double" } Property { name: "progress"; type: "double" }
Property { name: "disabled"; type: "bool" }
Property { name: "contentDescription"; type: "string" }
Property { name: "normalColor"; type: "QColor" } Property { name: "normalColor"; type: "QColor" }
Property { name: "hoverColor"; type: "QColor" } Property { name: "hoverColor"; type: "QColor" }
Property { name: "disableColor"; type: "QColor" } Property { name: "disableColor"; type: "QColor" }
Property { name: "pressedColor"; type: "QColor" } Property { name: "pressedColor"; type: "QColor" }
Property { name: "disabled"; type: "bool" }
Property { name: "contentDescription"; type: "string" }
Property { name: "dividerColor"; type: "QColor" }
Property { name: "textColor"; type: "QColor" }
} }
Component { Component {
prototype: "QQuickProgressBar" prototype: "QQuickProgressBar"
@ -3518,6 +3536,7 @@ Module {
Property { name: "selectedColor"; type: "QColor" } Property { name: "selectedColor"; type: "QColor" }
Property { name: "rows"; type: "int"; isReadonly: true } Property { name: "rows"; type: "int"; isReadonly: true }
Property { name: "columns"; type: "int"; isReadonly: true } Property { name: "columns"; type: "int"; isReadonly: true }
Property { name: "current"; type: "QVariant"; isReadonly: true }
Property { name: "sourceModel"; type: "QQmlTableModel"; isReadonly: true; isPointer: true } Property { name: "sourceModel"; type: "QQmlTableModel"; isReadonly: true; isPointer: true }
Method { name: "closeEditor"; type: "QVariant" } Method { name: "closeEditor"; type: "QVariant" }
Method { name: "resetPosition"; type: "QVariant" } Method { name: "resetPosition"; type: "QVariant" }
@ -3590,14 +3609,22 @@ Module {
} }
} }
Component { Component {
prototype: "FluRectangle" prototype: "QQuickItem"
name: "FluentUI/FluTextBoxBackground 1.0" name: "FluentUI/FluTextBoxBackground 1.0"
exports: ["FluentUI/FluTextBoxBackground 1.0"] exports: ["FluentUI/FluTextBoxBackground 1.0"]
exportMetaObjectRevisions: [0] exportMetaObjectRevisions: [0]
isComposite: true isComposite: true
defaultProperty: "data" defaultProperty: "data"
Property { name: "inputItem"; type: "QQuickItem"; isPointer: true } Property { name: "inputItem"; type: "QQuickItem"; isPointer: true }
Property { name: "borderWidth"; type: "int" } Property { name: "radius"; type: "int" }
Property { name: "shadow"; type: "bool" }
Property { name: "bottomMargin"; type: "QVariant" }
Property { name: "topMargin"; type: "QVariant" }
Property { name: "leftMargin"; type: "QVariant" }
Property { name: "rightMargin"; type: "QVariant" }
Property { name: "color"; type: "QColor" }
Property { name: "border"; type: "QQuickPen"; isReadonly: true; isPointer: true }
Property { name: "gradient"; type: "QJSValue" }
} }
Component { Component {
prototype: "QQuickMenu" prototype: "QQuickMenu"

View File

@ -19,6 +19,7 @@ FluComboBox 1.0 Controls/FluComboBox.qml
FluContentDialog 1.0 Controls/FluContentDialog.qml FluContentDialog 1.0 Controls/FluContentDialog.qml
FluContentPage 1.0 Controls/FluContentPage.qml FluContentPage 1.0 Controls/FluContentPage.qml
FluControl 1.0 Controls/FluControl.qml FluControl 1.0 Controls/FluControl.qml
FluControlBackground 1.0 Controls/FluControlBackground.qml
FluCopyableText 1.0 Controls/FluCopyableText.qml FluCopyableText 1.0 Controls/FluCopyableText.qml
FluDatePicker 1.0 Controls/FluDatePicker.qml FluDatePicker 1.0 Controls/FluDatePicker.qml
FluDivider 1.0 Controls/FluDivider.qml FluDivider 1.0 Controls/FluDivider.qml

View File

@ -109,5 +109,6 @@
<file>FluentUI/Controls/FluFrame.qml</file> <file>FluentUI/Controls/FluFrame.qml</file>
<file>FluentUI/Controls/FluSheet.qml</file> <file>FluentUI/Controls/FluSheet.qml</file>
<file>FluentUI/Controls/FluGroupBox.qml</file> <file>FluentUI/Controls/FluGroupBox.qml</file>
<file>FluentUI/Controls/FluControlBackground.qml</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -3,12 +3,13 @@ import QtQuick.Controls
import QtQuick.Controls.Basic import QtQuick.Controls.Basic
import FluentUI import FluentUI
Button { Button {
property bool disabled: false property bool disabled: false
property string contentDescription: "" property string contentDescription: ""
property color normalColor: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(254/255,254/255,254/255,1) property color normalColor: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(254/255,254/255,254/255,1)
property color hoverColor: FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(246/255,246/255,246/255,1) property color hoverColor: FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(246/255,246/255,246/255,1)
property color disableColor: FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(244/255,244/255,244/255,1) property color disableColor: FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(251/255,251/255,251/255,1)
property color dividerColor: FluTheme.dark ? Qt.rgba(80/255,80/255,80/255,1) : Qt.rgba(233/255,233/255,233/255,1) property color dividerColor: FluTheme.dark ? Qt.rgba(80/255,80/255,80/255,1) : Qt.rgba(233/255,233/255,233/255,1)
property color textColor: { property color textColor: {
if(FluTheme.dark){ if(FluTheme.dark){
@ -39,18 +40,17 @@ Button {
horizontalPadding:12 horizontalPadding:12
font:FluTextStyle.Body font:FluTextStyle.Body
focusPolicy:Qt.TabFocus focusPolicy:Qt.TabFocus
background: Rectangle{ background: FluControlBackground{
implicitWidth: 28 implicitWidth: 30
implicitHeight: 28 implicitHeight: 30
border.color: control.dividerColor
border.width: 1
radius: 4 radius: 4
color:{ color: {
if(!enabled){ if(!enabled){
return disableColor return disableColor
} }
return hovered ? hoverColor :normalColor return hovered ? hoverColor :normalColor
} }
shadow: !pressed && enabled
FluFocusRectangle{ FluFocusRectangle{
visible: control.activeFocus visible: control.activeFocus
radius:4 radius:4

View File

@ -448,7 +448,7 @@ FluButton {
DayOfWeekRow { DayOfWeekRow {
id: dayOfWeekRow id: dayOfWeekRow
locale: FluApp.locale locale: FluApp.locale
font.bold: false font: FluTextStyle.Body
delegate: Label { delegate: Label {
text: model.shortName text: model.shortName
font: dayOfWeekRow.font font: dayOfWeekRow.font

View File

@ -45,7 +45,7 @@ T.ComboBox {
topPadding: 6 - control.padding topPadding: 6 - control.padding
bottomPadding: 6 - control.padding bottomPadding: 6 - control.padding
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
selectionColor: FluTools.colorAlpha(FluTheme.primaryColor,0.5) selectionColor: FluTools.withOpacity(FluTheme.primaryColor,0.5)
selectedTextColor: color selectedTextColor: color
text: control.editable ? control.editText : control.displayText text: control.editable ? control.editText : control.displayText
enabled: control.editable enabled: control.editable
@ -62,12 +62,14 @@ T.ComboBox {
validator: control.validator validator: control.validator
selectByMouse: true selectByMouse: true
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
leftInset:1
topInset:1
bottomInset:1
rightInset:1
background: FluTextBoxBackground{ background: FluTextBoxBackground{
borderWidth: 0 border.width: 1
bottomMargin: {
if(!control.editable){
return 1
}
return contentItem && contentItem.activeFocus ? 2 : 1
}
inputItem: contentItem inputItem: contentItem
} }
Component.onCompleted: { Component.onCompleted: {

View File

@ -0,0 +1,52 @@
import QtQuick
import QtQuick.Controls
import FluentUI
Item{
id:control
property int radius: 4
property bool shadow: true
property alias border: d.border
property var bottomMargin: undefined
property var topMargin: undefined
property var leftMargin: undefined
property var rightMargin: undefined
property color color: FluTheme.dark ? Qt.rgba(42/255,42/255,42/255,1) : Qt.rgba(254/255,254/255,254/255,1)
property alias gradient : rect_border.gradient
Rectangle{
id:d
property color startColor: Qt.lighter(d.border.color,1.25)
property color endColor: shadow ? control.border.color : startColor
visible: false
border.color: FluTheme.dark ? Qt.rgba(48/255,48/255,48/255,1) : Qt.rgba(188/255,188/255,188/255,1)
}
Rectangle{
id:rect_border
anchors.fill: parent
radius: control.radius
gradient: Gradient {
GradientStop { position: 0.0; color: d.startColor }
GradientStop { position: 1 - 3/control.height; color: d.startColor }
GradientStop { position: 1.0; color: d.endColor}
}
}
Rectangle{
id:rect_back
anchors{
fill: parent
margins: control.border.width
topMargin: control.topMargin
bottomMargin: control.bottomMargin
leftMargin: control.leftMargin
rightMargin: control.rightMargin
}
Behavior on anchors.bottomMargin {
NumberAnimation{
easing.type: Easing.OutCubic
duration: 167
}
}
radius: control.radius
color: control.color
}
}

View File

@ -17,7 +17,7 @@ TextEdit {
selectByMouse: true selectByMouse: true
selectedTextColor: color selectedTextColor: color
bottomPadding: 0 bottomPadding: 0
selectionColor: FluTools.colorAlpha(FluTheme.primaryColor,0.5) selectionColor: FluTools.withOpacity(FluTheme.primaryColor,0.5)
font:FluTextStyle.Body font:FluTextStyle.Body
onSelectedTextChanged: { onSelectedTextChanged: {
control.forceActiveFocus() control.forceActiveFocus()

View File

@ -41,7 +41,7 @@ FluButton {
id:divider_1 id:divider_1
width: 1 width: 1
x: parent.width/3 x: parent.width/3
height: parent.height height: parent.height-1
color: control.dividerColor color: control.dividerColor
visible: showYear visible: showYear
} }
@ -49,7 +49,7 @@ FluButton {
id:divider_2 id:divider_2
width: 1 width: 1
x: showYear ? parent.width*2/3 : parent.width/2 x: showYear ? parent.width*2/3 : parent.width/2
height: parent.height height: parent.height-1
color: control.dividerColor color: control.dividerColor
} }
FluText{ FluText{

View File

@ -4,75 +4,21 @@ import QtQuick.Controls.Basic
import QtQuick.Window import QtQuick.Window
import FluentUI import FluentUI
Button { FluButton {
property bool disabled: false
property string contentDescription: ""
property color normalColor: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(254/255,254/255,254/255,1)
property color hoverColor: FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(246/255,246/255,246/255,1)
property color disableColor: FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(244/255,244/255,244/255,1)
property color textColor: {
if(FluTheme.dark){
if(!enabled){
return Qt.rgba(131/255,131/255,131/255,1)
}
if(pressed){
return Qt.rgba(162/255,162/255,162/255,1)
}
return Qt.rgba(1,1,1,1)
}else{
if(!enabled){
return Qt.rgba(160/255,160/255,160/255,1)
}
if(pressed){
return Qt.rgba(96/255,96/255,96/255,1)
}
return Qt.rgba(0,0,0,1)
}
}
property var window : Window.window
default property alias contentData: menu.contentData
Accessible.role: Accessible.Button
Accessible.name: control.text
Accessible.description: contentDescription
Accessible.onPressAction: control.clicked()
id: control id: control
default property alias contentData: menu.contentData
rightPadding:35 rightPadding:35
enabled: !disabled
focusPolicy:Qt.TabFocus
verticalPadding: 0 verticalPadding: 0
horizontalPadding:12 horizontalPadding:12
background: Rectangle{ FluIcon{
implicitWidth: 28 iconSource:FluentIcons.ChevronDown
implicitHeight: 28 iconSize: 15
border.color: FluTheme.dark ? "#505050" : "#DFDFDF" anchors{
border.width: 1 right: parent.right
radius: 4 rightMargin: 10
FluFocusRectangle{ verticalCenter: parent.verticalCenter
visible: control.activeFocus
radius:8
} }
color:{ iconColor:control.textColor
if(!enabled){
return disableColor
}
return hovered ? hoverColor :normalColor
}
FluIcon{
iconSource:FluentIcons.ChevronDown
iconSize: 15
anchors{
right: parent.right
rightMargin: 10
verticalCenter: parent.verticalCenter
}
iconColor:title.color
}
}
contentItem: FluText {
id:title
text: control.text
verticalAlignment: Text.AlignVCenter
color: control.textColor
} }
onClicked: { onClicked: {
if(menu.count !==0){ if(menu.count !==0){

View File

@ -26,8 +26,8 @@ Item {
width: parent.width width: parent.width
height: 45 height: 45
radius: 4 radius: 4
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.dividerColor
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) color: FluTheme.dark ? Window.active ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
MouseArea{ MouseArea{
id:control_mouse id:control_mouse
anchors.fill: parent anchors.fill: parent
@ -90,7 +90,7 @@ Item {
radius: 4 radius: 4
clip: true clip: true
color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
border.color: FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1) border.color: FluTheme.dividerColor
anchors.topMargin: -contentHeight anchors.topMargin: -contentHeight
states: [ states: [
State{ State{

View File

@ -30,37 +30,26 @@ Button {
font:FluTextStyle.Body font:FluTextStyle.Body
verticalPadding: 0 verticalPadding: 0
horizontalPadding:12 horizontalPadding:12
background: Rectangle{ background: FluControlBackground{
implicitWidth: 28 implicitWidth: 30
implicitHeight: 28 implicitHeight: 30
radius: 4 radius: 4
bottomMargin: enabled ? 2 : 0
border.width: enabled ? 1 : 0
border.color: enabled ? Qt.darker(control.normalColor,1.2) : disableColor
color:{
if(!enabled){
return disableColor
}
if(pressed){
return pressedColor
}
return hovered ? hoverColor :normalColor
}
FluFocusRectangle{ FluFocusRectangle{
visible: control.visualFocus visible: control.visualFocus
radius:4 radius:4
} }
gradient: Gradient {
GradientStop { position: 0.33; color: control.enabled ? control.normalColor : Qt.rgba(0,0,0,0) }
GradientStop { position: 1.0; color: control.enabled ? Qt.darker(control.normalColor,1.3) : Qt.rgba(0,0,0,0) }
}
Rectangle{
radius: parent.radius
anchors{
fill: parent
topMargin: control.enabled ? 0 : 0
leftMargin: control.enabled ? 1 : 0
rightMargin: control.enabled ? 1 : 0
bottomMargin: control.enabled ? 2 : 0
}
color:{
if(!enabled){
return disableColor
}
if(pressed){
return pressedColor
}
return hovered ? hoverColor :normalColor
}
}
} }
contentItem: FluText { contentItem: FluText {
text: control.text text: control.text

View File

@ -16,7 +16,7 @@ T.Frame {
background: Rectangle { background: Rectangle {
id:d id:d
radius: 4 radius: 4
border.color: FluTheme.dark ? Window.active ? Qt.rgba(55/255,55/255,55/255,1):Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1) border.color: FluTheme.dividerColor
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) color: FluTheme.dark ? Window.active ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(251/255,251/255,253/255,1)
} }
} }

View File

@ -51,9 +51,9 @@ T.Menu {
FluShadow{} FluShadow{}
} }
T.Overlay.modal: Rectangle { T.Overlay.modal: Rectangle {
color: Color.transparent(control.palette.shadow, 0.5) color: FluTools.withOpacity(control.palette.shadow, 0.5)
} }
T.Overlay.modeless: Rectangle { T.Overlay.modeless: Rectangle {
color: Color.transparent(control.palette.shadow, 0.12) color: FluTools.withOpacity(control.palette.shadow, 0.12)
} }
} }

View File

@ -26,7 +26,7 @@ TextArea{
leftPadding: padding+4 leftPadding: padding+4
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
selectedTextColor: color selectedTextColor: color
selectionColor: FluTools.colorAlpha(FluTheme.primaryColor,0.5) selectionColor: FluTools.withOpacity(FluTheme.primaryColor,0.5)
placeholderTextColor: { placeholderTextColor: {
if(!enabled){ if(!enabled){
return placeholderDisableColor return placeholderDisableColor

View File

@ -26,7 +26,7 @@ TextField{
leftPadding: padding+4 leftPadding: padding+4
echoMode:btn_reveal.pressed ? TextField.Normal : TextField.Password echoMode:btn_reveal.pressed ? TextField.Normal : TextField.Password
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
selectionColor: FluTools.colorAlpha(FluTheme.primaryColor,0.5) selectionColor: FluTools.withOpacity(FluTheme.primaryColor,0.5)
selectedTextColor: color selectedTextColor: color
placeholderTextColor: { placeholderTextColor: {
if(!enabled){ if(!enabled){

View File

@ -8,19 +8,18 @@ Page {
property alias currentIndex: nav_list.currentIndex property alias currentIndex: nav_list.currentIndex
property color textNormalColor: FluTheme.dark ? FluColors.Grey120 : FluColors.Grey120 property color textNormalColor: FluTheme.dark ? FluColors.Grey120 : FluColors.Grey120
property color textHoverColor: FluTheme.dark ? FluColors.Grey10 : FluColors.Black property color textHoverColor: FluTheme.dark ? FluColors.Grey10 : FluColors.Black
property int textSize: 28
property bool textBold: true
property int textSpacing: 10 property int textSpacing: 10
property int headerSpacing: 20 property int headerSpacing: 20
property int headerHeight: 40 property int headerHeight: 40
id:control id:control
width: 400 width: 400
height: 300 height: 300
font: FluTextStyle.Title
implicitHeight: height implicitHeight: height
implicitWidth: width implicitWidth: width
FluObject{ FluObject{
id:d id:d
property int tabY: control.headerHeight/2+control.textSize/2 + 3 property int tabY: control.headerHeight/2+control.font.pixelSize/2 + 3
} }
background:Item{} background:Item{}
header:ListView{ header:ListView{
@ -66,10 +65,9 @@ Page {
id:item_title id:item_title
text: modelData.title text: modelData.title
anchors.centerIn: parent anchors.centerIn: parent
font.pixelSize: control.textSize font: control.font
font.bold: control.textBold
color: { color: {
if(item_button.hovered || nav_list.currentIndex === index) if(item_button.hovered)
return textHoverColor return textHoverColor
return textNormalColor return textNormalColor
} }

View File

@ -11,7 +11,7 @@ Popup {
parent: Overlay.overlay parent: Overlay.overlay
x: Math.round((d.parentWidth - width) / 2) x: Math.round((d.parentWidth - width) / 2)
y: Math.round((d.parentHeight - height) / 2) y: Math.round((d.parentHeight - height) / 2)
closePolicy: Popup.CloseOnEscape closePolicy: Popup.NoAutoClose
enter: Transition { enter: Transition {
NumberAnimation { NumberAnimation {
property: "opacity" property: "opacity"

View File

@ -3,14 +3,13 @@ import QtQuick.Controls
import QtQuick.Controls.Basic import QtQuick.Controls.Basic
import FluentUI import FluentUI
Button { FluButton {
property real progress property real progress
property bool disabled: false
property string contentDescription: ""
QtObject{ QtObject{
id:d id:d
property bool checked: (rect_back.height === background.height) && (progress === 1) property bool checked: (Number(rect_back.height) === Number(background.height)) && (progress === 1)
} }
id: control
property color normalColor: { property color normalColor: {
if(d.checked){ if(d.checked){
return FluTheme.primaryColor return FluTheme.primaryColor
@ -33,59 +32,50 @@ Button {
} }
} }
property color pressedColor: FluTheme.dark ? Qt.darker(normalColor,1.2) : Qt.lighter(normalColor,1.2) property color pressedColor: FluTheme.dark ? Qt.darker(normalColor,1.2) : Qt.lighter(normalColor,1.2)
Accessible.role: Accessible.Button background: FluControlBackground{
Accessible.name: control.text implicitWidth: 30
Accessible.description: contentDescription implicitHeight: 30
Accessible.onPressAction: control.clicked() radius: 4
focusPolicy:Qt.TabFocus border.color: FluTheme.dark ? Qt.rgba(48/255,48/255,48/255,1) : Qt.rgba(188/255,188/255,188/255,1)
id: control border.width: d.checked ? 0 : 1
enabled: !disabled color:{
verticalPadding: 0 if(!enabled){
horizontalPadding:12 return disableColor
background: FluClip{
implicitWidth: 28
implicitHeight: 28
radius: [4,4,4,4]
Rectangle{
anchors.fill: parent
border.color: FluTheme.dark ? "#505050" : "#DFDFDF"
border.width: d.checked ? 0 : 1
radius: 4
color:{
if(!enabled){
return disableColor
}
if(d.checked){
if(pressed){
return pressedColor
}
}
return hovered ? hoverColor :normalColor
} }
if(d.checked){
if(pressed){
return pressedColor
}
}
return hovered ? hoverColor :normalColor
} }
Rectangle{ FluClip{
id:rect_back anchors.fill: parent
width: parent.width * control.progress radius: [4,4,4,4]
height: control.progress === 1 ? background.height : 3 Rectangle{
visible: !d.checked id:rect_back
color: FluTheme.primaryColor width: parent.width * control.progress
anchors.bottom: parent.bottom height: control.progress === 1 ? background.height : 3
Behavior on height{ visible: !d.checked
enabled: control.progress !== 0 color: FluTheme.primaryColor
SequentialAnimation { anchors.bottom: parent.bottom
PauseAnimation { Behavior on height{
duration: FluTheme.animationEnabled ? 167 : 0 enabled: control.progress !== 0
} SequentialAnimation {
NumberAnimation{ PauseAnimation {
duration: FluTheme.animationEnabled ? 167 : 0 duration: FluTheme.animationEnabled ? 167 : 0
from: 3 }
to: background.height NumberAnimation{
duration: FluTheme.animationEnabled ? 167 : 0
from: 3
to: background.height
}
} }
} }
} Behavior on width{
Behavior on width{ NumberAnimation{
NumberAnimation{ duration: 167
duration: 167 }
} }
} }
} }

View File

@ -5,7 +5,7 @@ import FluentUI
Item { Item {
//高性能阴影比DropShadow阴影性能高出数倍 //高性能阴影比DropShadow阴影性能高出数倍
property color color: FluTheme.dark ? "#AAAAAA" : "#999999" property color color: FluTheme.dark ? "#AAAAAA" : "#999999"
property int elevation: 6 property int elevation: 5
property int radius: 4 property int radius: 4
id:control id:control
anchors.fill: parent anchors.fill: parent

View File

@ -131,10 +131,9 @@ FluIconButton {
width: Math.max(item_text.implicitWidth+12,28) width: Math.max(item_text.implicitWidth+12,28)
height: Math.max(item_text.implicitHeight,28) height: Math.max(item_text.implicitHeight,28)
radius: 4 radius: 4
Text{ FluText{
id:item_text id:item_text
color: FluTheme.dark ? Qt.rgba(0,0,0,1) : Qt.rgba(1,1,1,1) color: FluTheme.dark ? Qt.rgba(0,0,0,1) : Qt.rgba(1,1,1,1)
font.pixelSize: 13
text: keyText text: keyText
anchors.centerIn: parent anchors.centerIn: parent
} }

View File

@ -40,7 +40,7 @@ T.SpinBox {
} }
return normalColor return normalColor
} }
selectionColor: FluTools.colorAlpha(FluTheme.primaryColor,0.5) selectionColor: FluTools.withOpacity(FluTheme.primaryColor,0.5)
selectedTextColor: color selectedTextColor: color
horizontalAlignment: Qt.AlignHCenter horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter verticalAlignment: Qt.AlignVCenter

View File

@ -6,16 +6,17 @@ import Qt.labs.qmlmodels
import FluentUI import FluentUI
Rectangle { Rectangle {
readonly property alias rows: table_view.rows
readonly property alias columns: table_view.columns
readonly property alias current: d.current
readonly property alias sourceModel: table_model
property var columnSource property var columnSource
property var dataSource property var dataSource
property color borderColor: FluTheme.dark ? "#252525" : "#e4e4e4" property color borderColor: FluTheme.dark ? Qt.rgba(37/255,37/255,37/255,1) : Qt.rgba(228/255,228/255,228/255,1)
property alias rows: table_view.rows
property alias columns: table_view.columns
property bool horizonalHeaderVisible: true property bool horizonalHeaderVisible: true
property bool verticalHeaderVisible: true property bool verticalHeaderVisible: true
property color selectedBorderColor: FluTheme.primaryColor property color selectedBorderColor: FluTheme.primaryColor
property color selectedColor: FluTools.colorAlpha(FluTheme.primaryColor,0.3) property color selectedColor: FluTools.withOpacity(FluTheme.primaryColor,0.3)
property alias sourceModel: table_model
id:control id:control
color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
onColumnSourceChanged: { onColumnSourceChanged: {

View File

@ -26,7 +26,7 @@ TextField{
} }
font:FluTextStyle.Body font:FluTextStyle.Body
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
selectionColor: FluTools.colorAlpha(FluTheme.primaryColor,0.5) selectionColor: FluTools.withOpacity(FluTheme.primaryColor,0.5)
selectedTextColor: color selectedTextColor: color
placeholderTextColor: { placeholderTextColor: {
if(!enabled){ if(!enabled){

View File

@ -2,55 +2,38 @@ import QtQuick
import QtQuick.Controls import QtQuick.Controls
import FluentUI import FluentUI
FluClip{ FluControlBackground{
property Item inputItem property Item inputItem
property int borderWidth: 1
id:control id:control
radius: [4,4,4,4] color: {
Rectangle{ if(inputItem && inputItem.disabled){
radius: 4 return FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(252/255,252/255,252/255,1)
anchors.fill: parent
color: {
if(inputItem && inputItem.disabled){
return FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(252/255,252/255,252/255,1)
}
if(inputItem && inputItem.activeFocus){
return FluTheme.dark ? Qt.rgba(36/255,36/255,36/255,1) : Qt.rgba(1,1,1,1)
}
if(inputItem && inputItem.hovered){
return FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
}
return FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(1,1,1,1)
} }
border.width: control.borderWidth if(inputItem && inputItem.activeFocus){
border.color: { return FluTheme.dark ? Qt.rgba(36/255,36/255,36/255,1) : Qt.rgba(1,1,1,1)
if(inputItem && inputItem.disabled){
return FluTheme.dark ? Qt.rgba(73/255,73/255,73/255,1) : Qt.rgba(237/255,237/255,237/255,1)
}
return FluTheme.dark ? Qt.rgba(76/255,76/255,76/255,1) : Qt.rgba(240/255,240/255,240/255,1)
} }
if(inputItem && inputItem.hovered){
return FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
}
return FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(1,1,1,1)
} }
Rectangle{ border.width: 1
width: parent.width gradient: Gradient {
height: inputItem && inputItem.activeFocus ? 2 : 1 GradientStop { position: 0.0; color: d.startColor }
anchors.bottom: parent.bottom GradientStop { position: 1 - d.offsetSize/control.height; color: d.startColor }
visible: !(inputItem && inputItem.disabled) GradientStop { position: 1 - 1/control.height; color: d.endColor }
color: { GradientStop { position: 1.0; color: d.endColor }
if(inputItem && inputItem.activeFocus){ }
return FluTheme.primaryColor bottomMargin: inputItem && inputItem.activeFocus ? 2 : 1
} QtObject{
if(FluTheme.dark){ id:d
return Qt.rgba(166/255,166/255,166/255,1) property int offsetSize : inputItem && inputItem.activeFocus ? 2 : 3
}else{ property color startColor: FluTheme.dark ? Qt.rgba(66/255,66/255,66/255,1) : Qt.rgba(232/255,232/255,232/255,1)
return Qt.rgba(134/255,134/255,134/255,1) property color endColor: {
} if(!control.enabled){
} return d.startColor
Behavior on height{
enabled: FluTheme.animationEnabled
NumberAnimation{
duration: 83
easing.type: Easing.OutCubic
} }
return inputItem && inputItem.activeFocus ? FluTheme.primaryColor : FluTheme.dark ? Qt.rgba(123/255,123/255,123/255,1) : Qt.rgba(132/255,132/255,132/255,1)
} }
} }
} }

View File

@ -29,8 +29,8 @@ Button {
enabled: !disabled enabled: !disabled
font:FluTextStyle.Body font:FluTextStyle.Body
background: Rectangle{ background: Rectangle{
implicitWidth: 28 implicitWidth: 30
implicitHeight: 28 implicitHeight: 30
radius: 4 radius: 4
color: { color: {
if(!enabled){ if(!enabled){

View File

@ -8,12 +8,12 @@ FluButton {
property int hourFormat: FluTimePickerType.H property int hourFormat: FluTimePickerType.H
property int isH: hourFormat === FluTimePickerType.H property int isH: hourFormat === FluTimePickerType.H
property var current property var current
property string amText: "上午" property string amText: qsTr("AM")
property string pmText: "下午" property string pmText: qsTr("PM")
property string hourText: "时" property string hourText: qsTr("Hour")
property string minuteText: "分" property string minuteText: qsTr("Minute")
property string cancelText: "取消" property string cancelText: qsTr("Cancel")
property string okText: "确定" property string okText: qsTr("OK")
signal accepted() signal accepted()
id:control id:control
implicitHeight: 30 implicitHeight: 30
@ -58,14 +58,14 @@ FluButton {
id: divider_1 id: divider_1
width: 1 width: 1
x: isH ? parent.width/3 : parent.width/2 x: isH ? parent.width/3 : parent.width/2
height: parent.height height: parent.height-1
color: dividerColor color: dividerColor
} }
Rectangle{ Rectangle{
id: divider_2 id: divider_2
width: 1 width: 1
x: parent.width*2/3 x: parent.width*2/3
height: parent.height height: parent.height-1
color: dividerColor color: dividerColor
visible: isH visible: isH
} }

View File

@ -24,7 +24,7 @@ Button {
if(checked){ if(checked){
return FluTheme.dark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1) return FluTheme.dark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1)
}else{ }else{
return FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(244/255,244/255,244/255,1) return FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(251/255,251/255,251/255,1)
} }
} }
property var clickListener : function(){ property var clickListener : function(){
@ -41,45 +41,52 @@ Button {
verticalPadding: 0 verticalPadding: 0
horizontalPadding:12 horizontalPadding:12
onClicked: clickListener() onClicked: clickListener()
background: Rectangle{ background: FluControlBackground{
implicitWidth: 28 implicitWidth: 30
implicitHeight: 28 implicitHeight: 30
radius: 4 radius: 4
FluFocusRectangle{ FluFocusRectangle{
visible: control.activeFocus visible: control.activeFocus
radius:4 radius:4
} }
gradient: Gradient { color:{
GradientStop { position: 0.33; color: control.enabled ? control.normalColor : Qt.rgba(0,0,0,0) } if(!enabled){
GradientStop { position: 1.0; color: control.enabled ? Qt.darker(control.normalColor,1.3) : Qt.rgba(0,0,0,0) } return disableColor
}
Rectangle{
radius: parent.radius
anchors{
fill: parent
topMargin: checked && enabled ? 0 : 0
leftMargin: checked && enabled ? 1 : 0
rightMargin: checked && enabled ? 1 : 0
bottomMargin: checked && enabled ? 2 : 0
} }
color:{ if(checked){
if(!enabled){ if(pressed){
return disableColor return pressedColor
} }
if(checked){ }
if(pressed){ return hovered ? hoverColor :normalColor
return pressedColor }
} bottomMargin: {
} if(checked){
return hovered ? hoverColor :normalColor return enabled ? 2 : 0
}else{
return 1
} }
} }
Rectangle{ border.width: {
color:"#00000000" if(checked){
anchors.fill: parent return enabled ? 1 : 0
border.color: FluTheme.dark ? "#505050" : "#DFDFDF" }else{
border.width: checked ? 0 : 1 return 1
radius: parent.radius }
}
shadow: {
if(checked){
return true
}else{
return !pressed && enabled
}
}
border.color: {
if(checked){
return enabled ? Qt.darker(control.normalColor,1.2) : disableColor
}else{
return FluTheme.dark ? Qt.rgba(48/255,48/255,48/255,1) : Qt.rgba(188/255,188/255,188/255,1)
}
} }
} }
contentItem: FluText { contentItem: FluText {

View File

@ -42,9 +42,9 @@ Window {
property bool useSystemAppBar property bool useSystemAppBar
property color resizeBorderColor: { property color resizeBorderColor: {
if(window.active){ if(window.active){
return FluTheme.dark ? "#333333" : "#6E6E6E" return FluTheme.dark ? Qt.rgba(51/255,51/255,51/255,1) : Qt.rgba(110/255,110/255,110/255,1)
} }
return FluTheme.dark ? "#3D3D3E" : "#A7A7A7" return FluTheme.dark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(167/255,167/255,167/255,1)
} }
property int resizeBorderWidth: 1 property int resizeBorderWidth: 1
property var closeListener: function(event){ property var closeListener: function(event){
@ -64,7 +64,7 @@ Window {
Component.onCompleted: { Component.onCompleted: {
FluRouter.addWindow(window) FluRouter.addWindow(window)
useSystemAppBar = FluApp.useSystemAppBar useSystemAppBar = FluApp.useSystemAppBar
if(useSystemAppBar && autoCenter){ if(!useSystemAppBar && autoCenter){
moveWindowToDesktopCenter() moveWindowToDesktopCenter()
} }
fixWindowSize() fixWindowSize()

View File

@ -63,10 +63,6 @@
</context> </context>
<context> <context>
<name>FluCalendarPicker</name> <name>FluCalendarPicker</name>
<message>
<source>Please select a date</source>
<translation type="obsolete"></translation>
</message>
<message> <message>
<location filename="Qt5/imports/FluentUI/Controls/FluCalendarPicker.qml" line="13"/> <location filename="Qt5/imports/FluentUI/Controls/FluCalendarPicker.qml" line="13"/>
<location filename="Qt6/imports/FluentUI/Controls/FluCalendarPicker.qml" line="12"/> <location filename="Qt6/imports/FluentUI/Controls/FluCalendarPicker.qml" line="12"/>