diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-05-11 23:56:41 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-05-11 23:56:41 (GMT) |
commit | 419118871087d6ed47065129459fa3c3db97f14f (patch) | |
tree | 96d66619f72582de6526579a3ad285df17ff154c /src/declarative | |
parent | 036970e7d8c6b2e046ab11924d278c36df8c1c51 (diff) | |
download | Qt-419118871087d6ed47065129459fa3c3db97f14f.zip Qt-419118871087d6ed47065129459fa3c3db97f14f.tar.gz Qt-419118871087d6ed47065129459fa3c3db97f14f.tar.bz2 |
Fix resizing and skinning.
Broke with mainwindow introduction.
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/util/qfxview.cpp | 17 | ||||
-rw-r--r-- | src/declarative/util/qfxview.h | 2 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/declarative/util/qfxview.cpp b/src/declarative/util/qfxview.cpp index 078916b..e17decf 100644 --- a/src/declarative/util/qfxview.cpp +++ b/src/declarative/util/qfxview.cpp @@ -105,6 +105,8 @@ public: QmlComponent *component; QBasicTimer resizetimer; + QSize initialSize; + void init(); }; @@ -137,6 +139,7 @@ public: QFxView::QFxView(QWidget *parent) : QSimpleCanvas(parent), d(new QFxViewPrivate(this)) { + setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred); d->init(); } @@ -150,6 +153,7 @@ QFxView::QFxView(QWidget *parent) QFxView::QFxView(QSimpleCanvas::CanvasMode mode, QWidget *parent) : QSimpleCanvas(mode, parent), d(new QFxViewPrivate(this)) { + setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred); d->init(); } @@ -381,10 +385,23 @@ void QFxView::timerEvent(QTimerEvent* e) if (d->root) emit sceneResized(QSize(d->root->width(),d->root->height())); d->resizetimer.stop(); + updateGeometry(); } } /*! + The size hint is the size of the root item. +*/ +QSize QFxView::sizeHint() const +{ + if (d->initialSize.width() <= 0) + d->initialSize.setWidth(d->root->width()); + if (d->initialSize.height() <= 0) + d->initialSize.setHeight(d->root->height()); + return d->initialSize; +} + +/*! Creates a \l{QmlComponent} {component} from the \a qml string, and returns it as an \l {QFxItem} {item}. If the \a parent item is provided, it becomes the new item's diff --git a/src/declarative/util/qfxview.h b/src/declarative/util/qfxview.h index f575f27..d6f786c 100644 --- a/src/declarative/util/qfxview.h +++ b/src/declarative/util/qfxview.h @@ -82,6 +82,8 @@ public: virtual QFxItem *root() const; + QSize sizeHint() const; + void dumpRoot(); static void printErrorLine(const QmlError &); |