Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why doesn't the QQuickWidget program display when using QQmlApplicationEngine replacement? #1

Open
mirro187187 opened this issue Jul 31, 2020 · 0 comments

Comments

@mirro187187
Copy link

I modify the program support QT5.8.

` QQucikWidget* pWidget = new QQucikWidget();
pWidget->setResizeMode(QuickWidget:SizeRootObjectToView);

QStandardItemModel standardItemModel;
QStandardItem root("Root");
root.setIcon(qtApp.style()->standardIcon(QStyle::SP_DesktopIcon));
QStandardItem child1("Child 1");
QStandardItem child2("Child 2");
QStandardItem child3("Child 3");
QStandardItem child1OfChild1("Child 1 of Child 1");
QStandardItem child2OfChild1("Child 2 of Child 1");
QStandardItem child1OfChild2("Child 1 of Child 2");

child1.appendRow(&child1OfChild1);
child1.appendRow(&child2OfChild1);
child2.appendRow(&child1OfChild2);
root.appendRow(&child1);
root.appendRow(&child2);
root.appendRow(&child3);
standardItemModel.appendRow(&root);

TreeViewModel standardItemTreeViewModel;
standardItemTreeViewModel.setSourceModel(&standardItemModel);

pWidget ->rootContext()->setContextProperty("standardItemModel", &standardItemTreeViewModel);

 pWidget ->load(QUrl("qrc:/main.qml"));`
@mirro187187 mirro187187 changed the title Why doesn't the QQuickWidget program work when using QQmlApplicationEngine replacement? Why doesn't the QQuickWidget program display when using QQmlApplicationEngine replacement? Jul 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant