本文整理汇总了C++中QmlApplicationViewer::window方法的典型用法代码示例。如果您正苦于以下问题:C++ QmlApplicationViewer::window方法的具体用法?C++ QmlApplicationViewer::window怎么用?C++ QmlApplicationViewer::window使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QmlApplicationViewer
的用法示例。
在下文中一共展示了QmlApplicationViewer::window方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
// Localization: Loads the application translation depending on the mobile language.
QTranslator translator;
QString locale = QLocale::system().name();
translator.load("qml_" + locale, ":/qml/i18n/");
app.installTranslator(&translator);
UserAgentProvider p;
QString userAgent = p.getUserAgent();
NetworkAccessManagerFactory factory(userAgent);
QmlApplicationViewer viewer;
viewer.engine()->setNetworkAccessManagerFactory(&factory);
viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
viewer.setSource(QUrl("qrc:///qml/main.qml"));
// Performance operations
viewer.setAttribute(Qt::WA_OpaquePaintEvent);
viewer.setAttribute(Qt::WA_NoSystemBackground);
viewer.viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
viewer.viewport()->setAttribute(Qt::WA_NoSystemBackground);
viewer.window()->showFullScreen();
viewer.engine()->networkAccessManager()->cache()->clear();
return app.exec();
}