summaryrefslogtreecommitdiffstats
path: root/src/declarative/util/qdeclarativeview.cpp
diff options
context:
space:
mode:
authorDavid Boddie <dboddie@trolltech.com>2010-06-16 10:44:02 (GMT)
committerDavid Boddie <dboddie@trolltech.com>2010-06-16 10:44:02 (GMT)
commit9e7f0b9e45cef278c8874539257b4038a0aa6615 (patch)
tree6f66ec8ea599e348ea550da76612cb3873478a21 /src/declarative/util/qdeclarativeview.cpp
parent700a4826cf6bd755df000cb16c259343efb695cd (diff)
parent5b5785bc564ccea9f6868d02be3d1080cb5039b9 (diff)
downloadQt-9e7f0b9e45cef278c8874539257b4038a0aa6615.zip
Qt-9e7f0b9e45cef278c8874539257b4038a0aa6615.tar.gz
Qt-9e7f0b9e45cef278c8874539257b4038a0aa6615.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7
Diffstat (limited to 'src/declarative/util/qdeclarativeview.cpp')
-rw-r--r--src/declarative/util/qdeclarativeview.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp
index 6059ad6..0414e65 100644
--- a/src/declarative/util/qdeclarativeview.cpp
+++ b/src/declarative/util/qdeclarativeview.cpp
@@ -131,7 +131,7 @@ class QDeclarativeViewPrivate : public QGraphicsViewPrivate, public QDeclarative
Q_DECLARE_PUBLIC(QDeclarativeView)
public:
QDeclarativeViewPrivate()
- : root(0), declarativeItemRoot(0), graphicsWidgetRoot(0), component(0), resizeMode(QDeclarativeView::SizeViewToRootObject) {}
+ : root(0), declarativeItemRoot(0), graphicsWidgetRoot(0), component(0), resizeMode(QDeclarativeView::SizeViewToRootObject), initialSize(0,0) {}
~QDeclarativeViewPrivate() { delete root; }
void execute();
void itemGeometryChanged(QDeclarativeItem *item, const QRectF &newGeometry, const QRectF &oldGeometry);
@@ -150,6 +150,7 @@ public:
QBasicTimer resizetimer;
QDeclarativeView::ResizeMode resizeMode;
+ QSize initialSize;
QElapsedTimer frameTimer;
void init();
@@ -586,9 +587,11 @@ void QDeclarativeView::setRootObject(QObject *obj)
}
if (d->root) {
- QSize initialSize = d->rootObjectSize();
- if (initialSize != size()) {
- resize(initialSize);
+ d->initialSize = d->rootObjectSize();
+ if (d->initialSize != size()) {
+ if (!(parentWidget() && parentWidget()->layout())) {
+ resize(d->initialSize);
+ }
}
d->initResize();
}
@@ -638,6 +641,15 @@ QSize QDeclarativeView::sizeHint() const
}
/*!
+ Returns the initial size of the root object
+*/
+QSize QDeclarativeView::initialSize() const
+{
+ Q_D(const QDeclarativeView);
+ return d->initialSize;
+}
+
+/*!
Returns the view's root \l {QGraphicsObject} {item}.
*/
QGraphicsObject *QDeclarativeView::rootObject() const