forked from qt-creator/qt-creator
QmlProfiler: Try harder to obtain a canvas context
The QML canvas is notoriously bad at keeping its context around. This workaround gives us a valid context in many of these cases. Change-Id: I6c23aa2b44c10a48cdb89c66a2861ab8d31bcfc8 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
@@ -112,8 +112,7 @@ Canvas {
|
||||
|
||||
// ***** slots
|
||||
onPaint: {
|
||||
if (context === null)
|
||||
return; // canvas isn't ready
|
||||
var context = (canvas.context === null) ? getContext("2d") : canvas.context;
|
||||
|
||||
Plotter.qmlProfilerModelProxy = qmlProfilerModelProxy;
|
||||
|
||||
|
||||
@@ -48,8 +48,7 @@ Canvas {
|
||||
}
|
||||
|
||||
onPaint: {
|
||||
if (context === null)
|
||||
return; // canvas isn't ready
|
||||
var context = (timeDisplay.context === null) ? getContext("2d") : timeDisplay.context;
|
||||
|
||||
context.reset();
|
||||
context.fillStyle = "white";
|
||||
|
||||
@@ -51,9 +51,7 @@ Canvas {
|
||||
onYChanged: requestPaint()
|
||||
|
||||
onPaint: {
|
||||
if (context === null)
|
||||
return; // canvas isn't ready
|
||||
|
||||
var context = (timeMarks.context === null) ? getContext("2d") : timeMarks.context;
|
||||
context.reset();
|
||||
drawBackgroundBars( context, region );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user