I have the following code inside a method handleButton(), which gives me the qml ApplicationWindow inside a new window when handleButton() is triggered. But how can I place the content of the ApplicationWindow inside the C++ childwindow (shown with help of MyWidget)? For example, if I say mainLayout->addLayout(verticalLayout);
then there comes a white area inside the GroupBox in which handleButton is triggered. But I want to have this white area in the child window, and it must not be a white area: it must contain the qml ApplicationWindow. Any help appreciated.
void MyWidget::handleButton()
{
QQuickView *view = new QQuickView();
container->setMinimumSize(200, 200);
container->setMaximumSize(200, 200);
container->setFocusPolicy(Qt::TabFocus);
view
->setSource
(QUrl("qrc:/main.qml"));
verticalLayout->addWidget(container);
}
void MyWidget::handleButton()
{
QQuickView *view = new QQuickView();
QWidget *container = QWidget::createWindowContainer(view, this);
container->setMinimumSize(200, 200);
container->setMaximumSize(200, 200);
container->setFocusPolicy(Qt::TabFocus);
view->setSource(QUrl("qrc:/main.qml"));
QVBoxLayout *verticalLayout = new QVBoxLayout();
verticalLayout->addWidget(container);
}
To copy to clipboard, switch view to plain text mode
Bookmarks