diff --git a/example/qml/page/T_TableView.qml b/example/qml/page/T_TableView.qml index eb26ac69..20b143ce 100644 --- a/example/qml/page/T_TableView.qml +++ b/example/qml/page/T_TableView.qml @@ -68,8 +68,8 @@ FluScrollablePage{ text:"编辑" topPadding:3 bottomPadding:3 - leftPadding:3 - rightPadding:3 + leftPadding:6 + rightPadding:6 onClicked:{ console.debug(dataModel.index) showSuccess(JSON.stringify(dataObject)) @@ -79,8 +79,8 @@ FluScrollablePage{ text:"删除" topPadding:3 bottomPadding:3 - leftPadding:3 - rightPadding:3 + leftPadding:6 + rightPadding:6 onClicked:{ showError(JSON.stringify(dataObject)) } diff --git a/src/controls/FluAutoSuggestBox.qml b/src/controls/FluAutoSuggestBox.qml index 5194cf32..d19c5922 100644 --- a/src/controls/FluAutoSuggestBox.qml +++ b/src/controls/FluAutoSuggestBox.qml @@ -126,14 +126,6 @@ FluTextBox{ control_popup.visible = true } } - TapHandler { - acceptedButtons: Qt.RightButton - onTapped: control.echoMode !== TextInput.Password && menu.popup() - } - FluTextBoxMenu{ - id:menu - inputItem: control - } function handleClick(modelData){ control_popup.visible = false diff --git a/src/controls/FluButton.qml b/src/controls/FluButton.qml index 925e8f84..a15fcf1f 100644 --- a/src/controls/FluButton.qml +++ b/src/controls/FluButton.qml @@ -17,7 +17,6 @@ Button { rightPadding:15 enabled: !disabled focusPolicy:Qt.TabFocus - Keys.onSpacePressed: control.visualFocus&&clicked() background: Rectangle{ diff --git a/src/controls/FluDropDownButton.qml b/src/controls/FluDropDownButton.qml index f1816b49..19f1ecbf 100644 --- a/src/controls/FluDropDownButton.qml +++ b/src/controls/FluDropDownButton.qml @@ -91,7 +91,6 @@ Button { FluMenu{ id:menu width: control.width - animEnabled: true } } diff --git a/src/controls/FluMenu.qml b/src/controls/FluMenu.qml index 7068318b..adf0adc9 100644 --- a/src/controls/FluMenu.qml +++ b/src/controls/FluMenu.qml @@ -5,7 +5,7 @@ import QtQuick.Controls Menu { default property alias content: container.data - property bool animEnabled: false + property bool enableAnimation: true id: popup width: 140 height: container.height @@ -17,7 +17,7 @@ Menu { property: "opacity" from:0 to:1 - duration: 83 + duration: enableAnimation ? 83 : 0 } } @@ -26,7 +26,7 @@ Menu { property: "opacity" from:1 to:0 - duration: 83 + duration: enableAnimation ? 83 : 0 } } @@ -39,7 +39,7 @@ Menu { clip: true Rectangle{ anchors.fill: parent - color:FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,0.97) : Qt.rgba(237/255,237/255,237/255,0.97) + color:FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(249/255,249/255,249/255,1) radius: 5 } Column{ diff --git a/src/controls/FluMenuItem.qml b/src/controls/FluMenuItem.qml index 3358857f..7ea3d304 100644 --- a/src/controls/FluMenuItem.qml +++ b/src/controls/FluMenuItem.qml @@ -4,12 +4,13 @@ import QtQuick.Controls Item { property string text: "MenuItem" + property var onClickFunc signal clicked - id:root + id:control width: { - if(root.parent){ - return root.parent.width + if(control.parent){ + return control.parent.width } return 140 } @@ -18,7 +19,7 @@ Item { Rectangle{ anchors.centerIn: parent - width: root.width-40 + width: control.width-40 height: 32 radius: 4 color:{ @@ -36,7 +37,7 @@ Item { } FluText{ - text: root.text + text: control.text anchors.centerIn: parent } @@ -45,8 +46,12 @@ Item { hoverEnabled: true anchors.fill: parent onClicked: { - root.clicked() - root.parent.closePopup() + if(control.onClickFunc){ + control.onClickFunc() + return + } + control.parent.closePopup() + control.clicked() } } } diff --git a/src/controls/FluTextBoxMenu.qml b/src/controls/FluTextBoxMenu.qml index 8ff1e319..4355547e 100644 --- a/src/controls/FluTextBoxMenu.qml +++ b/src/controls/FluTextBoxMenu.qml @@ -11,14 +11,24 @@ FluMenu{ property var inputItem id:menu - focus: false + focus:false + enableAnimation:false + + Connections{ + target: inputItem + function onTextChanged() { + menu.close() + } + } + FluMenuItem{ text: cutText - visible: inputItem.text !== "" && !inputItem.readOnly + visible: inputItem.selectedText !== "" && !inputItem.readOnly onClicked: { inputItem.cut() } } + FluMenuItem{ text: copyText visible: inputItem.selectedText !== ""