Commit acba504a authored by Ulf Hermann's avatar Ulf Hermann

QmlProfiler: Centralize redrawing of custom canvas

Don't handle redraw events in QML anymore and instead trigger a redraw
on geometryChange as well as componentComplete from C++. This reduces
redundant code and glitches from forgotten QML event handlers.

Change-Id: I0eadfb54cf8e392152c4d91b83c874b37b1aca96
Reviewed-by: default avatarKai Koehne <kai.koehne@digia.com>
parent c28689e3
......@@ -92,6 +92,13 @@ void QmlProfilerCanvas::componentComplete()
QMetaObject::connect(this, p.notifySignalIndex(), this, requestPaintMethod, 0, 0);
}
QQuickItem::componentComplete();
requestRedraw();
}
void QmlProfilerCanvas::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
{
QQuickItem::geometryChanged(newGeometry, oldGeometry);
requestRedraw();
}
}
......
......@@ -61,6 +61,7 @@ private slots:
protected:
virtual void paint(QPainter *);
virtual void componentComplete();
virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
private:
Context2D *m_context2d;
......
......@@ -38,17 +38,6 @@ Canvas2D {
property real endTime : 0
property real timePerPixel: 0
Component.onCompleted: {
requestRedraw();
}
onWidthChanged: {
requestRedraw();
}
onHeightChanged: {
requestRedraw();
}
Connections {
target: zoomControl
onRangeChanged: {
......
......@@ -38,21 +38,6 @@ Canvas2D {
property real endTime
property real timePerPixel
Component.onCompleted: {
requestRedraw();
}
onWidthChanged: {
requestRedraw();
}
onHeightChanged: {
requestRedraw();
}
onYChanged: {
requestRedraw();
}
Connections {
target: labels
onHeightChanged: { requestRedraw(); }
......
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