Adjust QWidget size to QDeclarativeView
-
Hi there.
I want my top QWidget auto resize in according to the QML item size change. Now it doesn't change at all so I have to resize my top widget manually,
Here is the ctor code to show what I have:
@
m_pView = new QDeclarativeView(this);
...
m_pView->setSource(QmlFileName);
...
QVBoxLayout* pLayout = new QVBoxLayout(this);
pLayout->addWidget(m_pView);
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);@
So it has the right size at the start but doesn't change it dynamically while the QML component actually does.Thanks!
-
-Have you tried setting "QDeclarativeView::resizeMode":http://doc.qt.nokia.com/4.7-snapshot/qdeclarativeview.html#resizeMode-prop to SizeViewToRootObject?- Should be default.