I have an application that displays a QML map inside a QWidget. The Qwidget forms part of a Horizontal layout with splitter in order to allow the map to take up most of the space. My UI structure look like the image below.
The wdgtMap is the one that is used as a window container. If I drop a text edit in there (in designer), the text edit fills the widget as expected and expands as application is resized and maximised.
If now in code, I create my window container for the map, the map does not expand to the size of the wdgtMap. I have tried many different options to no avail.
qmlMapObject = qvMap->rootObject();
// Set the context and include properties.
QQmlContext *ctxt = qvMap->rootContext();
ctxt->setContextProperty("asset_class", &clAsset);
// Set the source after defining the context.
qvMap->setSource(QUrl("qrc:/main.qml"));
// Set widget properties.
QWidget *qvMapContainer = QWidget::createWindowContainer(qvMap, ui->wdgtMap);
qvMapContainer->setMinimumSize(20,20);
qvMapContainer->setSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::MinimumExpanding);
In the header file under private section the following:
QQuickView *qvMap = new QQuickView();
QObject *qmlMapObject;
The second image is what I end up with.You can see the small map in the top right block. I want it to fill all that space and expand/shrink as the app is resized.
Pointers in the right direction will be much appreciated.