本文整理汇总了C++中QQuickView::status方法的典型用法代码示例。如果您正苦于以下问题:C++ QQuickView::status方法的具体用法?C++ QQuickView::status怎么用?C++ QQuickView::status使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QQuickView
的用法示例。
在下文中一共展示了QQuickView::status方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: errors
void tst_QQuickView::errors()
{
QQuickView *view = new QQuickView;
QVERIFY(view);
QQmlTestMessageHandler messageHandler;
view->setSource(testFileUrl("error1.qml"));
QVERIFY(view->status() == QQuickView::Error);
QVERIFY(view->errors().count() == 1);
delete view;
}
示例2: errors
void tst_QQuickView::errors()
{
{
QQuickView view;
QQmlTestMessageHandler messageHandler;
view.setSource(testFileUrl("error1.qml"));
QVERIFY(view.status() == QQuickView::Error);
QVERIFY(view.errors().count() == 1);
}
}
示例3: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QWidget widget;
widget.setWindowTitle(QT_VERSION_STR);
const QUrl source(QUrl::fromLocalFile(QLatin1String(SRCDIR) + QStringLiteral("/main.qml")));
QHBoxLayout *hLayout = new QHBoxLayout(&widget);
QGroupBox *groupBox = new QGroupBox("QuickWidget", &widget);
QVBoxLayout *vLayout = new QVBoxLayout(groupBox);
QQuickWidget *quickWidget = new QQuickWidget(groupBox);
quickWidget->setMinimumSize(200, 200);
vLayout->addWidget(quickWidget);
quickWidget->setResizeMode(QQuickWidget::SizeRootObjectToView);
quickWidget->setSource(source);
if (quickWidget->status() == QQuickWidget::Error) {
qWarning() << quickWidget->errors();
return 1;
}
hLayout->addWidget(groupBox);
groupBox = new QGroupBox("QQuickView/createWindowContainer", &widget);
vLayout = new QVBoxLayout(groupBox);
QQuickView *view = new QQuickView;
view->setSource(source);
if (view->status() == QQuickView::Error) {
qWarning() << view->errors();
return 1;
}
view->setResizeMode(QQuickView::SizeRootObjectToView);
QWidget *container = QWidget::createWindowContainer(view, groupBox);
container->setMinimumSize(200, 200);
vLayout->addWidget(container);
hLayout->addWidget(groupBox);
const QRect availableGeometry = QApplication::desktop()->availableGeometry(&widget);
widget.move(availableGeometry.center() - QPoint(widget.sizeHint().width() / 2, widget.sizeHint().height() / 2));
widget.show();
return app.exec();
}