本文整理汇总了C++中QQuickView::show方法的典型用法代码示例。如果您正苦于以下问题:C++ QQuickView::show方法的具体用法?C++ QQuickView::show怎么用?C++ QQuickView::show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QQuickView
的用法示例。
在下文中一共展示了QQuickView::show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQuickView viewer;
// The following are needed to make examples run without having to install the module
// in desktop environments.
#ifdef Q_OS_WIN
QString extraImportPath(QStringLiteral("%1/../../../../%2"));
#else
QString extraImportPath(QStringLiteral("%1/../../../%2"));
#endif
viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(),
QString::fromLatin1("qml")));
viewer.setSource(QUrl("qrc:/main.qml"));
viewer.setTitle(QStringLiteral("Interaction"));
viewer.setResizeMode(QQuickView::SizeRootObjectToView);
viewer.setColor("#fafafa");
viewer.show();
return app.exec();
}
示例2: main
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
#ifdef Q_OS_WIN
// Force usage of OpenGL ES through ANGLE on Windows
QCoreApplication::setAttribute(Qt::AA_UseOpenGLES);
#endif
// Register the map view for QML
qmlRegisterType<MapQuickView>("Esri.Samples", 1, 0, "MapView");
qmlRegisterType<SetInitialMapArea>("Esri.Samples", 1, 0, "SetInitialMapAreaSample");
// Intialize application view
QQuickView view;
view.setResizeMode(QQuickView::SizeRootObjectToView);
// Add the import Path
view.engine()->addImportPath(QDir(QCoreApplication::applicationDirPath()).filePath("qml"));
// Set the source
view.setSource(QUrl("qrc:/Samples/Maps/SetInitialMapArea/SetInitialMapArea.qml"));
view.show();
return app.exec();
}
示例3: main
int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
// qmlRegisterType<TraceView>("SysViz", 1, 0, "TraceView");
qmlRegisterType<ThreadSliceView>("SysViz", 1, 0, "ThreadSliceView");
qmlRegisterType<GraphItem> ("SysViz", 1, 0, "GraphItem");
qmlRegisterType<TraceModel>();
qmlRegisterType<QAbstractListModel>();
qmlRegisterType<CpuFrequencyModel>();
qmlRegisterType<GpuFrequencyModel>();
TraceModel model;
QQuickView view;
QSurfaceFormat format = view.requestedFormat();
format.setSamples(16);
view.setFormat(format);
view.rootContext()->setContextProperty("traceModel", &model);
view.rootContext()->setContextProperty("cm", view.screen()->physicalDotsPerInch() / 2.54);
view.setResizeMode(QQuickView::SizeRootObjectToView);
view.setSource(QUrl::fromLocalFile("qml/main.qml"));
view.setTitle("sysviz");
view.show();
#ifdef QT_DQML_LIB
DQmlLocalServer server(view.engine(), &view, "qml/main.qml");
server.fileTracker()->track("qml", "qml");
#endif
app.exec();
}
示例4: main
int main(int argc, char *argv[])
{
// SailfishApp::main() will display "qml/template.qml", if you need more
// control over initialization, you can use:
//
// - SailfishApp::application(int, char *[]) to get the QGuiApplication *
// - SailfishApp::createView() to get a new QQuickView * instance
// - SailfishApp::pathTo(QString) to get a QUrl to a resource file
//
// To display the view, call "show()" (will show fullscreen on device).
qRegisterMetaType<QList<FileInfoEntry*> >();
QGuiApplication *app = SailfishApp::application(argc, argv);
QQuickView *view = SailfishApp::createView();
// Add image providers and C++ classes
view->engine()->addImageProvider(QLatin1String("thumbnail"), new ThumbnailProvider);
FileEngine fileEngine;
view->engine()->rootContext()->setContextProperty("engine", &fileEngine);
view->engine()->rootContext()->setContextProperty("fileList", fileEngine.fileList);
view->engine()->rootContext()->setContextProperty("fileInfo", fileEngine.fileInfo);
view->engine()->rootContext()->setContextProperty("fileProcess", fileEngine.fileProcess);
view->engine()->rootContext()->setContextProperty("clipboard", fileEngine.clipboard);
view->engine()->rootContext()->setContextProperty("settings", fileEngine.settings);
view->engine()->rootContext()->setContextProperty("coverModel", fileEngine.coverModel);
// Show the application
view->setSource(SailfishApp::pathTo("qml/Filetug.qml"));
view->show();
return app->exec();
}
示例5: main
int main(int argc, char *argv[])
{
// Qt Charts uses Qt Graphics View Framework for drawing, therefore QApplication must be used.
QApplication app(argc, argv);
QQuickView viewer;
// The following are needed to make examples run without having to install the module
// in desktop environments.
#ifdef Q_OS_WIN
QString extraImportPath(QStringLiteral("%1/../../../../%2"));
#else
QString extraImportPath(QStringLiteral("%1/../../../%2"));
#endif
viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(),
QString::fromLatin1("qml")));
QObject::connect(viewer.engine(), &QQmlEngine::quit, &viewer, &QWindow::close);
QString appKey;
if (argc > 1) {
appKey = argv[1];
qDebug() << "App key for worldweatheronline.com:" << appKey;
} else {
qWarning() << "No app key for worldweatheronline.com given. Using static test data instead of live data.";
}
viewer.setTitle(QStringLiteral("QML Weather"));
viewer.rootContext()->setContextProperty("weatherAppKey", appKey);
viewer.setSource(QUrl("qrc:/qml/qmlweather/main.qml"));
viewer.setResizeMode(QQuickView::SizeRootObjectToView);
viewer.show();
return app.exec();
}
示例6: main
int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
FileTest *fileTest = new FileTest();
fileTest->writeFilesToDisk();
fileTest->readFilesFromDisk();
NetworkTest *networkTest = new NetworkTest();
networkTest->TestHttp();
networkTest->TestHttps();
QQuickView view;
GpsClient *gpsClient = new GpsClient(&view);
view.engine()->rootContext()->setContextProperty(QLatin1String("gpsClient"),
gpsClient);
NotificationClient *notificationClient = new NotificationClient(&view);
view.engine()->rootContext()->setContextProperty(QLatin1String("notificationClient"),
notificationClient);
view.setResizeMode(QQuickView::SizeRootObjectToView);
view.setSource(QUrl(QStringLiteral("qrc:/qml/main.qml")));
view.show();
return app.exec();
}
示例7: main
int main(int argc, char *argv[])
{
//start appliacation
QGuiApplication a(argc, argv);
//settings
CQmlSettings settings(QCoreApplication::applicationDirPath() + "/qmlConfigure.xml");
if(settings.errorMap.count() > 0)
exit(0);
DVRSettings dvrSetting;
dvrSetting.IP = settings.node("IP");
dvrSetting.server_port = settings.node("serverPort").toInt();
//事物层对象初始化
CTransaction transaction;
//初始化clientThread
ClientThread receiveDataThread(&transaction, dvrSetting);
receiveDataThread.start();
QQuickView view;
view.rootContext()->setContextProperty("transaction", &transaction);
view.rootContext()->setContextProperty("settings", &settings);
view.rootContext()->setContextProperty("mainWindow", &view);
view.setSource(QUrl("qrc:/robo/qml/hitRobotGroup/MainPage.qml"));
view.show();
return a.exec();
}
示例8: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QQuickView viewer;
viewer.setResizeMode(QQuickView::SizeRootObjectToView);
QObjectList model_qobjectlist;
model_qobjectlist << new TestObject(0);
model_qobjectlist << new TestObject(1);
model_qobjectlist << new TestObject(2);
viewer.rootContext()->setContextProperty("model_qobjectlist", QVariant::fromValue(model_qobjectlist));
TestObject *model_qobject = new TestObject(0);
viewer.rootContext()->setContextProperty("model_qobject", QVariant::fromValue(model_qobject));
QStringList model_qstringlist;
model_qstringlist << QStringLiteral("A");
model_qstringlist << QStringLiteral("B");
model_qstringlist << QStringLiteral("C");
viewer.rootContext()->setContextProperty("model_qstringlist", model_qstringlist);
TestModel *model_qaim = new TestModel;
viewer.rootContext()->setContextProperty("model_qaim", model_qaim);
viewer.setSource(QStringLiteral("qrc:/qml/main.qml"));
viewer.show();
return app.exec();
}
示例9: main
//=====================================================================================================================
int main(int argc, char* argv[])
//=====================================================================================================================
{
QGuiApplication app(argc, argv);
QQuickView viewer;
//QString extraImportPath(QStringLiteral("%1/../../../%2"));
//viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(), QString::fromLatin1("qml")));
// set path to find the plugin
QString extraImportPath(QStringLiteral("%1/../pluginlib"));
QString path = extraImportPath.arg(QGuiApplication::applicationDirPath());
viewer.engine()->addImportPath(path);
// create list of my custom objects
Wrapper wrapper;
// and set the list as model
QQmlContext *ctxt = viewer.rootContext();
ctxt->setContextProperty("wrapper", &wrapper);
// set up connection
QObject::connect(viewer.engine(), &QQmlEngine::quit, &viewer, &QWindow::close);
viewer.setTitle(QStringLiteral("Custom Plugin Demo"));
viewer.setResizeMode(QQuickView::SizeRootObjectToView);
viewer.setSource(QUrl("qrc:/qml/view.qml"));
viewer.show();
return QGuiApplication::exec();
}
示例10: main
int main(int argc, char *argv[]) {
QGuiApplication* app = SailfishApp::application(argc, argv);
QQuickView* view = SailfishApp::createView();
Configurator config;
config.load();
//qmlRegisterType<Request>("Sailbook.Request", 1, 0, "Request");
qmlRegisterUncreatableType<Request>("App.Sailbook", 1, 0, "Request", QStringLiteral("Error"));
//qmlRegisterInterface<SessionManager>("SessionManager");
SessionManager session(QStringLiteral(APPID), config.getValue(QStringLiteral("token")).toString());
session.setExtendedPermission(SessionManager::ExtendedPermissions(
SessionManager::Email |
SessionManager::ManageNotifications |
SessionManager::ManagePages |
SessionManager::PublishActions |
SessionManager::ReadFriendList |
SessionManager::ReadInsights |
SessionManager::ReadMailbox |
SessionManager::ReadPageMailboxes |
SessionManager::ReadStream |
SessionManager::RsvpEvent
));
session.setUserDataPermission(SessionManager::UserDataPermissions(
SessionManager::UserAboutMe |
SessionManager::UserActionsBooks |
SessionManager::UserActionsMusic |
SessionManager::UserActionsNews |
SessionManager::UserActionsVideo |
SessionManager::UserActivities |
SessionManager::UserBirthday |
SessionManager::UserEducationHistory |
SessionManager::UserEvents |
SessionManager::UserFriends |
SessionManager::UserGamesActivity |
SessionManager::UserGroups |
SessionManager::UserHometown |
SessionManager::UserInterests |
SessionManager::UserLikes |
SessionManager::UserLocation |
SessionManager::UserPhotos |
SessionManager::UserRelationshipDetails |
SessionManager::UserRelationships |
SessionManager::UserReligionPolitics |
SessionManager::UserStatus |
SessionManager::UserTaggedPlaces |
SessionManager::UserVideos |
SessionManager::UserWebsite |
SessionManager::UserWorkHistory
));
view->rootContext()->setContextProperty("SessionManager", &session);
view->rootContext()->setContextProperty("Configurator", &config);
view->setSource(SailfishApp::pathTo("qml/sailbook.qml"));
view->show();
return app->exec();
}
示例11: testProperties
void tst_QQuickGraphicsInfo::testProperties()
{
QQuickView view;
view.setSource(QUrl("data/basic.qml"));
view.show();
QVERIFY(QTest::qWaitForWindowExposed(&view));
QSignalSpy spy(&view, SIGNAL(sceneGraphInitialized()));
spy.wait();
QObject* obj = view.rootObject();
QVERIFY(obj);
QSGRendererInterface *rif = view.rendererInterface();
const int expectedAPI = rif ? rif->graphicsApi() : QSGRendererInterface::Unknown;
QCOMPARE(obj->property("api").toInt(), expectedAPI);
#if QT_CONFIG(opengl)
if (expectedAPI == QSGRendererInterface::OpenGL) {
QCOMPARE(obj->property("shaderType").toInt(), int(QSGRendererInterface::GLSL));
QVERIFY(view.openglContext());
QSurfaceFormat format = view.openglContext()->format();
QCOMPARE(obj->property("majorVersion").toInt(), format.majorVersion());
QCOMPARE(obj->property("minorVersion").toInt(), format.minorVersion());
QCOMPARE(obj->property("profile").toInt(), static_cast<int>(format.profile()));
QCOMPARE(obj->property("renderableType").toInt(), static_cast<int>(format.renderableType()));
}
#endif
}
示例12: main
int main(int argc, char *argv[])
{
// SailfishApp::main() will display "qml/template.qml", if you need more
// control over initialization, you can use:
//
// - SailfishApp::application(int, char *[]) to get the QGuiApplication *
// - SailfishApp::createView() to get a new QQuickView * instance
// - SailfishApp::pathTo(QString) to get a QUrl to a resource file
//
// To display the view, call "show()" (will show fullscreen on device).
QGuiApplication *app = SailfishApp::application(argc, argv);
QTranslator translator;
translator.load(QLocale::system(), "ownNotes", "_", SailfishApp::pathTo("i18n").toLocalFile(), ".qm");
app->installTranslator(&translator);
QPython::registerQML();
qmlRegisterType<DocumentHandler>("net.khertan.documenthandler", 1, 0, "DocumentHandler");
QQuickView *view = SailfishApp::createView();
view->setSource(SailfishApp::pathTo("qml/ownNotes.qml"));
view->engine()->rootContext()->setContextProperty("VERSION", VERSION);
view->show();
return app->exec();
}
示例13: main
int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
qmlRegisterType<FileReader>("org.qtproject.testapi", 1, 0, "FileReader");
QQuickView view;
app.setOrganizationName("Acomb Methodist Church");
app.setOrganizationDomain("amc.com");
app.setApplicationName("Church Calendar");
#ifdef Q_OS_ANDROID
NotificationClient *notificationClient = new NotificationClient(&view);
view.engine()->rootContext()->setContextProperty(QLatin1String("notificationClient"),
notificationClient);
#endif
FileReader *fileReader = new FileReader(&view);
view.engine()->rootContext()->setContextProperty(QLatin1String("fileReader"),
fileReader);
view.engine()->addImportPath("/usr/share/qml/");
view.setResizeMode(QQuickView::SizeRootObjectToView);
view.setSource(QUrl(QStringLiteral("qrc:/Views/Main.qml")));
view.show();
return app.exec();
}
示例14: main
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
#ifdef Q_OS_WIN
// Force usage of OpenGL ES through ANGLE on Windows
QCoreApplication::setAttribute(Qt::AA_UseOpenGLES);
#endif
// Register the map view for QML
qmlRegisterType<MapQuickView>("Esri.Samples", 1, 0, "MapView");
qmlRegisterUncreatableType<ArcGISSublayerListModel>("Esri.Samples", 1, 0, "ArcGISSublayerListModel", "ArcGISSublayerListModel is an uncreatable type");
qmlRegisterType<ChangeSublayerVisibility>("Esri.Samples", 1, 0, "ChangeSublayerVisibilitySample");
// Intialize application view
QQuickView view;
view.setResizeMode(QQuickView::SizeRootObjectToView);
// Add the import Path
view.engine()->addImportPath(QDir(QCoreApplication::applicationDirPath()).filePath("qml"));
// Set the source
view.setSource(QUrl("qrc:/Samples/Layers/ChangeSublayerVisibility/ChangeSublayerVisibility.qml"));
view.show();
return app.exec();
}
示例15: main
int main(int argc, char* argv[])
{
QGuiApplication app(argc,argv);
qmlRegisterType<Connector>("Connector", 1, 0, "Connector");
app.setOrganizationName("QtProject");\
app.setOrganizationDomain("qt-project.org");\
app.setApplicationName(QFileInfo(app.applicationFilePath()).baseName());\
QQuickView view;\
if (qgetenv("QT_QUICK_CORE_PROFILE").toInt()) {\
QSurfaceFormat f = view.format();\
f.setProfile(QSurfaceFormat::CoreProfile);\
f.setVersion(4, 4);\
view.setFormat(f);\
}\
view.connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit()));\
new QQmlFileSelector(view.engine(), &view);\
view.setSource(QUrl("qrc:///demos/tweetsearch/tweetsearch.qml")); \
view.setResizeMode(QQuickView::SizeRootObjectToView);\
if (QGuiApplication::platformName() == QLatin1String("qnx") || \
QGuiApplication::platformName() == QLatin1String("eglfs")) {\
view.showFullScreen();\
} else {\
view.show();\
}\
return app.exec();\
}