[SOLVED] ToolButton clicked() signal is not emitted on Windows 8
-
I have a toolbar with custom ToolButton buttons:
@ // main.qml
ApplicationWindow {
toolBar: ToolBar {
RowLayout {
anchors.fill: parent
spacing: 4MyToolButton { 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? -
You are using your own ToolButton. Can you try adding MouseArea to MyToolButton.qml file and see whether events are caught.
-
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() }
}@