本文整理汇总了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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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;
}
示例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();
}