QmlProfiler: prevent details pop-ups to leave screen

Task-number: QTCREATORBUG-8058

Change-Id: Id20e9d0573ee52bd0965a4e56c51df2aee6d2fa2
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
Christiaan Janssen
2012-10-17 15:51:28 +02:00
parent b010720483
commit 2a66ab6d64
2 changed files with 52 additions and 0 deletions

View File

@@ -55,6 +55,28 @@ Item {
property int relativey : y - yoffset
onYChanged: relativey = y - yoffset
// keep inside view
Connections {
target: root
onWidthChanged: fitInView();
onCandidateHeightChanged: fitInView();
}
function fitInView() {
// don't reposition if it does not fit
if (root.width < width || root.candidateHeight < height)
return;
if (x + width > root.width)
x = root.width - width;
if (x < 0)
x = 0;
if (y + height > root.candidateHeight)
y = root.candidateHeight - height;
if (y < 0)
y = 0;
}
// shadow
BorderImage {
property int px: 4
@@ -163,6 +185,10 @@ Item {
width: col.width + 45
height: col.height + 30
drag.target: parent
drag.minimumX: 0
drag.maximumX: root.width - parent.width
drag.minimumY: 0
drag.maximumY: root.candidateHeight - parent.height
onClicked: {
root.gotoSourceLocation(file, line, column);
root.recenterOnItem(view.selectedItem);

View File

@@ -50,6 +50,28 @@ Item {
property int relativey : y - yoffset
onYChanged: relativey = y - yoffset
// keep inside view
Connections {
target: root
onWidthChanged: fitInView();
onCandidateHeightChanged: fitInView();
}
function fitInView() {
// don't reposition if it does not fit
if (root.width < width || root.candidateHeight < height)
return;
if (x + width > root.width)
x = root.width - width;
if (x < 0)
x = 0;
if (y + height > root.candidateHeight)
y = root.candidateHeight - height;
if (y < 0)
y = 0;
}
// shadow
BorderImage {
property int px: 4
@@ -134,6 +156,10 @@ Item {
width: col.width + 45
height: col.height + 30
drag.target: parent
drag.minimumX: 0
drag.maximumX: root.width - parent.width
drag.minimumY: 0
drag.maximumY: root.candidateHeight - parent.height
onClicked: {
if ((selectionRange.x < flick.contentX) ^ (selectionRange.x+selectionRange.width > flick.contentX + flick.width)) {
root.recenter(selectionRange.startTime + selectionRange.duration/2);