Details
-
Bug
-
Resolution: Incomplete
-
P1: Critical
-
None
-
5.12.8
-
None
-
-
0.5
Description
If the onReleased signal of a button inside a Flickable is not being triggered when you release the button after scrolling. If I am pressed and dragging the Flick-able area, it invokes the onPressed signal and affected the Pressed Image source. Now I am released the screen , it not invoked the onReleased signal from the application ( i.e., it stays back in the pressed state).
steps to reproduce this issue:
- Press the button in the screen
- Hold and drag the screen., it invokes the pressed signals and changes the images.
- Now the Released the screen, it stays back to the pressed state.
Code:
import QtQuick 2.10 import QtQuick.Controls 2.4 Item { id: view_tools property ImageTextButton pressedButton: null anchors.fill: parent Flickable { id: region_tools x: 30 y: 10 width: 950 height: 460 clip: true contentWidth: grid.width contentHeight: grid.height + 20 boundsBehavior: Flickable.StopAtBounds Grid { id: grid width: 900 height: 560 anchors.centerIn: parent columns: 3 rows: 6 spacing: 6 Repeater { id: tools anchors.fill: parent clip: true model: [ '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18' ] delegate: ImageTextButton { id: tools_button width: 280 height: 78 normalSource: "blue.png" pressedSource: "red.png" mousePropagateComposedEvents: false mousePreventStealing: false text: qsTr(modelData) + translator.text fillMode: Image.Stretch fontFamily: localFontHeavy.name fontSize: Theme.sFont fontWeight: Font.Bold lineHeight: 33 color: "#FFFFFF" textWidth: parent.width textWrapMode: Text.WordWrap MouseArea { id: buttonArea anchors.fill: parent onPressed: { console.log("Pressed Tools") tools_button.normalSource = tools_button.pressedSource view_tools.pressedButton = tools_button } onClicked: { switch(index) { } } // onclicked onReleased: { console.log("OnReleased Tools") tools_button.normalSource = "qrc:/images/btn_tools.png" view_tools.pressedButton = null // Handle button released event here } // on Released } } } } onMovementEnded: { console.log("Flicked Movement Ended") if (view_tools.pressedButton !== null) { console.log("OnReleased Tools") view_tools.pressedButton.normalSource = "blue.png" view_tools.pressedButton = null } else { console.log("Outside of MouseArea, canceling button press") view_tools.pressedButton.normalSource = "blue.png" view_tools.pressedButton = null } } } }
Output:
qml: Pressed Tools qml: OnReleased Tools qml: Pressed Tools qml: Flicked Movement Ended qml: OVER OVER qml: Pressed Tools Note: OnReleased is not invoked
Tried:
- flickEnded
- MovementEnded
Attachments
Issue Links
- blocks
-
QTBUG-114052 OnReleased Signal is not invoked in Flickable
- Reported