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
        id: mytextfield
        width: 500
        height: 40
        MouseArea {
            id: textboxMouseArea
            propagateComposedEvents: true
            anchors.fill: parent
                if(mouse.modifiers & Qt.AltModifier)
                     console.log("Alt CLICKED")
                mouse.accepted = false

    I set propagateComposedEvents and also set mouse.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?


Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.