当前位置: 首页>>代码示例>>C++>>正文


C++ QmlApplicationViewer::addImportPath方法代码示例

本文整理汇总了C++中QmlApplicationViewer::addImportPath方法的典型用法代码示例。如果您正苦于以下问题:C++ QmlApplicationViewer::addImportPath方法的具体用法?C++ QmlApplicationViewer::addImportPath怎么用?C++ QmlApplicationViewer::addImportPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QmlApplicationViewer的用法示例。


在下文中一共展示了QmlApplicationViewer::addImportPath方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

Q_DECL_EXPORT int main(int argc, char *argv[])
{
    QScopedPointer<QApplication> app(createApplication(argc, argv));

    QmlApplicationViewer viewer;
    viewer.addImportPath(QLatin1String("modules"));
    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
    viewer.setMainQmlFile(QLatin1String("qml/example/main.qml"));
    viewer.showExpanded();

    return app->exec();
}
开发者ID:jhofstee,项目名称:qt-example,代码行数:12,代码来源:main.cpp

示例2: main

Q_DECL_EXPORT int main(int argc, char *argv[])
{
    QScopedPointer<QApplication> app(createApplication(argc, argv));

    QmlApplicationViewer viewer;
    viewer.addImportPath(QLatin1String("modules"));
    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
    viewer.setMainQmlFile(QLatin1String("../../KANR/qml/KANR/main.qml"));
    viewer.showExpanded();

    Manager manager(new Sinus(), viewer.rootObject());

    return app->exec();
}
开发者ID:rasmadeus,项目名称:KANR,代码行数:14,代码来源:main.cpp

示例3: main

int main(int argc, char *argv[]) {
    QScopedPointer<QApplication> app(createApplication(argc, argv));

    qmlRegisterType<TileData>();
    Core* game = new Core;
    QmlApplicationViewer viewer;
    viewer.engine()->rootContext()->setContextObject(game);
    viewer.engine()->rootContext()->setContextProperty("core", game);
    viewer.addImportPath(QLatin1String("modules")); // ADDIMPORTPATH
    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait); // ORIENTATION
    viewer.setMainQmlFile(QLatin1String("qml/main.qml")); // MAINQML
    viewer.showExpanded();

    return app->exec();
}
开发者ID:Kernald,项目名称:minesweeper,代码行数:15,代码来源:main.cpp

示例4: main

Q_DECL_EXPORT int main(int argc, char *argv[])
{
    QScopedPointer<QApplication> app(createApplication(argc, argv));

    QmlApplicationViewer viewer;
    viewer.addImportPath(QLatin1String("imports"));
    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait);
#ifdef Q_OS_BLACKBERRY
    Scoreloop scoreloop;
    viewer.rootContext()->setContextProperty("scoreloop", &scoreloop);
#endif
    viewer.setSource(QUrl("qrc:/qml/game/main.qml"));
    viewer.showExpanded();

    return app->exec();
}
开发者ID:Bomb3rman,项目名称:BBJamQt312,代码行数:16,代码来源:main.cpp

示例5: main

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    bool use_qml;
#ifdef USE_QML
    use_qml = true;
#else 
    use_qml = false;
#endif

    QStringList options = app.arguments();
    if (options.contains("--use-qml"))
        use_qml = true;
    if (options.contains("--dont-use-qml"))
        use_qml = false;

    if (use_qml) {
        qRegisterMetaType<DNSSECTest>("DNSSECTest");
        qmlRegisterType<DNSSECTest, 1>("DNSSECTools", 1, 0, "DNSSECTest");
        qmlRegisterType<TestManager, 1>("DNSSECTools", 1, 0, "TestManager");

        QmlApplicationViewer viewer;
        QDeclarativeContext *context;
        viewer.addImportPath(":/qml");
        viewer.setWindowIcon(QIcon(":/images/dnssec-check-64x64.png"));
        viewer.setWindowTitle("DNSSEC-Check");

        TestManager manager;
        context = viewer.rootContext();
        context->setContextProperty("testManager", &manager);

        #ifdef IS_MEEGO
        viewer.setSource(QUrl("qrc:/qml/MeegoDnssecCheck.qml"));
        #else
        viewer.setSource(QUrl("qrc:/qml/DnssecCheck.qml"));
        #endif


        viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape);
        #ifdef IS_MEEGO
        viewer.showFullScreen();
        #else
        viewer.show();
        #endif

        return app.exec();
    } else { // don't use QML
        MainWindow mainWindow;
        mainWindow.setOrientation(MainWindow::Auto);

        #ifdef Q_OS_SYMBIAN
        mainWindow.showFullScreen();
        #elif defined(Q_WS_MAEMO_5)
        mainWindow.showMaximized();
        #else
        mainWindow.show();
        #endif

        return app.exec();
    }
}
开发者ID:mcr,项目名称:dnssec-tools,代码行数:62,代码来源:main.cpp

示例6: main

