From 64bbae926634a79e23dc715ff7bfe4878963c451 Mon Sep 17 00:00:00 2001 From: zhuzichu Date: Fri, 30 Jun 2023 18:47:25 +0800 Subject: [PATCH] update --- example/qml/component/CodeExpander.qml | 6 +-- example/qml/page/T_TextBox.qml | 35 ++++++++++++++++ src/imports/FluentUI/Controls/FluSpinBox.qml | 42 +++++++++++++++++++ .../FluentUI/Controls/FluTableView.qml | 4 -- src/imports/FluentUI/Controls/FluTextBox.qml | 3 +- 5 files changed, 81 insertions(+), 9 deletions(-) create mode 100644 src/imports/FluentUI/Controls/FluSpinBox.qml diff --git a/example/qml/component/CodeExpander.qml b/example/qml/component/CodeExpander.qml index 97f99365..cc1f5347 100644 --- a/example/qml/component/CodeExpander.qml +++ b/example/qml/component/CodeExpander.qml @@ -134,13 +134,11 @@ FluExpander{ "FluMenuBar", "FluPagination", "FluRadioButtons", - "FluImage" + "FluImage", + "FluSpinBox" ]; code = code.replace(/\n/g, "
"); code = code.replace(/ /g, " "); return code.replace(RegExp("\\b(" + qmlKeywords.join("|") + ")\\b", "g"), "$1"); } - - - } diff --git a/example/qml/page/T_TextBox.qml b/example/qml/page/T_TextBox.qml index 23672668..9e129a30 100644 --- a/example/qml/page/T_TextBox.qml +++ b/example/qml/page/T_TextBox.qml @@ -166,6 +166,41 @@ FluScrollablePage{ }' } + FluArea{ + Layout.fillWidth: true + height: 68 + paddings: 10 + Layout.topMargin: 20 + + FluSpinBox{ + Layout.topMargin: 20 + disabled: spin_box_switch.checked + anchors{ + verticalCenter: parent.verticalCenter + left: parent.left + } + } + + Row{ + spacing: 5 + anchors{ + verticalCenter: parent.verticalCenter + right: parent.right + } + FluToggleSwitch{ + id:spin_box_switch + Layout.alignment: Qt.AlignRight + text:"Disabled" + } + } + } + CodeExpander{ + Layout.fillWidth: true + Layout.topMargin: -1 + code:'FluSpinBox{ + +}' + } function generateRandomNames(numNames) { const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; diff --git a/src/imports/FluentUI/Controls/FluSpinBox.qml b/src/imports/FluentUI/Controls/FluSpinBox.qml new file mode 100644 index 00000000..db831e1e --- /dev/null +++ b/src/imports/FluentUI/Controls/FluSpinBox.qml @@ -0,0 +1,42 @@ +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls +import FluentUI + +FluTextBox { + id:control + width: 200 + closeRightMargin:55 + rightPadding: 80 + text:"0" + validator: IntValidator {} + inputMethodHints: Qt.ImhDigitsOnly + FluIconButton{ + width: 20 + height: 20 + iconSize: 16 + iconSource: FluentIcons.ChevronUp + anchors{ + verticalCenter: parent.verticalCenter + right: parent.right + rightMargin: 30 + } + onClicked: { + control.text = Number(control.text) + 1 + } + } + FluIconButton{ + iconSource: FluentIcons.ChevronDown + width: 20 + height: 20 + iconSize: 16 + anchors{ + verticalCenter: parent.verticalCenter + right: parent.right + rightMargin: 5 + } + onClicked: { + control.text = Number(control.text) - 1 + } + } +} diff --git a/src/imports/FluentUI/Controls/FluTableView.qml b/src/imports/FluentUI/Controls/FluTableView.qml index c6db4cad..3d358bf6 100644 --- a/src/imports/FluentUI/Controls/FluTableView.qml +++ b/src/imports/FluentUI/Controls/FluTableView.qml @@ -11,7 +11,6 @@ Rectangle { property color selectionColor: Qt.alpha(FluTheme.primaryColor.lightest,0.6) property color hoverButtonColor: Qt.alpha(selectionColor,0.2) property color pressedButtonColor: Qt.alpha(selectionColor,0.4) - id:control color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) onColumnSourceChanged: { @@ -190,9 +189,6 @@ Rectangle { id:item_table property var position: Qt.point(column,row) required property bool selected - // onSelectedChanged: { - // d.selectionFlag = !d.selectionFlag - // } color: (row%2!==0) ? control.color : (FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06)) implicitHeight: 40 implicitWidth: columnSource[column].width diff --git a/src/imports/FluentUI/Controls/FluTextBox.qml b/src/imports/FluentUI/Controls/FluTextBox.qml index 3a91bb24..e8c377c5 100644 --- a/src/imports/FluentUI/Controls/FluTextBox.qml +++ b/src/imports/FluentUI/Controls/FluTextBox.qml @@ -12,6 +12,7 @@ TextField{ property color placeholderNormalColor: FluTheme.dark ? Qt.rgba(210/255,210/255,210/255,1) : Qt.rgba(96/255,96/255,96/255,1) property color placeholderFocusColor: FluTheme.dark ? Qt.rgba(152/255,152/255,152/255,1) : Qt.rgba(141/255,141/255,141/255,1) property color placeholderDisableColor: FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1) + property int closeRightMargin: icon_end.visible ? 25 : 5 id:control width: 300 enabled: !disabled @@ -78,7 +79,7 @@ TextField{ anchors{ verticalCenter: parent.verticalCenter right: parent.right - rightMargin: icon_end.visible ? 25 : 5 + rightMargin: closeRightMargin } onClicked:{ control.text = ""