QmlProfiler: Initial conversion from Quick 1 to Quick 2

Updated class names and functions. Fixed imports.

Change-Id: I5f12e3a108a0e60c091acc9c415ff77e52118029
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
Thomas Hartmann
2013-09-16 14:33:07 +02:00
parent 8e281fe27b
commit 9e58ab2ac8
25 changed files with 143 additions and 136 deletions

View File

@@ -35,16 +35,14 @@
QT_BEGIN_NAMESPACE
Canvas::Canvas(QDeclarativeItem *parent)
: QDeclarativeItem(parent),
Canvas::Canvas(QQuickPaintedItem *parent)
: QQuickPaintedItem(parent),
m_context(new Context2D(this)),
m_canvasWidth(0),
m_canvasHeight(0),
m_fillMode(Canvas::Stretch),
m_color(Qt::white)
{
setFlag(QGraphicsItem::ItemHasNoContents, false);
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
}
@@ -57,10 +55,10 @@ void Canvas::componentComplete()
connect(m_context, SIGNAL(changed()), this, SLOT(requestPaint()));
emit init();
QDeclarativeItem::componentComplete();
QQuickItem::componentComplete();
}
void Canvas::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
void Canvas::paint(QPainter *painter)
{
m_context->setInPaint(true);
emit paint();
@@ -160,7 +158,7 @@ void Canvas::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometr
&& newGeometry.width() > 0 && newGeometry.height() > 0) {
m_context->setSize(width(), height());
}
QDeclarativeItem::geometryChanged(newGeometry, oldGeometry);
QQuickItem::geometryChanged(newGeometry, oldGeometry);
}
void Canvas::setCanvasWidth(int newWidth)
@@ -219,24 +217,24 @@ CanvasImage *Canvas::toImage() const
return new CanvasImage(m_context->pixmap());
}
void Canvas::setTimeout(const QScriptValue &handler, long timeout)
void Canvas::setTimeout(const QJSValue &handler, long timeout)
{
if (handler.isFunction())
if (handler.isCallable())
CanvasTimer::createTimer(this, handler, timeout, true);
}
void Canvas::setInterval(const QScriptValue &handler, long interval)
void Canvas::setInterval(const QJSValue &handler, long interval)
{
if (handler.isFunction())
if (handler.isCallable())
CanvasTimer::createTimer(this, handler, interval, false);
}
void Canvas::clearTimeout(const QScriptValue &handler)
void Canvas::clearTimeout(const QJSValue &handler)
{
CanvasTimer::removeTimer(handler);
}
void Canvas::clearInterval(const QScriptValue &handler)
void Canvas::clearInterval(const QJSValue &handler)
{
CanvasTimer::removeTimer(handler);
}