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:"编辑"
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))
}

View File

@ -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

View File

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

View File

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

View File

@ -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{

View File

@ -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()
}
}
}

View File

@ -12,13 +12,23 @@ FluMenu{
id:menu
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 !== ""