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. [SOLVED] ToolButton clicked() signal is not emitted on Windows 8
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] ToolButton clicked() signal is not emitted on Windows 8

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 1.3k Views 1 Watching
  • 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.
  • D Offline
    D Offline
    Dmitry.Sokolov
    wrote on last edited by
    #1

    I have a toolbar with custom ToolButton buttons:

    @ // main.qml

    ApplicationWindow {
    toolBar: ToolBar {
    RowLayout {
    anchors.fill: parent
    spacing: 4

            MyToolButton {
                id: tb1OpenBtn
                iconSrc: "qrc:///images/fopen.svg"
                iconWidth: 24
                iconHeight: 24
                iconMargins: 2
                onClicked: console.log("OpenBtn clicked")
            }
        }
    }
    

    }

    // MyToolButton.qml

    ToolButton {
    property real iconWidth: 32
    property real iconHeight: 32
    property real iconMargins: 2
    property url iconSrc: ""

    implicitWidth: iconWidth + 2 * iconMargins
    implicitHeight: iconHeight + 2 * iconMargins
    
    Image {
        anchors.fill: parent
        anchors.margins: iconMargins
        fillMode: Image.Pad
        source: iconSrc
        sourceSize.width: iconWidth
        sourceSize.height: iconHeight
    }
    

    }
    @

    When running on Windows 7 - ok, single click on a toolbutton makes console log entries.
    But when running on Windows 8 nothing happens. Only double click works.
    Why?

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      You are using your own ToolButton. Can you try adding MouseArea to MyToolButton.qml file and see whether events are caught.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0
      • D Offline
        D Offline
        Dmitry.Sokolov
        wrote on last edited by
        #3

        The issue was fixed by capturing clicks in MouseArea and passing them to parent element.

        @// MyToolButton.qml

        ToolButton {
        property real iconWidth: 32
        property real iconHeight: 32
        property real iconMargins: 2
        property url iconSrc: ""

        implicitWidth: iconWidth + 2 * iconMargins
        implicitHeight: iconHeight + 2 * iconMargins
        
        Image {
            anchors.fill: parent
            anchors.margins: iconMargins
            fillMode: Image.Pad
            source: iconSrc
            sourceSize.width: iconWidth
            sourceSize.height: iconHeight
        }
        
        id: _btn
        MouseArea {
            anchors.fill: parent
            onClicked: _btn.clicked()
        }
        

        }@

        1 Reply Last reply
        0

        • Login

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