This commit is contained in:
zhuzihcu 2023-04-24 17:48:12 +08:00
parent d71441e7c5
commit 9494ec4ac6
7 changed files with 32 additions and 27 deletions

View File

@ -68,8 +68,8 @@ FluScrollablePage{
text:"编辑" text:"编辑"
topPadding:3 topPadding:3
bottomPadding:3 bottomPadding:3
leftPadding:3 leftPadding:6
rightPadding:3 rightPadding:6
onClicked:{ onClicked:{
console.debug(dataModel.index) console.debug(dataModel.index)
showSuccess(JSON.stringify(dataObject)) showSuccess(JSON.stringify(dataObject))
@ -79,8 +79,8 @@ FluScrollablePage{
text:"删除" text:"删除"
topPadding:3 topPadding:3
bottomPadding:3 bottomPadding:3
leftPadding:3 leftPadding:6
rightPadding:3 rightPadding:6
onClicked:{ onClicked:{
showError(JSON.stringify(dataObject)) showError(JSON.stringify(dataObject))
} }

View File

@ -126,14 +126,6 @@ FluTextBox{
control_popup.visible = true control_popup.visible = true
} }
} }
TapHandler {
acceptedButtons: Qt.RightButton
onTapped: control.echoMode !== TextInput.Password && menu.popup()
}
FluTextBoxMenu{
id:menu
inputItem: control
}
function handleClick(modelData){ function handleClick(modelData){
control_popup.visible = false control_popup.visible = false

View File

@ -17,7 +17,6 @@ Button {
rightPadding:15 rightPadding:15
enabled: !disabled enabled: !disabled
focusPolicy:Qt.TabFocus focusPolicy:Qt.TabFocus
Keys.onSpacePressed: control.visualFocus&&clicked() Keys.onSpacePressed: control.visualFocus&&clicked()
background: Rectangle{ background: Rectangle{

View File

@ -91,7 +91,6 @@ Button {
FluMenu{ FluMenu{
id:menu id:menu
width: control.width width: control.width
animEnabled: true
} }
} }

View File

@ -5,7 +5,7 @@ import QtQuick.Controls
Menu { Menu {
default property alias content: container.data default property alias content: container.data
property bool animEnabled: false property bool enableAnimation: true
id: popup id: popup
width: 140 width: 140
height: container.height height: container.height
@ -17,7 +17,7 @@ Menu {
property: "opacity" property: "opacity"
from:0 from:0
to:1 to:1
duration: 83 duration: enableAnimation ? 83 : 0
} }
} }
@ -26,7 +26,7 @@ Menu {
property: "opacity" property: "opacity"
from:1 from:1
to:0 to:0
duration: 83 duration: enableAnimation ? 83 : 0
} }
} }
@ -39,7 +39,7 @@ Menu {
clip: true clip: true
Rectangle{ Rectangle{
anchors.fill: parent 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 radius: 5
} }
Column{ Column{

View File

@ -4,12 +4,13 @@ import QtQuick.Controls
Item { Item {
property string text: "MenuItem" property string text: "MenuItem"
property var onClickFunc
signal clicked signal clicked
id:root id:control
width: { width: {
if(root.parent){ if(control.parent){
return root.parent.width return control.parent.width
} }
return 140 return 140
} }
@ -18,7 +19,7 @@ Item {
Rectangle{ Rectangle{
anchors.centerIn: parent anchors.centerIn: parent
width: root.width-40 width: control.width-40
height: 32 height: 32
radius: 4 radius: 4
color:{ color:{
@ -36,7 +37,7 @@ Item {
} }
FluText{ FluText{
text: root.text text: control.text
anchors.centerIn: parent anchors.centerIn: parent
} }
@ -45,8 +46,12 @@ Item {
hoverEnabled: true hoverEnabled: true
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
root.clicked() if(control.onClickFunc){
root.parent.closePopup() control.onClickFunc()
return
}
control.parent.closePopup()
control.clicked()
} }
} }
} }

View File

@ -12,13 +12,23 @@ FluMenu{
id:menu id:menu
focus:false focus:false
enableAnimation:false
Connections{
target: inputItem
function onTextChanged() {
menu.close()
}
}
FluMenuItem{ FluMenuItem{
text: cutText text: cutText
visible: inputItem.text !== "" && !inputItem.readOnly visible: inputItem.selectedText !== "" && !inputItem.readOnly
onClicked: { onClicked: {
inputItem.cut() inputItem.cut()
} }
} }
FluMenuItem{ FluMenuItem{
text: copyText text: copyText
visible: inputItem.selectedText !== "" visible: inputItem.selectedText !== ""