Unsolved Mousearea inside a textfield disabled textfield's functionality
-
Hi,
I need a customised textfield that behaves normally when user clicks inside it, but if the user Alt+Clicks I want it to run some special codes instead of being able to edit the text. Here is a sample code:ApplicationWindow { visible: true width: 700 height: 700 TextField{ id: mytextfield width: 500 height: 40 MouseArea { id: textboxMouseArea propagateComposedEvents: true anchors.fill: parent onClicked: { if(mouse.modifiers & Qt.AltModifier) { console.log("Alt CLICKED") } mouse.accepted = false } } } }
I set
propagateComposedEvents
and also setmouse.accepted = false
but it still doesn't work. Alt+Click detection works fine, but textfield is somehow disabled and I cannot edit the text.
Is there any ideas/workaround for this?Thanks
-
ApplicationWindow {
visible: true
width: 700
height: 700TextField { id: mytextfield width: 500 height: 40 Keys.onPressed: { //mark event as handled, prevent it from passing on. event.accepted = true; if(mouse.modifiers & Qt.AltModifier) { console.log("Alt CLICKED") } } } }