mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-01-22 20:04:32 +08:00
update
This commit is contained in:
parent
c2b845658d
commit
5cf0812562
@ -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));
|
|
||||||
}
|
|
||||||
|
@ -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);
|
||||||
|
@ -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){
|
||||||
|
@ -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);
|
||||||
|
@ -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,18 @@ 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: enabled
|
||||||
|
border.color: FluTheme.dark ? Qt.rgba(48/255,48/255,48/255,1) : Qt.rgba(206/255,206/255,206/255,1)
|
||||||
FluFocusRectangle{
|
FluFocusRectangle{
|
||||||
visible: control.activeFocus
|
visible: control.activeFocus
|
||||||
radius:4
|
radius:4
|
||||||
|
@ -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
|
||||||
|
@ -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()
|
||||||
|
@ -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){
|
||||||
|
@ -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.dark ? Window.active ? Qt.rgba(55/255,55/255,55/255,1):Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1)
|
||||||
border.color: FluTheme.dark ? Window.active ? Qt.rgba(55/255,55/255,55/255,1) : Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1)
|
color: FluTheme.dark ? Window.active ? Qt.rgba(28/255,28/255,28/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
|
||||||
|
@ -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
|
||||||
|
@ -19,6 +19,6 @@ T.Frame {
|
|||||||
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.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(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(28/255,28/255,28/255,1) : Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
@ -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){
|
||||||
|
@ -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: (rect_back.height === 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(206/255,206/255,206/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
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
@ -15,7 +15,7 @@ Rectangle {
|
|||||||
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)
|
||||||
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: {
|
||||||
|
@ -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){
|
||||||
|
@ -2,55 +2,36 @@ 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: 0.92; color: d.startColor }
|
||||||
visible: !(inputItem && inputItem.disabled)
|
GradientStop { position: 1.0; color: d.endColor }
|
||||||
color: {
|
}
|
||||||
if(inputItem && inputItem.activeFocus){
|
bottomMargin: inputItem && inputItem.activeFocus ? 2 : 1
|
||||||
return FluTheme.primaryColor
|
QtObject{
|
||||||
}
|
id:d
|
||||||
if(FluTheme.dark){
|
property color startColor: FluTheme.dark ? Qt.rgba(23/255,23/255,23/255,1) : Qt.rgba(232/255,232/255,232/255,1)
|
||||||
return Qt.rgba(166/255,166/255,166/255,1)
|
property color endColor: {
|
||||||
}else{
|
if(!control.enabled){
|
||||||
return Qt.rgba(134/255,134/255,134/255,1)
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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){
|
||||||
|
@ -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(){
|
||||||
@ -39,52 +39,57 @@ Button {
|
|||||||
enabled: !disabled
|
enabled: !disabled
|
||||||
verticalPadding: 0
|
verticalPadding: 0
|
||||||
horizontalPadding:12
|
horizontalPadding:12
|
||||||
onCheckableChanged: {
|
|
||||||
if(checkable){
|
|
||||||
checkable = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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 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(206/255,206/255,206/255,1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
contentItem: FluText {
|
contentItem: FluText {
|
||||||
text: control.text
|
text: control.text
|
||||||
|
@ -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){
|
||||||
|
@ -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>
|
||||||
|
@ -8,7 +8,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){
|
||||||
@ -39,18 +39,18 @@ 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: enabled
|
||||||
|
border.color: FluTheme.dark ? Qt.rgba(48/255,48/255,48/255,1) : Qt.rgba(206/255,206/255,206/255,1)
|
||||||
FluFocusRectangle{
|
FluFocusRectangle{
|
||||||
visible: control.activeFocus
|
visible: control.activeFocus
|
||||||
radius:4
|
radius:4
|
||||||
|
@ -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
|
||||||
|
@ -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()
|
||||||
|
@ -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){
|
||||||
|
@ -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.dark ? Window.active ? Qt.rgba(55/255,55/255,55/255,1):Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1)
|
||||||
border.color: FluTheme.dark ? Window.active ? Qt.rgba(55/255,55/255,55/255,1) : Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1)
|
color: FluTheme.dark ? Window.active ? Qt.rgba(28/255,28/255,28/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
|
||||||
|
@ -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
|
||||||
|
@ -17,6 +17,6 @@ T.Frame {
|
|||||||
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.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(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(28/255,28/255,28/255,1) : Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
@ -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){
|
||||||
|
@ -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: (rect_back.height === 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(206/255,206/255,206/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
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
@ -16,7 +16,7 @@ Rectangle {
|
|||||||
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)
|
||||||
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: {
|
||||||
|
@ -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){
|
||||||
|
@ -2,55 +2,36 @@ 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: 0.92; color: d.startColor }
|
||||||
visible: !(inputItem && inputItem.disabled)
|
GradientStop { position: 1.0; color: d.endColor }
|
||||||
color: {
|
}
|
||||||
if(inputItem && inputItem.activeFocus){
|
bottomMargin: inputItem && inputItem.activeFocus ? 2 : 1
|
||||||
return FluTheme.primaryColor
|
QtObject{
|
||||||
}
|
id:d
|
||||||
if(FluTheme.dark){
|
property color startColor: FluTheme.dark ? Qt.rgba(23/255,23/255,23/255,1) : Qt.rgba(232/255,232/255,232/255,1)
|
||||||
return Qt.rgba(166/255,166/255,166/255,1)
|
property color endColor: {
|
||||||
}else{
|
if(!control.enabled){
|
||||||
return Qt.rgba(134/255,134/255,134/255,1)
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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){
|
||||||
|
@ -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,46 +41,56 @@ 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 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(206/255,206/255,206/255,1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
contentItem: FluText {
|
contentItem: FluText {
|
||||||
text: control.text
|
text: control.text
|
||||||
|
@ -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){
|
||||||
|
Loading…
Reference in New Issue
Block a user