Commit 0599cb73 authored by Kai Koehne's avatar Kai Koehne

QmlProfiler: Avoid drawing outside of widget

Avoid rendering outside of the canvas by forcing the windows
size onto the scene, and also removing the related candidateSize
logic.

In the QtQUick1 based profiler one could scroll the canvas also
vertically, but that doesn't work any more. This is a hot fix
to work around the problem, we can hopefully bring back the
full solution later ...

Change-Id: Ibd3d54f6b98c3764e104116d395a77b880d88bcb
Reviewed-by: default avatarUlf Hermann <ulf.hermann@digia.com>
Reviewed-by: default avatarKai Koehne <kai.koehne@digia.com>
parent 33ac7e44
......@@ -35,9 +35,7 @@ Rectangle {
// ***** properties
property int candidateHeight: 0
property int scrollY: 0
height: Math.max( candidateHeight, labels.height + 2 )
property int singleRowHeight: 30
......@@ -464,9 +462,9 @@ Rectangle {
root.updateVerticalScroll(itemY);
} else
if (itemY + root.singleRowHeight >
root.scrollY + root.candidateHeight) {
root.scrollY + root.height) {
root.updateVerticalScroll(itemY + root.singleRowHeight -
root.candidateHeight);
root.height);
}
} else {
......@@ -584,7 +582,7 @@ Rectangle {
}
Rectangle {
y: root.scrollY + root.candidateHeight - height
y: root.scrollY + root.height - height
height: 6
width: root.width
x: 0
......
......@@ -62,7 +62,7 @@ Item {
Connections {
target: root
onWidthChanged: fitInView();
onCandidateHeightChanged: fitInView();
onHeightChanged: fitInView();
}
//property int eventInfo
......@@ -97,15 +97,15 @@ Item {
function fitInView() {
// don't reposition if it does not fit
if (root.width < width || root.candidateHeight < height)
if (root.width < width || root.height < height)
return;
if (x + width > root.width)
x = root.width - width;
if (x < 0)
x = 0;
if (y - yoffset + height > root.candidateHeight)
y = root.candidateHeight - height + yoffset;
if (y - yoffset + height > root.height)
y = root.height - height + yoffset;
if (y < yoffset)
y = yoffset;
}
......@@ -193,7 +193,7 @@ Item {
drag.minimumX: 0
drag.maximumX: root.width - parent.width
drag.minimumY: yoffset
drag.maximumY: root.candidateHeight - parent.height + yoffset
drag.maximumY: root.height - parent.height + yoffset
onClicked: {
root.gotoSourceLocation(file, line, column);
root.recenterOnItem(view.selectedModel, view.selectedItem);
......
......@@ -184,7 +184,7 @@ Rectangle {
width: 4
height: 63
fillMode: Image.Tile
y: root.scrollY + root.candidateHeight / 2 - 32
y: root.scrollY + root.height / 2 - 32
}
}
......@@ -252,7 +252,7 @@ Rectangle {
width: 4
height: 63
fillMode: Image.Tile
y: root.scrollY + root.candidateHeight / 2 - 32
y: root.scrollY + root.height / 2 - 32
}
}
......
......@@ -57,20 +57,20 @@ Item {
Connections {
target: root
onWidthChanged: fitInView();
onCandidateHeightChanged: fitInView();
onHeightChanged: fitInView();
}
function fitInView() {
// don't reposition if it does not fit
if (root.width < width || root.candidateHeight < height)
if (root.width < width || root.height < height)
return;
if (x + width > root.width)
x = root.width - width;
if (x < 0)
x = 0;
if (y + height - yoffset > root.candidateHeight)
y = root.candidateHeight - height + yoffset;
if (y + height - yoffset > root.height)
y = root.height - height + yoffset;
if (y < yoffset)
y = yoffset;
}
......@@ -162,7 +162,7 @@ Item {
drag.minimumX: 0
drag.maximumX: root.width - parent.width
drag.minimumY: yoffset
drag.maximumY: root.candidateHeight - parent.height + yoffset
drag.maximumY: root.height - parent.height + yoffset
onClicked: {
if ((selectionRange.x < flick.contentX) ^ (selectionRange.x+selectionRange.width > flick.contentX + flick.width)) {
root.recenter(selectionRange.startTime + selectionRange.duration/2);
......
......@@ -153,7 +153,7 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, Analyzer::IAnalyzerT
groupLayout->setSpacing(0);
d->m_mainView = new ScrollableQuickView();
d->m_mainView->setResizeMode(QQuickView::SizeViewToRootObject);
d->m_mainView->setResizeMode(QQuickView::SizeRootObjectToView);
QWidget *mainViewContainer = QWidget::createWindowContainer(d->m_mainView);
MouseWheelResizer *resizer = new MouseWheelResizer(this);
......@@ -229,10 +229,8 @@ void QmlProfilerTraceView::reset()
d->m_overview->setSource(QUrl(QLatin1String("qrc:/qmlprofiler/Overview.qml")));
d->m_mainView->setSource(QUrl(QLatin1String("qrc:/qmlprofiler/MainView.qml")));
QQuickItem *rootObject = d->m_mainView->rootObject();
rootObject->setProperty("width", QVariant(width()));
rootObject->setProperty("candidateHeight", QVariant(height() - d->m_timebar->height() - d->m_overview->height()));
QQuickItem *rootObject = d->m_mainView->rootObject();
connect(rootObject, SIGNAL(updateCursorPosition()), this, SLOT(updateCursorPosition()));
connect(rootObject, SIGNAL(updateRangeButton()), this, SLOT(updateRangeButton()));
connect(rootObject, SIGNAL(updateLockButton()), this, SLOT(updateLockButton()));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment