Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Design Tooling
  3. Qt Design Studio
  4. QML Button onClicked doesn't work while onHoveredChanged does.
Forum Updated to NodeBB v4.3 + New Features

QML Button onClicked doesn't work while onHoveredChanged does.

Scheduled Pinned Locked Moved Solved Qt Design Studio
3 Posts 1 Posters 1.2k 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.
  • M Offline
    M Offline
    MK97w
    wrote on last edited by
    #1

    Hello everyone,

    I wanted to try QT Design Studio 4.2 for a desktop application that requires 3D animation. I want to trigger the animation by pressing a button.

    I can not trigger the animation(or trigger any other event) when i click the button however, when i use onHoveredChanged instead of onClicked, it works. I opened this issue under QT Design Studio since i didn't have the same problem on QT Creator->QTQuick project. There, onClicked method works as expected

    imports are auto generated to Screen01.ui.qml as;

    import QtQuick 6.4
    import QtQuick.Controls 6.4
    import QtQuick3D 6.4

    And here is the button i made under the same file;

    Button {
    id: button
    x: 276
    y: 393
    text: qsTr("Button")
    //focusPolicy: Qt.TabFocus
    //hoverEnabled: true
    //enabled:true
    //onHoveredChanged: anim1.running = true
    onClicked: anim1.running = true
    }
    }

    Is this a known bug? Or am i missing something.

    M 1 Reply Last reply
    0
    • M MK97w

      Hello everyone,

      I wanted to try QT Design Studio 4.2 for a desktop application that requires 3D animation. I want to trigger the animation by pressing a button.

      I can not trigger the animation(or trigger any other event) when i click the button however, when i use onHoveredChanged instead of onClicked, it works. I opened this issue under QT Design Studio since i didn't have the same problem on QT Creator->QTQuick project. There, onClicked method works as expected

      imports are auto generated to Screen01.ui.qml as;

      import QtQuick 6.4
      import QtQuick.Controls 6.4
      import QtQuick3D 6.4

      And here is the button i made under the same file;

      Button {
      id: button
      x: 276
      y: 393
      text: qsTr("Button")
      //focusPolicy: Qt.TabFocus
      //hoverEnabled: true
      //enabled:true
      //onHoveredChanged: anim1.running = true
      onClicked: anim1.running = true
      }
      }

      Is this a known bug? Or am i missing something.

      M Offline
      M Offline
      MK97w
      wrote on last edited by
      #2

      @MK97w

      Same thing also happens for "round button" and "mouse area" so i suspect that any type of clicking action is discarded/not handled

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MK97w
        wrote on last edited by
        #3

        I hope nobody will make the same silly mistake i did in here :)

        The parent rectangle was set to be disabled! When enabled, all works as expected.

        So anybody in the future who face the same issue, i suggest you to look for the parent object's enable/disable state first.

        1 Reply Last reply
        0
        • M MK97w has marked this topic as solved on

        • Login

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