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);
    QVBoxLayout* pLayout = new QVBoxLayout(this);
    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.


  • -Have you tried setting "QDeclarativeView::resizeMode": to SizeViewToRootObject?- Should be default.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.