Search code examples
dictionaryonclickqmldragclick-through

How to disable clicking through item in qml?


The application I currently work on has a map as a background, and above it various other dialogs(views) with more than one view inside can be opened. When some of the dialogs is active, when dragging over it's background map is moving like there's nothing above it. Does someone know how to disable this? I don't want map to react on clicks or anything inside a dialog.

The project is organised so that each dialog is implemented in separate qml file:

  • I have each qml file for each dialog, and each component of application (map), so

  • when you click, for example on settings tab in scrollable horizontal list, settings tab is opened from qml that holds all dialogs, including bottom and top of the app

  • each dialog is above map and has a 50% transparent background, with related images and buttons in it

  • I want to disable dragging map while dragging over dialog's background. I tried with setting this to each dialog:

MouseArea {

anchors.fill: parent

onClicked: mouse.accepted = true

}

(parent is Item that holds all elements of a dialog), but this doesn't work.


Solution

  • If I'm understanding your question correctly, it should suffice to set the MouseArea's propagateComposedEvents to false.