diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-04-30 02:46:45 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-04-30 02:46:45 (GMT) |
commit | bab72866f444443632528fadd240eea6f79d66e2 (patch) | |
tree | 1ce1b9d0275243f90d94ae6b7517b90ccb85f510 | |
parent | 54839beaabb62da8ca238b64683b56e66e1ff10b (diff) | |
download | Qt-bab72866f444443632528fadd240eea6f79d66e2.zip Qt-bab72866f444443632528fadd240eea6f79d66e2.tar.gz Qt-bab72866f444443632528fadd240eea6f79d66e2.tar.bz2 |
Compress sizeChanged signal to give width and height.
-rw-r--r-- | src/declarative/util/qfxview.cpp | 16 | ||||
-rw-r--r-- | src/declarative/util/qfxview.h | 1 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/declarative/util/qfxview.cpp b/src/declarative/util/qfxview.cpp index e285890..42047b6 100644 --- a/src/declarative/util/qfxview.cpp +++ b/src/declarative/util/qfxview.cpp @@ -49,6 +49,7 @@ #include "qicon.h" #include "qurl.h" #include "qboxlayout.h" +#include "qbasictimer.h" #include "qmlbindablevalue.h" #include "qml.h" @@ -100,6 +101,8 @@ public: QmlEngine engine; QmlComponent *component; + QBasicTimer resizetimer; + void init(); }; @@ -282,8 +285,17 @@ void QFxView::continueExecute() void QFxView::sizeChanged() { - if (d->root) - emit sceneResized(QSize(d->root->width(),d->root->height())); + // delay, so we catch both width and height changing. + d->resizetimer.start(0,this); +} + +void QFxView::timerEvent(QTimerEvent* e) +{ + if (e->timerId() == d->resizetimer.timerId()) { + if (d->root) + emit sceneResized(QSize(d->root->width(),d->root->height())); + d->resizetimer.stop(); + } } QFxItem* QFxView::addItem(const QString &xml, QFxItem* parent) diff --git a/src/declarative/util/qfxview.h b/src/declarative/util/qfxview.h index 3c4be20..c658f07 100644 --- a/src/declarative/util/qfxview.h +++ b/src/declarative/util/qfxview.h @@ -95,6 +95,7 @@ protected: virtual void resizeEvent(QResizeEvent *); void focusInEvent(QFocusEvent *); void focusOutEvent(QFocusEvent *); + void timerEvent(QTimerEvent*); private: friend class QFxViewPrivate; |