summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@digia.com>2014-07-10 12:19:36 +0200
committerUlf Hermann <ulf.hermann@digia.com>2014-07-11 13:53:10 +0200
commitb3348daefdd309637e1e9a5ac489c49533463123 (patch)
treebf81062b9e8315c97847af11c009b1f2143eef1e /src
parent141d0d906b1a6a4e0d8e16e6e62d7d8f17107928 (diff)
downloadqt-creator-b3348daefdd309637e1e9a5ac489c49533463123.tar.gz
QmlProfiler: Make sure TimelineRenderer is using the right x and width
If we use different x and width parameters in JavaScript and C++ we introduce numerical instability which leads to visual glitches. Change-Id: I352f3e8365ca52d135230343c2f034332ec71323 Task-number: QTCREATORBUG-12648 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/qmlprofiler/qml/MainView.qml26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/plugins/qmlprofiler/qml/MainView.qml b/src/plugins/qmlprofiler/qml/MainView.qml
index 2ab99e15c2..d9c60d0839 100644
--- a/src/plugins/qmlprofiler/qml/MainView.qml
+++ b/src/plugins/qmlprofiler/qml/MainView.qml
@@ -273,7 +273,6 @@ Rectangle {
onInteractiveChanged: interactive = stayInteractive
onStayInteractiveChanged: interactive = stayInteractive
- onContentXChanged: view.updateZoomControl()
onWidthChanged: {
var duration = Math.abs(zoomControl.endTime() - zoomControl.startTime());
if (duration > 0)
@@ -312,19 +311,20 @@ Rectangle {
onHeightChanged: requestPaint()
property bool recursionGuard: false
- function updateZoomControl() {
+ property int intX: x
+ property int intWidth: width
+ onIntXChanged: {
// Don't updateZoomControl if we're just updating the flick range, _from_
// zoomControl. The other way round is OK. We _want_ the flick range to be updated
// on external changes to zoomControl.
if (recursionGuard)
return;
- var newStartTime = Math.round(flick.contentX * (endTime - startTime) / flick.width) +
- zoomControl.windowStart();
- if (Math.abs(newStartTime - startTime) > 1) {
- var newEndTime = Math.round((flick.contentX + flick.width) *
- (endTime - startTime) /
- flick.width) + zoomControl.windowStart();
+ var newStartTime = intX * (endTime - startTime) / intWidth +
+ zoomControl.windowStart();
+ if (Math.abs(newStartTime - startTime) >= 1) {
+ var newEndTime = (intX + intWidth) * (endTime - startTime) / intWidth +
+ zoomControl.windowStart();
zoomControl.setRange(newStartTime, newEndTime);
}
}
@@ -339,12 +339,12 @@ Rectangle {
if (!flick.movingHorizontally) {
// This triggers an unwanted automatic change in contentX. We ignore that by
// checking recursionGuard in this function and in updateZoomControl.
- flick.contentWidth = zoomControl.windowLength() * flick.width / duration;
+ flick.contentWidth = zoomControl.windowLength() * intWidth / duration;
- var newStartX = (startTime - zoomControl.windowStart()) * flick.width /
+ var newStartX = (startTime - zoomControl.windowStart()) * intWidth /
duration;
- if (isFinite(newStartX) && Math.abs(newStartX - flick.contentX) >= 1)
+ if (isFinite(newStartX) && Math.abs(newStartX - intX) >= 1)
flick.contentX = newStartX;
}
recursionGuard = false;
@@ -379,8 +379,8 @@ Rectangle {
}
// hack to pass mouse events to the other mousearea if enabled
- startDragArea: selectionRange.ready ? selectionRange.getLeft() : -flick.contentX
- endDragArea: selectionRange.ready ? selectionRange.getRight() : -flick.contentX-1
+ startDragArea: selectionRange.ready ? selectionRange.getLeft() : -x
+ endDragArea: selectionRange.ready ? selectionRange.getRight() : -x - 1
}
MouseArea {
id: selectionRangeControl