diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-08-12 05:51:01 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-08-12 05:51:01 (GMT) |
commit | da706bdce88107c4d5fe0ca492b94e67466862e6 (patch) | |
tree | fe31bd38bc85d03d3530755999a70928ebfb80f5 /src | |
parent | 741e40dd0ffd60040c53e3c30c4bef42c0c84284 (diff) | |
download | Qt-da706bdce88107c4d5fe0ca492b94e67466862e6.zip Qt-da706bdce88107c4d5fe0ca492b94e67466862e6.tar.gz Qt-da706bdce88107c4d5fe0ca492b94e67466862e6.tar.bz2 |
Basic framerate measurement, until we have something more useful.
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/util/qfxview.cpp | 16 | ||||
-rw-r--r-- | src/declarative/util/qfxview.h | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/declarative/util/qfxview.cpp b/src/declarative/util/qfxview.cpp index 0f129d8..bb436cd 100644 --- a/src/declarative/util/qfxview.cpp +++ b/src/declarative/util/qfxview.cpp @@ -63,6 +63,8 @@ QT_BEGIN_NAMESPACE +DEFINE_BOOL_CONFIG_OPTION(frameRateDebug, QML_SHOW_FRAMERATE) + static QVariant stringToPixmap(const QString &str) { //XXX need to use correct paths @@ -98,6 +100,7 @@ public: QSize initialSize; bool resizable; + QTime frameTimer; void init(); @@ -492,6 +495,19 @@ void QFxView::resizeEvent(QResizeEvent *e) QGraphicsView::resizeEvent(e); } +/*! + \reimp +*/ +void QFxView::paintEvent(QPaintEvent *event) +{ + int time = 0; + if (frameRateDebug()) + time = d->frameTimer.restart(); + QGraphicsView::paintEvent(event); + if (frameRateDebug()) + qDebug() << "paintEvent:" << d->frameTimer.elapsed() << "time since last frame:" << time; +} + /*! \fn void QFxView::focusInEvent(QFocusEvent *e) This virtual function does nothing with the event \a e in this class. diff --git a/src/declarative/util/qfxview.h b/src/declarative/util/qfxview.h index b423749..03557a3 100644 --- a/src/declarative/util/qfxview.h +++ b/src/declarative/util/qfxview.h @@ -95,6 +95,7 @@ private Q_SLOTS: protected: virtual void resizeEvent(QResizeEvent *); + virtual void paintEvent(QPaintEvent *event); void focusInEvent(QFocusEvent *); void focusOutEvent(QFocusEvent *); void timerEvent(QTimerEvent*); |