diff options
Diffstat (limited to 'src/declarative/util/qmlview.cpp')
-rw-r--r-- | src/declarative/util/qmlview.cpp | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/src/declarative/util/qmlview.cpp b/src/declarative/util/qmlview.cpp index 05b6016..632e8e2 100644 --- a/src/declarative/util/qmlview.cpp +++ b/src/declarative/util/qmlview.cpp @@ -126,12 +126,13 @@ void FrameBreakAnimation::updateCurrentTime(int msecs) server->frameBreak(); } -class QmlViewPrivate : public QGraphicsViewPrivate +class QmlViewPrivate { - Q_DECLARE_PUBLIC(QmlView) public: - QmlViewPrivate() - : root(0), component(0), resizeMode(QmlView::SizeViewToRootObject) {} + QmlViewPrivate(QmlView *view) + : q(view), root(0), component(0), resizeMode(QmlView::SizeViewToRootObject) {} + + QmlView *q; QGuard<QGraphicsObject> root; QGuard<QmlGraphicsItem> qmlRoot; @@ -214,16 +215,14 @@ public: Constructs a QmlView with the given \a parent. */ QmlView::QmlView(QWidget *parent) -: QGraphicsView(*(new QmlViewPrivate), parent) +: QGraphicsView(parent), d(new QmlViewPrivate(this)) { - Q_D(QmlView); setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred); d->init(); } void QmlViewPrivate::init() { - Q_Q(QmlView); #ifdef Q_ENABLE_PERFORMANCE_LOG { QmlPerfTimer<QmlPerf::FontDatabase> perf; @@ -252,7 +251,6 @@ void QmlViewPrivate::init() */ QmlView::~QmlView() { - Q_D(QmlView); delete d->root; } @@ -265,7 +263,6 @@ QmlView::~QmlView() */ void QmlView::setSource(const QUrl& url) { - Q_D(QmlView); d->source = url; } @@ -276,7 +273,6 @@ void QmlView::setSource(const QUrl& url) */ QUrl QmlView::source() const { - Q_D(const QmlView); return d->source; } @@ -286,7 +282,6 @@ QUrl QmlView::source() const */ QmlEngine* QmlView::engine() { - Q_D(QmlView); return &d->engine; } @@ -299,7 +294,6 @@ QmlEngine* QmlView::engine() */ QmlContext* QmlView::rootContext() { - Q_D(QmlView); return d->engine.rootContext(); } @@ -310,7 +304,6 @@ QmlContext* QmlView::rootContext() */ void QmlView::execute() { - Q_D(QmlView); delete d->root; delete d->component; d->component = new QmlComponent(&d->engine, d->source, this); @@ -340,7 +333,6 @@ void QmlView::execute() QmlView::Status QmlView::status() const { - Q_D(const QmlView); if (!d->component) return QmlView::Null; @@ -353,7 +345,6 @@ QmlView::Status QmlView::status() const */ QList<QmlError> QmlView::errors() const { - Q_D(const QmlView); if (d->component) return d->component->errors(); return QList<QmlError>(); @@ -379,7 +370,6 @@ QList<QmlError> QmlView::errors() const void QmlView::setResizeMode(ResizeMode mode) { - Q_D(QmlView); if (d->resizeMode == mode) return; @@ -397,7 +387,6 @@ void QmlView::setResizeMode(ResizeMode mode) QmlView::ResizeMode QmlView::resizeMode() const { - Q_D(const QmlView); return d->resizeMode; } @@ -406,7 +395,6 @@ QmlView::ResizeMode QmlView::resizeMode() const */ void QmlView::continueExecute() { - Q_D(QmlView); disconnect(d->component, SIGNAL(statusChanged(QmlComponent::Status)), this, SLOT(continueExecute())); @@ -483,7 +471,6 @@ void QmlView::continueExecute() */ void QmlView::sizeChanged() { - Q_D(QmlView); // delay, so we catch both width and height changing. d->resizetimer.start(0,this); } @@ -495,7 +482,6 @@ void QmlView::sizeChanged() */ void QmlView::timerEvent(QTimerEvent* e) { - Q_D(QmlView); if (!e || e->timerId() == d->resizetimer.timerId()) { if (d->qmlRoot) { QSize sz(d->qmlRoot->width(),d->qmlRoot->height()); @@ -514,7 +500,6 @@ void QmlView::timerEvent(QTimerEvent* e) */ QSize QmlView::sizeHint() const { - Q_D(const QmlView); if (d->qmlRoot) { if (d->initialSize.width() <= 0) d->initialSize.setWidth(d->qmlRoot->width()); @@ -529,7 +514,6 @@ QSize QmlView::sizeHint() const */ QGraphicsObject *QmlView::rootObject() const { - Q_D(const QmlView); return d->root; } @@ -540,7 +524,6 @@ QGraphicsObject *QmlView::rootObject() const */ void QmlView::resizeEvent(QResizeEvent *e) { - Q_D(QmlView); if (d->resizeMode == SizeRootObjectToView && d->qmlRoot) { d->qmlRoot->setWidth(width()); d->qmlRoot->setHeight(height()); @@ -560,7 +543,6 @@ void QmlView::resizeEvent(QResizeEvent *e) */ void QmlView::paintEvent(QPaintEvent *event) { - Q_D(QmlView); int time = 0; if (frameRateDebug() || QmlViewDebugServer::isDebuggingEnabled()) time = d->frameTimer.restart(); |