Skip to content

TouchArea: Add a way to have event pass through to element bellow / trasparent for event #9840

@Apollo-Roboto

Description

@Apollo-Roboto

There is sometimes the need for having a TouchArea on top that doesn't block elements, or have a way to capture events even if there is a children TouchArea on top.

Original Bug Description

TouchArea pointer-event not called when moving mouse above children

I was trying to capture the mouse position within a TouchArea, but I noticed that the pointer-event callback isn't called when hovering a children within this TouchArea.

I was expecting the pointer event to be called since the out properties mouse-x and mouse-y are continuously updated.

Not all children causes this. Its the children that also have a TouchArea. so Button, CheckBox, LineEdit, etc. Rectangle and other component doesn't prevent the event to be called.

Quick example:

TouchArea {
    pointer-event(event) => {
        if event.kind == PointerEventKind.move {
            // This is not called when hovering the button
            debug(self.mouse-x, self.mouse-y);
        }
    }
    Button {
        text: "Example";
    }
}

Reproducible Code (if applicable)

More detailed Example on SlintPad

Environment Details

  • Slint Version: 1.14.1
  • Platform/OS: Windows 10
  • Programming Language: Rust
  • Backend/Renderer: Default

Product Impact

Building some little personal project I hope to finish and show off soon!

I can move ahead with the out properties, but this issue blocked me for a bit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:builtin elementsThe runtime data structures related to the items (mO,bT)rfcRequest for comments: proposals for changes

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions