From c19f5d4c4812d0b456439f2b5230d18635a01607 Mon Sep 17 00:00:00 2001 From: zhuzichu Date: Wed, 19 Apr 2023 23:04:56 +0800 Subject: [PATCH] update --- example/T_Buttons.qml | 1 + example/component/CodeExpander.qml | 1 - example/example.pro | 2 +- example/main.cpp | 5 +-- src/controls/FluArea.qml | 1 + src/controls/FluButton.qml | 3 +- src/controls/FluCheckBox.qml | 3 +- src/controls/FluColorPicker.qml | 3 +- src/controls/FluControl.qml | 13 -------- src/controls/FluDropDownButton.qml | 3 +- src/controls/FluFilledButton.qml | 3 +- src/controls/FluFlipView.qml | 5 +-- src/controls/FluIconButton.qml | 3 +- src/controls/FluMultilineTextBox.qml | 3 +- src/controls/FluNavigationView.qml | 3 +- src/controls/FluPagination.qml | 4 +-- src/controls/FluRadioButton.qml | 3 +- src/controls/FluTextArea.qml | 39 ----------------------- src/controls/FluTextBox.qml | 3 +- src/controls/FluTextButton.qml | 3 +- src/controls/FluTextFiled.qml | 46 ---------------------------- src/controls/FluToggleButton.qml | 3 +- src/controls/FluToggleSwitch.qml | 5 +-- src/res.qrc | 3 -- 24 files changed, 37 insertions(+), 124 deletions(-) delete mode 100644 src/controls/FluControl.qml delete mode 100644 src/controls/FluTextArea.qml delete mode 100644 src/controls/FluTextFiled.qml diff --git a/example/T_Buttons.qml b/example/T_Buttons.qml index d1fdbdf..751dee2 100644 --- a/example/T_Buttons.qml +++ b/example/T_Buttons.qml @@ -2,6 +2,7 @@ import QtQuick.Layouts import QtQuick.Window import QtQuick.Controls +import QtQuick.Controls.Basic import FluentUI import "./component" diff --git a/example/component/CodeExpander.qml b/example/component/CodeExpander.qml index 770e810..5a23a35 100644 --- a/example/component/CodeExpander.qml +++ b/example/component/CodeExpander.qml @@ -68,7 +68,6 @@ FluExpander{ "FluComboBox", "FluContentDialog", "FluContentPage", - "FluControl", "FluDatePicker", "FluDivider", "FluDropDownButton", diff --git a/example/example.pro b/example/example.pro index 38ecac6..624ad33 100644 --- a/example/example.pro +++ b/example/example.pro @@ -1,4 +1,4 @@ -QT += quick quickcontrols2 concurrent network multimedia +QT += quick concurrent network multimedia CONFIG += c++17 DEFINES += QT_DEPRECATED_WARNINGS QT_NO_WARNING_OUTPUT diff --git a/example/main.cpp b/example/main.cpp index 8c2fc10..76e0976 100644 --- a/example/main.cpp +++ b/example/main.cpp @@ -3,7 +3,6 @@ #include #include #include -#include #include #include "lang/Lang.h" #include "AppInfo.h" @@ -11,10 +10,12 @@ int main(int argc, char *argv[]) { + //将样式设置为Basic,不然会导致组件显示异常 + qputenv("QT_QUICK_CONTROLS_STYLE","Basic"); QCoreApplication::setOrganizationName("ZhuZiChu"); QCoreApplication::setOrganizationDomain("https://zhuzichu520.github.io"); QCoreApplication::setApplicationName("FluentUI"); - QQuickStyle::setStyle("Basic"); +// QQuickWindow::setGraphicsApi(QSGRendererInterface::Software); QGuiApplication app(argc, argv); app.setQuitOnLastWindowClosed(false); QQmlApplicationEngine engine; diff --git a/src/controls/FluArea.qml b/src/controls/FluArea.qml index 653f229..5959059 100644 --- a/src/controls/FluArea.qml +++ b/src/controls/FluArea.qml @@ -1,4 +1,5 @@ import QtQuick +import QtQuick.Controls import FluentUI Rectangle { diff --git a/src/controls/FluButton.qml b/src/controls/FluButton.qml index 1760490..925e8f8 100644 --- a/src/controls/FluButton.qml +++ b/src/controls/FluButton.qml @@ -1,8 +1,9 @@ import QtQuick import QtQuick.Controls +import QtQuick.Controls.Basic import FluentUI -FluControl { +Button { property bool disabled: false property color normalColor: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(254/255,254/255,254/255,1) diff --git a/src/controls/FluCheckBox.qml b/src/controls/FluCheckBox.qml index ecc4c85..a4b5ff1 100644 --- a/src/controls/FluCheckBox.qml +++ b/src/controls/FluCheckBox.qml @@ -1,9 +1,10 @@ import QtQuick import QtQuick.Controls +import QtQuick.Controls.Basic import QtQuick.Layouts import FluentUI -FluControl { +Button { property bool selected: false property var clickFunc diff --git a/src/controls/FluColorPicker.qml b/src/controls/FluColorPicker.qml index f5b226c..d15eb5b 100644 --- a/src/controls/FluColorPicker.qml +++ b/src/controls/FluColorPicker.qml @@ -1,10 +1,11 @@ import QtQuick import QtQuick.Controls +import QtQuick.Controls.Basic import QtQuick.Layouts import QtQuick.Window import FluentUI -FluControl{ +Button{ id:control width: 36 height: 36 diff --git a/src/controls/FluControl.qml b/src/controls/FluControl.qml deleted file mode 100644 index bd77b44..0000000 --- a/src/controls/FluControl.qml +++ /dev/null @@ -1,13 +0,0 @@ -import QtQuick -import QtQuick.Controls -import QtQuick.Controls.impl -import QtQuick.Templates as T -import FluentUI - -T.Button { - id: control - implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, - implicitContentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - implicitContentHeight + topPadding + bottomPadding) -} diff --git a/src/controls/FluDropDownButton.qml b/src/controls/FluDropDownButton.qml index b25a85d..f1816b4 100644 --- a/src/controls/FluDropDownButton.qml +++ b/src/controls/FluDropDownButton.qml @@ -1,9 +1,10 @@ import QtQuick import QtQuick.Controls +import QtQuick.Controls.Basic import QtQuick.Window import FluentUI -FluControl { +Button { property bool disabled: false property color normalColor: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(254/255,254/255,254/255,1) diff --git a/src/controls/FluFilledButton.qml b/src/controls/FluFilledButton.qml index 7c41255..b20b0d2 100644 --- a/src/controls/FluFilledButton.qml +++ b/src/controls/FluFilledButton.qml @@ -1,8 +1,9 @@ import QtQuick import QtQuick.Controls +import QtQuick.Controls.Basic import FluentUI -FluControl { +Button { property bool disabled: false property color normalColor: FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark diff --git a/src/controls/FluFlipView.qml b/src/controls/FluFlipView.qml index 2d83e86..cfad518 100644 --- a/src/controls/FluFlipView.qml +++ b/src/controls/FluFlipView.qml @@ -1,5 +1,6 @@ import QtQuick import QtQuick.Controls +import QtQuick.Controls.Basic import FluentUI Item{ @@ -52,7 +53,7 @@ Item{ anchors.fill: parent } - FluControl{ + Button{ id:btn_start height: vertical ? 20 : 40 width: vertical ? 40 : 20 @@ -82,7 +83,7 @@ Item{ } } - FluControl{ + Button{ id:btn_end height: vertical ? 20 : 40 width: vertical ? 40 : 20 diff --git a/src/controls/FluIconButton.qml b/src/controls/FluIconButton.qml index 610f540..a59b293 100644 --- a/src/controls/FluIconButton.qml +++ b/src/controls/FluIconButton.qml @@ -1,8 +1,9 @@ import QtQuick import QtQuick.Controls +import QtQuick.Controls.Basic import FluentUI -FluControl { +Button { property int iconSize: 20 property int iconSource diff --git a/src/controls/FluMultilineTextBox.qml b/src/controls/FluMultilineTextBox.qml index 17130bb..504c42c 100644 --- a/src/controls/FluMultilineTextBox.qml +++ b/src/controls/FluMultilineTextBox.qml @@ -1,8 +1,9 @@ import QtQuick import QtQuick.Controls +import QtQuick.Controls.Basic import FluentUI -FluTextArea{ +TextArea{ property int fontStyle: FluText.Body property int pixelSize : FluTheme.textSize diff --git a/src/controls/FluNavigationView.qml b/src/controls/FluNavigationView.qml index 7cf23a1..622373b 100644 --- a/src/controls/FluNavigationView.qml +++ b/src/controls/FluNavigationView.qml @@ -1,6 +1,7 @@ import QtQuick import QtQuick.Window import QtQuick.Controls +import QtQuick.Controls.Basic import QtQuick.Layouts import FluentUI @@ -818,7 +819,7 @@ Item { currentIndex: -1 model: control_popup.childModel ScrollBar.vertical: FluScrollBar {} - delegate:FluControl{ + delegate:Button{ width: 160 padding:10 background: Rectangle{ diff --git a/src/controls/FluPagination.qml b/src/controls/FluPagination.qml index 952e989..ab2c4dd 100644 --- a/src/controls/FluPagination.qml +++ b/src/controls/FluPagination.qml @@ -1,12 +1,10 @@ import QtQuick import QtQuick.Controls -import FluentUI import QtQuick.Layouts +import FluentUI Item { id: control - - signal requestPage(int page,int count) property string previousText: "<上一页" property string nextText: "下一页>" diff --git a/src/controls/FluRadioButton.qml b/src/controls/FluRadioButton.qml index 4e389e4..d8f33ca 100644 --- a/src/controls/FluRadioButton.qml +++ b/src/controls/FluRadioButton.qml @@ -1,9 +1,10 @@ import QtQuick import QtQuick.Controls +import QtQuick.Controls.Basic import QtQuick.Layouts import FluentUI -FluControl { +Button { property bool selected: false property bool disabled: false diff --git a/src/controls/FluTextArea.qml b/src/controls/FluTextArea.qml deleted file mode 100644 index 22a5fe9..0000000 --- a/src/controls/FluTextArea.qml +++ /dev/null @@ -1,39 +0,0 @@ -import QtQuick -import QtQuick.Controls -import QtQuick.Controls.impl -import QtQuick.Templates as T - -T.TextArea { - id: control - - implicitWidth: Math.max(contentWidth + leftPadding + rightPadding, - implicitBackgroundWidth + leftInset + rightInset, - placeholder.implicitWidth + leftPadding + rightPadding) - implicitHeight: Math.max(contentHeight + topPadding + bottomPadding, - implicitBackgroundHeight + topInset + bottomInset, - placeholder.implicitHeight + topPadding + bottomPadding) - - padding: 6 - leftPadding: padding + 4 - - color: control.palette.text - placeholderTextColor: control.palette.placeholderText - selectionColor: control.palette.highlight - selectedTextColor: control.palette.highlightedText - - PlaceholderText { - id: placeholder - x: control.leftPadding - y: control.topPadding - width: control.width - (control.leftPadding + control.rightPadding) - height: control.height - (control.topPadding + control.bottomPadding) - - text: control.placeholderText - font: control.font - color: control.placeholderTextColor - verticalAlignment: control.verticalAlignment - visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter) - elide: Text.ElideRight - renderType: control.renderType - } -} diff --git a/src/controls/FluTextBox.qml b/src/controls/FluTextBox.qml index 1845e1b..859500b 100644 --- a/src/controls/FluTextBox.qml +++ b/src/controls/FluTextBox.qml @@ -1,8 +1,9 @@ import QtQuick import QtQuick.Controls +import QtQuick.Controls.Basic import FluentUI -FluTextFiled{ +TextField{ property int fontStyle: FluText.Body property int pixelSize : FluTheme.textSize diff --git a/src/controls/FluTextButton.qml b/src/controls/FluTextButton.qml index 55941d8..e50d992 100644 --- a/src/controls/FluTextButton.qml +++ b/src/controls/FluTextButton.qml @@ -1,8 +1,9 @@ import QtQuick import QtQuick.Controls +import QtQuick.Controls.Basic import FluentUI -FluControl { +Button { property bool disabled: false property color normalColor: FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark diff --git a/src/controls/FluTextFiled.qml b/src/controls/FluTextFiled.qml deleted file mode 100644 index f81d484..0000000 --- a/src/controls/FluTextFiled.qml +++ /dev/null @@ -1,46 +0,0 @@ -import QtQuick -import QtQuick.Controls -import QtQuick.Controls.impl -import QtQuick.Templates as T - -T.TextField { - id: control - - implicitWidth: implicitBackgroundWidth + leftInset + rightInset - || Math.max(contentWidth, placeholder.implicitWidth) + leftPadding + rightPadding - implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, - contentHeight + topPadding + bottomPadding, - placeholder.implicitHeight + topPadding + bottomPadding) - - padding: 6 - leftPadding: padding + 4 - - color: control.palette.text - selectionColor: control.palette.highlight - selectedTextColor: control.palette.highlightedText - placeholderTextColor: control.palette.placeholderText - verticalAlignment: TextInput.AlignVCenter - - PlaceholderText { - id: placeholder - x: control.leftPadding - y: control.topPadding - width: control.width - (control.leftPadding + control.rightPadding) - height: control.height - (control.topPadding + control.bottomPadding) - text: control.placeholderText - font: control.font - color: control.placeholderTextColor - verticalAlignment: control.verticalAlignment - visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter) - elide: Text.ElideRight - renderType: control.renderType - } - - background: Rectangle { - implicitWidth: 200 - implicitHeight: 40 - border.width: control.activeFocus ? 2 : 1 - color: control.palette.base - border.color: control.activeFocus ? control.palette.highlight : control.palette.mid - } -} diff --git a/src/controls/FluToggleButton.qml b/src/controls/FluToggleButton.qml index 7cd2be5..962dd13 100644 --- a/src/controls/FluToggleButton.qml +++ b/src/controls/FluToggleButton.qml @@ -1,8 +1,9 @@ import QtQuick import QtQuick.Controls +import QtQuick.Controls.Basic import FluentUI -FluControl { +Button { property bool disabled: false property bool selected: false diff --git a/src/controls/FluToggleSwitch.qml b/src/controls/FluToggleSwitch.qml index 9ab67bc..5b9824b 100644 --- a/src/controls/FluToggleSwitch.qml +++ b/src/controls/FluToggleSwitch.qml @@ -1,9 +1,10 @@ import QtQuick import QtQuick.Controls -import FluentUI +import QtQuick.Controls.Basic import QtQuick.Layouts +import FluentUI -FluControl { +Button { property bool selected: false property var clickFunc diff --git a/src/res.qrc b/src/res.qrc index d4408cf..c8ac590 100644 --- a/src/res.qrc +++ b/src/res.qrc @@ -64,9 +64,6 @@ controls/FluFlipView.qml controls/FluPivot.qml controls/FluPivotItem.qml - controls/FluControl.qml - controls/FluTextFiled.qml - controls/FluTextArea.qml controls/FluTableView.qml controls/FluPagination.qml controls/FluToggleButton.qml