[BUG] QML: Touch-Button not working inside Popup
-
wrote on 20 Aug 2024, 14:03 last edited by
Hello!
I might have found a bug.
Of course, it is also possible that I configured something in the wrong way.Scenario:
Creating a pop-up and placing buttons inside the pop-up.
Clicking the buttons inside the pop-up works with a mouse on a desktop setup.
However, clicking the buttons does not work on a touch-device!!!
On the touch-device, the button will only show a hover-effect when clicking on it.Specs:
- Steamdeck (also tested on raspberry pi display)
- OS: Ubuntu 22.04
- QML with PySide6
Below is a MRE (minimal reproducible example):
Best regards,
Jakob// Qt imports import QtQuick import QtQuick.Window import QtQuick.Controls import QtQuick.Controls.Material import QtQuick.Layouts ApplicationWindow { id: mainwindow width: 1280 height: 720 visible: true title: qsTr("SampleApplication") Button { text: "Open" onClicked: popup.open() } Popup { id: popup x: 100 y: 100 width: 200 height: 300 modal: true focus: true closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent background : Rectangle { anchors.fill: parent id: sample_popup visible: true color: "blue" border.color: InfineonColors.textBlack border.width: 5 radius: 10 ColumnLayout{ spacing: 2 Switch { id: setting_switch1 Layout.fillWidth: true Layout.alignment: Qt.AlignRight Material.accent: Material.Green checked: false // Handler for switch state changes onCheckedChanged: { if (checked) { console.log("checked") } else { console.log("not checked") } } } Switch { id: setting_switch2 Layout.fillWidth: true Layout.alignment: Qt.AlignRight Material.accent: Material.Green checked: false // Handler for switch state changes onCheckedChanged: { if (checked) { console.log("checked") } else { console.log("not checked") } } } Switch { id: setting_switch3 Layout.fillWidth: true Layout.alignment: Qt.AlignRight Material.accent: Material.Green checked: false // Handler for switch state changes onCheckedChanged: { if (checked) { console.log("checked") } else { console.log("not checked") } } } } } } }
-
The switches being in the Popup's background might explain why they don't work. Can you try having them in the content item of the Popup?
-
wrote on 22 Aug 2024, 08:30 last edited by
Yes, that works. Thank you!
1/3