本文整理汇总了C++中QQuickView类的典型用法代码示例。如果您正苦于以下问题:C++ QQuickView类的具体用法?C++ QQuickView怎么用?C++ QQuickView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QQuickView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
/*------------------------------------------------------------------------------
| main
+-----------------------------------------------------------------------------*/
int main(int argc, char* argv[])
{
QApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
QApplication a(argc, argv);
QStringList args = a.arguments();
const bool opengl = !args.contains("--no-opengl");
args.removeAll("--no-opengl");
if (opengl) {
qDebug("QML QtWebEngine...");
QQuickView* view = new QQuickView;
view->setSource(QUrl("qrc:/poc_main.qml"));
view->showFullScreen();
QObject* o = view->rootObject()->findChild<QObject*>("webEngineView");
o->setProperty("url", args.at(1));
}
else {
qDebug("Widget QtWebEngine...");
QWebEngineView* view = new QWebEngineView;
view->load(QUrl(args.at(1)));
view->show();
}
return a.exec();
}
示例2: 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).
QCoreApplication::setOrganizationName("org");
QCoreApplication::setOrganizationDomain("Sparkeyy");
QCoreApplication::setApplicationName("harbour-spritradar");
qmlRegisterType<Settings>("harbour.spritradar.Settings", 1,0, "Settings");
QGuiApplication* app = SailfishApp::application(argc, argv);
QQuickView* view = SailfishApp::createView();
QObject::connect(view->engine(), SIGNAL(quit()), app, SLOT(quit()));
view->rootContext()->setContextProperty("tankerkoenig_apikey", TANKERKOENIG_APIKEY); //Claim here: https://creativecommons.tankerkoenig.de/#register
// has to be set as additional qmake argument to the project configuration (armv7hl, i486 and debug/release for both), like this: "TANKERKOENIG_APIKEY=<your_apikey>"
view->setSource(SailfishApp::pathTo("qml/harbour-spritradar.qml"));
view->show();
return app->exec();
}
示例3: 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();
}
示例4: QMainWindow
MsmWindow::MsmWindow(QWidget *parent) :
QMainWindow(parent)
{
// Prepare the view area
stackedWidget = new QStackedWidget(this);
setCentralWidget(stackedWidget);
QQuickView *view = new QQuickView();
menuView = QWidget::createWindowContainer(view, this);
menuView->setFocusPolicy(Qt::TabFocus);
view->setSource(QUrl("qrc:/qml/main.qml"));
stackedWidget->addWidget(menuView);
stackedWidget->setCurrentWidget(menuView);
moduleView = new ModuleView();
stackedWidget->addWidget(moduleView);
QQuickItem *rootObject = view->rootObject();
QQuickItem::connect(rootObject, SIGNAL(itemClicked(QString)),
this, SLOT(loadModule(QString)));
ModuleView::connect(moduleView, &ModuleView::closeRequest,
[=]() {
moduleView->resolveChanges();
moduleView->closeModules();
stackedWidget->setCurrentWidget(menuView);
});
init();
readPositionSettings();
}
示例5: 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();
}
示例6: 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();
}
示例7: 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();
}
示例8: main
int main(int argc, char** argv)
{
QCoreApplication::setOrganizationName("com.ubuntu.developer.mzanetti.kodimote");
QCoreApplication::setApplicationName("kodimote");
QGuiApplication application(argc, argv);
// Load language file
QString language = QLocale::system().bcp47Name();
qDebug() << "got language:" << language;
QTranslator qtTranslator;
if(!qtTranslator.load("qt_" + language, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) {
qDebug() << "couldn't load qt_" + language;
}
application.installTranslator(&qtTranslator);
QTranslator translator;
if (!translator.load(":/kodimote_" + language + ".qm")) {
qDebug() << "Cannot load translation file" << "kodimote_" + language + ".pm";
}
application.installTranslator(&translator);
Kodi::instance()->setDataPath(QDir::homePath() + "/.cache/com.ubuntu.developer.mzanetti.kodimote/");
Kodi::instance()->eventClient()->setApplicationThumbnail("kodimote80.png");
QQuickView *view = new QQuickView();
Settings settings;
UbuntuHelper helper(view, &settings);
ProtocolManager protocols;
MprisController controller(&protocols, &helper);
Q_UNUSED(controller)
view->setResizeMode(QQuickView::SizeRootObjectToView);
view->engine()->setNetworkAccessManagerFactory(new NetworkAccessManagerFactory());
view->setTitle("Kodimote");
view->engine()->rootContext()->setContextProperty("kodi", Kodi::instance());
view->engine()->rootContext()->setContextProperty("settings", &settings);
view->engine()->rootContext()->setContextProperty("protocolManager", &protocols);
view->setSource(QUrl("qrc:///qml/main.qml"));
if(QGuiApplication::arguments().contains("--fullscreen")) {
view->showFullScreen();
} else {
// view->resize(QSize(720, 1280));
view->show();
}
return application.exec();
}
示例9: main
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
if (!QResource::registerResource("qmc_res3.rcc") ||
!QResource::registerResource("qmc_res5.rcc"))
{
qDebug() << "Could not register resources.";
return 1;
}
QQuickView view;
view.setResizeMode(QQuickView::SizeRootObjectToView);
QQmlEngine *engine = view.engine();
QmcLoader loader(engine);
QQmlComponent *component = loader.loadComponent("qrc:/app.qmc");
if (!component) {
qDebug() << "Could not load component";
return -1;
}
if (!component->isReady()) {
qDebug() << "Component is not ready";
if (component->isError()) {
foreach (const QQmlError &error, component->errors()) {
qDebug() << error.toString();
}
}
示例10: main
int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
qmlRegisterType<QVTKFrameBufferObjectItem>("VtkQuick", 1, 0, "VtkRenderWindow");
QQuickView view;
view.setSource(QUrl("qrc:///main.qml"));
QList<QVTKFrameBufferObjectItem*> vtkItems = view.rootObject()->findChildren<QVTKFrameBufferObjectItem*>();
// For demonstration: Add a cone to the scene of each QVTKFrameBufferObjectItem
Q_FOREACH(QVTKFrameBufferObjectItem *vtkItem, vtkItems)
{
vtkGenericOpenGLRenderWindow *r_win = vtkItem->GetRenderWindow();
vtkSmartPointer<vtkConeSource> cone = vtkSmartPointer<vtkConeSource>::New();
//cone->SetHeight(3.0);
//cone->SetRadius(1.0);
cone->SetResolution(100);
vtkSmartPointer<vtkPolyDataMapper> coneMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
coneMapper->SetInputConnection(cone->GetOutputPort());
vtkSmartPointer<vtkActor> coneActor = vtkSmartPointer<vtkActor>::New();
coneActor->SetMapper(coneMapper);
vtkSmartPointer<vtkRenderer> ren1 = vtkSmartPointer<vtkRenderer>::New();
ren1->AddActor(coneActor);
r_win->AddRenderer(ren1);
}
示例11: 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();
}
示例12: main
int main(int argc, char **argv)
{
QGuiApplication *app = SailfishApp::application(argc, argv);
qmlRegisterType<Mainview>("harbour.monav", 1, 0, "Mainview");
qmlRegisterType<TapMenu>("harbour.monav", 1, 0, "TapMenu");
qmlRegisterType<MapPackages>("harbour.monav", 1, 0, "MapPackages");
qmlRegisterType<Bookmarks>("harbour.monav", 1, 0, "Bookmarks");
qmlRegisterType<PaintWidget>("harbour.monav", 1, 0, "PaintWidget");
qmlRegisterType<WorldMapChooser>("harbour.monav", 1, 0, "WorldMapChooser");
QQuickView *view = SailfishApp::createView();
view->setSource(SailfishApp::pathTo("qml/Main.qml"));
view->show();
view->setResizeMode(QQuickView::SizeRootObjectToView);
QObject *object = (QObject *) view->rootObject();
Mainview *mainview = object->findChild<Mainview *>("mainview");
mainview->init();
app->connect( app, SIGNAL(aboutToQuit()), MapData::instance(), SLOT(cleanup()) );
app->connect( app, SIGNAL(aboutToQuit()), RoutingLogic::instance(), SLOT(cleanup()) );
app->connect( app, SIGNAL(aboutToQuit()), Logger::instance(), SLOT(cleanup()) );
app->connect( app, SIGNAL(aboutToQuit()), mainview, SLOT(cleanup()) );
return app->exec();
}
示例13: createView
void tst_qquickpointdirection::test_basic()
{
QQuickView* view = createView(testFileUrl("basic.qml"), 600);
QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system");
ensureAnimTime(600, system->m_animation);
QVERIFY(extremelyFuzzyCompare(system->groupData[0]->size(), 500, 10));
for (QQuickParticleData *d : qAsConst(system->groupData[0]->data)) {
if (d->t == -1)
continue; //Particle data unused
QCOMPARE(d->x, 0.f);
QCOMPARE(d->y, 0.f);
QCOMPARE(d->vx, 100.f);
QCOMPARE(d->vy, 100.f);
QVERIFY(d->ax >= 0.f);
QVERIFY(d->ax <= 200.f);
QVERIFY(d->ay >= 0.f);
QVERIFY(d->ay <= 200.f);
QCOMPARE(d->lifeSpan, 0.5f);
QCOMPARE(d->size, 32.f);
QCOMPARE(d->endSize, 32.f);
QVERIFY(myFuzzyLEQ(d->t, ((qreal)system->timeInt/1000.0)));
}
delete view;
}
示例14: main
//![0]
int main(int argc, char ** argv)
{
QGuiApplication app(argc, argv);
QList<QObject*> dataList;
dataList.append(new DataObject("Item 1", "red"));
dataList.append(new DataObject("Item 2", "green"));
dataList.append(new DataObject("Item 3", "blue"));
dataList.append(new DataObject("Item 4", "yellow"));
QQuickView view;
view.setResizeMode(QQuickView::SizeRootObjectToView);
QQmlContext *ctxt = view.rootContext();
//![0]
#if 1
// add precompiled files
QQmlEngine *engine = view.engine();
QQmlEnginePrivate::get(engine)->v4engine()->iselFactory.reset(new QV4::JIT::ISelFactory);
QmcLoader loader(engine);
QQmlComponent *component = loader.loadComponent(":/view.qmc");
if (!component) {
qDebug() << "Could not load component";
return -1;
}
if (!component->isReady()) {
qDebug() << "Component is not ready";
if (component->isError()) {
foreach (const QQmlError &error, component->errors()) {
qDebug() << error.toString();
}
}
示例15: qWarning
bool MascaraInterfaceV1::eventFilter(QObject *obj, QEvent *e)
{
bool ret = QObject::eventFilter(obj, e);
if (ret)
return ret;
if (e->type() == QEvent::Close) {
QQuickView *view = qobject_cast<QQuickView *>(obj);
if (!view) {
qWarning() << "No view!";
return ret;
}
int dialogId = view->property("MascaraWindowId").toInt();
QHash<int, QQuickView *>::iterator it = m_windows.find(dialogId);
if (it == m_windows.end()) {
qWarning() << "Destroyed an unknown dialog " << dialogId;
return ret;
}
m_windows.erase(it);
qDebug() << "Deleting " << view;
view->deleteLater();
if (m_windows.count() == 0) {
m_closeTimer.start();
qDebug() << "Starting close timer";
}
}
return ret;
}