int main( int argc, char** argv )
{
    // init application
#if defined( QML_UI )
    QScopedPointer<QApplication> app( createApplication( argc, argv ) );
#else
    QScopedPointer<QApplication> app( new QApplication( argc, argv ) );
#endif
    app->setApplicationName( "Housing" );
    app->setApplicationVersion( "1.0.0" );
    app->setOrganizationDomain( "sodream.org" );
    app->setOrganizationName( "SoDream" );
	
#if !( defined( Q_OS_UNIX ) && !defined( Q_OS_MAC ) ) || defined( Q_OS_BLACKBERRY )
	const QStringList themesPaths = QIcon::themeSearchPaths()
#if defined( Q_OS_MACX )
        << QString( "%1/../../../Resources" ).arg( QApplication::applicationDirPath() )
#elif defined( Q_OS_BLACKBERRY )
        << QApplication::applicationDirPath()
#else
        << QApplication::applicationDirPath()
#endif
	;
	
	QIcon::setThemeSearchPaths( themesPaths );
	QIcon::setThemeName( "Oxygen" );
#endif
	
    app->setWindowIcon( QIcon::fromTheme( "go-home" ) );
    
    const QStringList paths = QStringList()
        << QLibraryInfo::location( QLibraryInfo::TranslationsPath )
        << QFileInfo( __FILE__ ).absolutePath().append( "/../translations" )
#if defined( Q_OS_MACX )
        << QString( "%1/../../../translations" ).arg( QApplication::applicationDirPath() )
#else
        << QString( "%1/translations" ).arg( QApplication::applicationDirPath() )
#endif
    ;
    
    pTranslationManager* translationManager = pTranslationManager::instance();
    translationManager->setFakeCLocaleEnabled( true );
	translationManager->addTranslationsMask( "qt*.qm" );
	translationManager->addTranslationsMask( "fresh*.qm" );
	translationManager->addTranslationsMask( "housing*.qm" );
	translationManager->addForbiddenTranslationsMask( "qt_help*.qm" );
	translationManager->setCurrentLocale( QLocale::system().name() );
    translationManager->setTranslationsPaths( paths );
    translationManager->reloadTranslations();
    
    // register drivers
    AbstractHousingDriver::registerDriver( new SeLogerHousingDriver );

    // init main window
#if defined( DESKTOP_UI ) || defined( MOBILE_UI )
    UIMain w;
    w.setWindowTitle( app->applicationName() );
    w.showMaximized();
#elif defined( QML_UI )
    QmlApplicationViewer viewer;
    viewer.addImportPath(fixedPath("modules")); // ADDIMPORTPATH
    viewer.addImportPath("/opt/Qt4.8.4/imports"); // ADDIMPORTPATH
    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); // ORIENTATION
    viewer.setMainQmlFile(fixedPath("qml/main.qml")); // MAINQML
    viewer.showExpanded();
#endif

    // run application
    QObject::connect( app.data(), SIGNAL( lastWindowClosed() ), app.data(), SLOT( quit() ) );
    return app->exec();
}
开发者ID:Bigorneau,项目名称:housing,代码行数:71,代码来源:main.cpp

示例7: main

Q_DECL_EXPORT int main(int argc, char *argv[])
{
    QApplication *app = createApplication(argc, argv);
    QmlApplicationViewer viewer;

#if defined(Q_OS_MAEMO)
    QPixmap pixmap("/opt/nelisquare/qml/pics/splash-turned.png");
    QSplashScreen splash(pixmap);
    EventDisabler eventDisabler;
    splash.installEventFilter(&eventDisabler);
    splash.showFullScreen();
#endif

#if defined(Q_OS_MAEMO)
    viewer.addImportPath(QString("/opt/qtm12/imports"));
    viewer.engine()->addImportPath(QString("/opt/qtm12/imports"));
    viewer.engine()->addPluginPath(QString("/opt/qtm12/plugins"));
#endif

    QCoreApplication::addLibraryPath(QString("/opt/nelisquare/plugins"));

    viewer.setAttribute(Qt::WA_OpaquePaintEvent);
    viewer.setAttribute(Qt::WA_NoSystemBackground);
    viewer.viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
    viewer.viewport()->setAttribute(Qt::WA_NoSystemBackground);

    WindowHelper *windowHelper = new WindowHelper(&viewer);
    PictureHelper *pictureHelper = new PictureHelper();
    Cache *cache = new Cache();
    viewer.rootContext()->setContextProperty("windowHelper", windowHelper);
    viewer.rootContext()->setContextProperty("pictureHelper", pictureHelper);
    viewer.rootContext()->setContextProperty("cache", cache);

    Molome *molome = new Molome();
    viewer.rootContext()->setContextProperty("molome", molome);

#if defined(Q_OS_HARMATTAN) || defined(Q_WS_SIMULATOR) || defined(Q_OS_MAEMO)
    PlatformUtils platformUtils(app,cache);
    viewer.rootContext()->setContextProperty("platformUtils", &platformUtils);
#endif

#if defined(Q_OS_MAEMO)
    viewer.installEventFilter(windowHelper);
#elif defined(Q_OS_HARMATTAN)
    viewer.installEventFilter(new EventFilter);
#endif

    viewer.setMainQmlFile(QLatin1String("qml/main.qml"));

    QObject *rootObject = qobject_cast<QObject*>(viewer.rootObject());
#if defined(Q_OS_HARMATTAN) || defined(Q_OS_MAEMO)
    new NelisquareDbus(app, &viewer);
#endif

#if defined(Q_OS_MAEMO)
    viewer.showFullScreen();
#elif defined(Q_OS_HARMATTAN)
    rootObject->connect(molome,SIGNAL(infoUpdated(QVariant,QVariant)),SLOT(onMolomeInfoUpdate(QVariant,QVariant)));
    rootObject->connect(molome,SIGNAL(photoRecieved(QVariant,QVariant)),SLOT(onMolomePhoto(QVariant,QVariant)));
    viewer.showExpanded();
    molome->updateinfo();
#else
    viewer.showExpanded();
#endif
    rootObject->connect(pictureHelper,SIGNAL(pictureUploaded(QVariant, QVariant)),SLOT(onPictureUploaded(QVariant, QVariant)));

#if defined(Q_OS_MAEMO)
    splash.finish(&viewer);
#endif

    return app->exec();
}
开发者ID:Andrer757,项目名称:nelisquare,代码行数:72,代码来源:main.cpp


注:本文中的QmlApplicationViewer::addImportPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。