Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [BUG] QML: Touch-Button not working inside Popup
Forum Updated to NodeBB v4.3 + New Features

[BUG] QML: Touch-Button not working inside Popup

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 277 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jakobjung10
    wrote on 20 Aug 2024, 14:03 last edited by
    #1

    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")
                            }
                        }
                    }
                }
            }
        }
    }
    
    1 Reply Last reply
    0
    • G Offline
      G Offline
      GrecKo
      Qt Champions 2018
      wrote on 20 Aug 2024, 20:38 last edited by
      #2

      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?

      1 Reply Last reply
      1
      • J Offline
        J Offline
        jakobjung10
        wrote on 22 Aug 2024, 08:30 last edited by
        #3

        Yes, that works. Thank you!

        1 Reply Last reply
        0

        1/3

        20 Aug 2024, 14:03

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved