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


C++ QDeclarativeView类代码示例

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


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

示例1: main

Q_DECL_EXPORT int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    InitProduct(argc, argv);
    app.setWindowIcon(QIcon("logo.ico"));
    QDesktopWidget* desktopWidget = QApplication::desktop();
    //获取可用桌面大小
    QRect deskRect =desktopWidget->availableGeometry();
    //获取设备屏幕大小
    //QRect screenRect =desktopWidget->screenGeometry();

    DataFilter dataFilter;
    QDeclarativeView viewer;
    viewer.setWindowFlags(Qt::FramelessWindowHint);
    QDeclarativeEngine *engine=viewer.engine();
    QDeclarativeContext *context=engine->rootContext();
    context->setContextProperty("dataFilter", &dataFilter);
    context->setContextProperty("app", &app);
    context->setContextProperty("main_window", &viewer);
    context->setContextProperty("windowTitle", WindowTitle);
    context->setContextProperty("SMF_Product", SMF_Product);
    context->setContextProperty("WIDTH", deskRect.width());
    context->setContextProperty("HEIGHT", deskRect.height());
    viewer.setSource(QUrl("qml/LotNo/main.qml"));
    viewer.show();
    return app.exec();
}
开发者ID:zhangxj,项目名称:LotNo,代码行数:27,代码来源:main.cpp

示例2: main

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

    QUrl proxyUrl(qgetenv("http_proxy"));
    if (proxyUrl.isValid() && !proxyUrl.host().isEmpty()) {
        int proxyPort = (proxyUrl.port() > 0) ? proxyUrl.port() : 8080;
        QNetworkProxy proxy(QNetworkProxy::HttpProxy, proxyUrl.host(), proxyPort);
        QNetworkProxy::setApplicationProxy(proxy);
    }
    else {
        QNetworkProxyQuery query(QUrl(QLatin1String("http://www.flickr.com")));
        QNetworkProxy proxy = QNetworkProxyFactory::systemProxyForQuery(query).value(0);
        if (proxy.type() != QNetworkProxy::NoProxy)
            QNetworkProxy::setApplicationProxy(proxy);
    }

    QDeclarativeView view;
    view.setSource(QUrl("qrc:/qml/flickr.qml"));

#if defined(FLICKR_FULLSCREEN)
    view.window()->showFullScreen();
#else
    view.window()->show();
#endif

    QObject::connect(view.engine(), SIGNAL(quit()), &view, SLOT(close()));
    return app.exec();
}
开发者ID:9smart,项目名称:QQC_1_1_for_Symbian1,代码行数:29,代码来源:main.cpp

示例3: main

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

      QWidget wi(0);
      PDPI = wi.logicalDpiX();    // physical resolution
      DPI  = PDPI;                // logical drawing resolution
      DPMM = DPI / INCH;          // dots/mm

      runtime = new Runtime;

      MScore::init();
      seq = new Seq;
      if (!seq->init()) {
            printf("cannot initialize sequencer\n");
            exit(-1);
            }

      qmlRegisterType<ScoreView>("MuseScore", 1, 0, "ScoreView");

      QDeclarativeView view;
      view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
      QDeclarativeContext* ctxt = view.rootContext();
      ctxt->setContextProperty(QLatin1String("runtime"), runtime);

      // registering only for exposing the Runtime::Orientation enum
      qmlRegisterUncreatableType<Runtime>("Qt", 4, 7, "Orientation", QString());
      qmlRegisterUncreatableType<Runtime>("QtQuick", 1, 0, "Orientation", QString());

      view.setSource(QUrl("qrc:/mplayer.qml"));
      view.show();
      return app.exec();
      }
开发者ID:Mistobaan,项目名称:MuseScore,代码行数:33,代码来源:main.cpp

示例4: main

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

  QDeclarativeEngine engine;
  QDeclarativeComponent component(&engine, QUrl("qrc:/invoke.qml"));
  QObject *object = component.create();

  QVariant returnedValue;
  QVariant msg = "Hello from C++";
  QMetaObject::invokeMethod(object, "myQmlFunction",
                            Q_RETURN_ARG(QVariant, returnedValue),
                            Q_ARG(QVariant, msg));

  qDebug() << "QML function returned:" << returnedValue.toString();
  delete object;

  QDeclarativeView view;
  MyClass myClass;
  view.rootContext()->setContextProperty("myObject", &myClass);

  view.setSource(QUrl("qrc:/invoke.qml"));
  view.show();

  return a.exec();
}
开发者ID:danielgrigg,项目名称:sandbox,代码行数:26,代码来源:main.cpp

示例5: main

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

    count = PSMoveQt::count();

    if (count < 2) {
        std::cout << "Please connect at least 2 controllers." << std::endl;
    } else {
        std::cout << "Controllers connected: " << count << std::endl;
    }

    QApplication app(argc, argv);

    // Register the "PSMove" object for usage in QML
    PSMoveQt::registerQML();

    QDeclarativeView view;
    view.setWindowTitle("PS Move API - Qt Declarative Example (Multiple Controllers)");
    view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
    view.setSource(QUrl("qrc:/multiple.qml"));
    view.show();

    return app.exec();
}
开发者ID:CarlKenner,项目名称:psmoveapi,代码行数:26,代码来源:multiple.cpp

示例6: main

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QGraphicsScene scene;
    QGraphicsView view(&scene);

    // Add a Widget
    WidgetLoader *loader = new WidgetLoader;
    scene.addWidget(loader);

    //Add a second one and move to right side
    AnalogClock *clock = new AnalogClock;
    clock->move(QPoint(300,0));
    scene.addWidget(clock);

    //Finally the sampleWidget
    SampleWidget *widget = new SampleWidget;
    widget->move(0,300);
    scene.addWidget(widget);


    //Place a qml Widget
    QDeclarativeView *qmlView = new QDeclarativeView;
    qmlView->setSource(QUrl::fromLocalFile("qml/QMLBusTimetable.qml"));
    scene.addWidget(qmlView);
    qmlView->move(300,300);

    view.showMaximized();
    //Fullscreen:
//     view.showFullScreen();

    return a.exec();
}
开发者ID:pknierim,项目名称:WidgetCollection,代码行数:33,代码来源:main.cpp

示例7: main

int main(int argc, char **argv)
{
    QApplication a(argc, argv);

    QDeclarativeView v;

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

    QDeclarativeContext *c = v.rootContext();
    c->setContextProperty("fileBrowserUtils", new Utils);

    if (QFile::exists("main.qml"))
        v.setSource(QUrl::fromLocalFile("main.qml"));
    else
        v.setSource(QUrl("qrc:/qml/main.qml"));

    if (QCoreApplication::arguments().contains("-fullscreen")) {
        qDebug() << Q_FUNC_INFO << "Starting in fullscreen mode";
        v.showFullScreen();
    } else {
        qDebug() << Q_FUNC_INFO << "Starting in windowed mode";
        v.show();
    }

    return a.exec();
}
开发者ID:pgerdt,项目名称:qmlfilemuncher,代码行数:28,代码来源:main.cpp

示例8: main

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

    QDeclarativeView view;
    QDeclarativeContext *context = view.rootContext();
    context->setContextProperty("backgroundColor",
                                QColor(Qt::yellow));

    KDeclarative kdeclarative;
    kdeclarative.setDeclarativeEngine(view.engine());
    kdeclarative.initialize();
    //binds things like kconfig and icons
    kdeclarative.setupBindings();

    //If all gone well, the QScriptEngine has been extracted
    QScriptEngine *scriptEngine = kdeclarative.scriptEngine();
    Q_ASSERT(scriptEngine);

    //Bind a test QObject in the "QtScript way"
    QScriptValue global = scriptEngine->globalObject();
    TestObject *testObject = new TestObject();
    QScriptValue testValue = scriptEngine->newQObject(testObject);
    testValue.setScope(global);
    global.setProperty("testObject", testValue);

    view.setSource(QUrl::fromLocalFile("test.qml"));
    view.show();

    return app.exec();
}
开发者ID:ssj-gz,项目名称:emscripten-kdelibs,代码行数:31,代码来源:test.cpp

示例9: main

int main(int argc, char *argv[])
{
    Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("applications.AuthenticationApplication"));
    PropertyConfigurator::doConfigure(LOG4CPLUS_TEXT("log4cplus.properties"));

    WatchdogThread watchdogThread(iviLink::SystemController::AUTHENTICATION_APP);
    watchdogThread.start();

    LOG4CPLUS_INFO(logger, "Authentication main()");

    QApplication app(argc, argv);

    app.setApplicationName("AuthenticationApplication");
    app.setQuitOnLastWindowClosed(true);
    QDeclarativeView  viewer;
    QMLAuthenticationDialog * dialog = new QMLAuthenticationDialog;
    viewer.rootContext()->setContextProperty("QMLAuthenticationDialog", dialog);
    viewer.setSource(QUrl::fromLocalFile("qml/AuthenticationApplication/authentication.qml"));
    viewer.setAttribute(Qt::WA_TranslucentBackground);
    viewer.setAttribute(Qt::WA_NoSystemBackground);
    viewer.setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
    viewer.setStyleSheet("background:transparent;");
    // show the application
    viewer.move(QApplication::desktop()->screen()->rect().center() - viewer.rect().center() );
    viewer.show();
    dialog->init();

    LOG4CPLUS_TRACE(Logger::getInstance(LOG4CPLUS_TEXT("profiler.ComponentIsStarted")), "AuthenticationApplication");

    return app.exec();

}
开发者ID:,项目名称:,代码行数:32,代码来源:

示例10: main

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    ChronoList chronos;
    PilotList pilots;
    TrackList tracks;

    pilots.loadFromXml();
    tracks.loadFromXml();

    qmlRegisterType<Chrono>("libchrono", 1, 0, "Chrono");
    qmlRegisterType<ChronoList>("libchrono", 1, 0, "ChronoList");
    qmlRegisterType<Pilot>("libchrono", 1, 0, "Pilot");
    qmlRegisterType<PilotList>("libchrono", 1, 0, "PilotList");
    qmlRegisterType<Track>("libchrono", 1, 0, "Track");
    qmlRegisterType<TrackList>("libchrono", 1, 0, "TrackList");

    QDeclarativeView engine;
    engine.rootContext()->setContextProperty("chronos", &chronos);
    engine.rootContext()->setContextProperty("pilots", &pilots);
    engine.rootContext()->setContextProperty("tracks", &tracks);
    engine.setSource(QUrl("/usr/share/autodash/chrono.qml"));
    engine.show();

    return app.exec();
}
开发者ID:SylvestreG,项目名称:autodash,代码行数:26,代码来源:main.cpp

示例11: main

int main(int argc, char* argv[])
{
    QApplication app(argc, argv);
    QDeclarativeView view;
    view.setSource(QUrl(QCoreApplication::arguments().at(1)));
    view.show();
    return app.exec();
}
开发者ID:lorn,项目名称:c_sandbox,代码行数:8,代码来源:main.cpp

示例12: main

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

    QDeclarativeView view;
    view.setSource(QUrl("qrc:/main.qml"));
    view.show();

    return app.exec();
}
开发者ID:Afreeca,项目名称:qt,代码行数:11,代码来源:main.cpp

示例13: main

int main(int argc, char **argv)
{
    QApplication app(argc, argv);
    qmlRegisterType<LayoutDirectionSetter>("LayoutDirectionSetter", 1, 0, "LayoutDirectionSetter");

    QDeclarativeView view;
    view.setSource(QUrl("qrc:/main.qml"));
    view.show();
    return app.exec();
}
开发者ID:Seikareikou,项目名称:bb10-qt-components,代码行数:10,代码来源:extrasgallery.cpp

示例14: main

int main(int argc, char *argv[])
{
#if defined(LUGDULOV_MEEGO)
    QCoreApplication::setOrganizationName("net.iksaif.lugdulov");
#else
    QCoreApplication::setOrganizationName("Lugdulov");
#endif
    QCoreApplication::setApplicationName("Lugdulov");
    QCoreApplication::setApplicationVersion(LUGDULOV_VERSION);

#ifdef HAVE_MEEGOTOUCH
    QApplication *app = MDeclarativeCache::qApplication(argc, argv);
#else
    QApplication application(argc, argv);
    QApplication *app = &application;
#endif

    init_translations();
    init_libraries();

    Settings *settings = Settings::settings();
    PluginsModel *plugins = PluginsModel();

    qmlRegisterUncreatableType<Settings>("net.iksaif.lugdulov", 1, 0, "Settings");
    qmlRegisterUncreatableType<PluginsModel>("net.iksaif.lugdulov", 1, 0, "PluginsModel", "This object is created in the model.");
    qmlRegisterUncreatableType<StationsModel>("net.iksaif.lugdulov", 1, 0, "StationsModel", "This object is created in the model.");
    qmlRegisterUncreatableType<StationsSortFilterProxyModel>("net.iksaif.lugdulov", 1, 0, "StationsSortFilterModel", "This object is created in the model.");

#ifdef HAVE_MEEGOTOUCH
    QDeclarativeView *view = MDeclarativeCache::qDeclarativeView();
#else
    QDeclarativeView *view = new QDeclarativeView();
#endif

    QObject::connect(view->engine(), SIGNAL(quit()), app, SLOT(quit()));
    view->rootContext()->setContextProperty("plugins", plugins);
    view->rootContext()->setContextProperty("settings", settings);

#ifdef LUGDULOV_PLATFORM_HARMATTAN
    view->setSource(QUrl("qrc:/qml/harmattan/main.qml"));
    view->showFullScreen();
#elif defined(Q_OS_SYMBIAN)
    view->setSource(QUrl("qrc:/qml/symbian/main.qml"));
    view->showFullScreen();
#else
    view->setSource(QUrl("qrc:/qml/generic/main.qml"));
    view->show();
#endif


    int result = app->exec();
    delete view;
    delete app;
    return result;
}
开发者ID:iksaif,项目名称:lugdulov,代码行数:55,代码来源:main.cpp

示例15: main

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

	QDeclarativeView view;
	view.engine()->addImageProvider("stockimages", new StockImageProvider());
	view.setSource(QUrl::fromLocalFile("main.qml"));
	view.show();

	return app.exec();
}
开发者ID:GaryLee,项目名称:qmlbook,代码行数:11,代码来源:main.cpp


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