本文整理汇总了C++中QQuickView::resize方法的典型用法代码示例。如果您正苦于以下问题:C++ QQuickView::resize方法的具体用法?C++ QQuickView::resize怎么用?C++ QQuickView::resize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QQuickView
的用法示例。
在下文中一共展示了QQuickView::resize方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: size
QQuickView *QQuickViewTestUtil::createView()
{
QQuickView *window = new QQuickView(0);
const QSize size(240, 320);
window->resize(size);
QQuickViewTestUtil::centerOnScreen(window, size);
return window;
}
示例2: main
int main(int argc, char *argv[])
{
QGuiApplication app(argc,argv);
QQuickView view;
view.setResizeMode(QQuickView::SizeRootObjectToView);
QObject::connect(view.engine(), SIGNAL(quit()), qApp, SLOT(quit()));
view.setSource(QUrl("qrc:///LoginContainer.qml"));
view.resize(800, 480);
view.showFullScreen();
return app.exec();
}
示例3: main
int main(int argc, char *argv[])
{
QGuiApplication a(argc, argv);
qmlRegisterType<Graph>("Graph", 1, 0, "Graph");
QQuickView view;
view.resize(800, 400);
view.setResizeMode(QQuickView::SizeRootObjectToView);
view.setSource(QUrl("qrc:///scenegraph/graph/main.qml"));
view.show();
return a.exec();
}
示例4: main
int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
//qmlRegisterType<PhysicsSetter>("PhysicsSetter", 1, 0, "PhysicsSetter");
QQuickView view;
view.resize(500, 500);
view.setResizeMode(QQuickView::SizeRootObjectToView);
view.setSource(QUrl("qrc:/main.qml"));
view.show();
return app.exec();
}
示例5: main
int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
QQuickView window;
window.setSource(QUrl("qrc:/main.qml"));
#ifdef __arm__
window.showFullScreen();
#else
window.resize(window.initialSize().width(), window.initialSize().height());
window.show();
#endif
return app.exec();
}
示例6: main
/*----------------------------------------------------------------------
| main
+---------------------------------------------------------------------*/
int main(int argc, char* argv[])
{
QGuiApplication app(argc, argv);
// Utility.
POC_QMLUtils qmlUtils;
QQuickView view;
view.engine()->rootContext()->setContextProperty("utils", &qmlUtils);
view.setSource(QUrl("qrc:///qml/main.qml"));
view.setResizeMode(QQuickView::SizeRootObjectToView);
#ifdef RASPBERRY
view.showFullScreen();
#else
view.resize(800, 400);
view.show();
#endif // RASPBERRY
qApp->connect(view.engine(), SIGNAL(quit()), qApp, SLOT(quit()));
// If file path is provided from the command line, I start the player
// immediately.
QStringList args = app.arguments();
if (args.size() > 1) {
QFile f(args.at(1));
if (!f.exists())
qWarning("File provided does not exist.");
else {
QObject* rootObject = dynamic_cast<QObject*>(view.rootObject());
QObject* mediaOutput = rootObject->findChild<QObject*>("mediaOutput");
//mediaPlayer->setProperty("source", QUrl::fromLocalFile(args.at(1)));
QMetaObject::invokeMethod(mediaOutput, "showLocalMedia", Q_ARG(QVariant, args.at(1)));
}
}
return app.exec();
}
示例7: main
/*----------------------------------------------------------------------
| main
+---------------------------------------------------------------------*/
int main(int argc, char* argv[])
{
QGuiApplication app(argc, argv);
// Utility.
QStringList args = app.arguments();
POC_Mode currentMode;
if (args.contains("--animations"))
currentMode = MODE_ANIMATIONS;
else if (args.contains("--loop"))
currentMode = MODE_LOOP;
else if (args.contains("--seektest"))
currentMode = MODE_SEEK;
else
currentMode = MODE_PLAYER;
POC_QMLUtils qmlUtils;
QQuickView view;
// Set EGL to 24bit color depth.
QSurfaceFormat curSurface = view.format();
curSurface.setRedBufferSize(8);
curSurface.setGreenBufferSize(8);
curSurface.setBlueBufferSize(8);
curSurface.setAlphaBufferSize(0);
view.setFormat(curSurface);
view.engine()->rootContext()->setContextProperty("utils", &qmlUtils);
switch (currentMode) {
case MODE_ANIMATIONS:
view.setSource(QUrl("qrc:///qml/main_animations.qml"));
break;
case MODE_LOOP:
view.setSource(QUrl("qrc:///qml/main_loop.qml"));
break;
case MODE_SEEK:
view.setSource(QUrl(QStringLiteral("qrc:///qml/main_seektest.qml")));
break;
default:
view.setSource(QUrl("qrc:///qml/main.qml"));
break;
}
qInstallMessageHandler(&log_handler);
LC_QMLLogger::registerObject(view.rootContext());
view.setResizeMode(QQuickView::SizeRootObjectToView);
#ifdef RASPBERRY
view.showFullScreen();
#else
view.resize(800, 400);
view.show();
#endif // RASPBERRY
qApp->connect(view.engine(), SIGNAL(quit()), qApp, SLOT(quit()));
// If file path is provided from the command line, I start the player
// immediately.
switch (currentMode) {
case MODE_LOOP: {
QStringList list;
for (int i = 2; i < args.size(); i++)
list << args.at(i);
if (list.size() < 1)
return log_warn("No items to play.");
if (!show_media(&view, list))
return 1;
break;
}
case MODE_PLAYER:
if (args.size() > 1)
if (!show_media(&view, args.at(1)))
return 1;
break;
default:
if (args.size() > 2)
if (!show_media(&view, args.at(2)))
return 1;
break;
}
return app.exec();
}
示例8: resizemodeitem
void tst_QQuickView::resizemodeitem()
{
QWindow window;
window.setGeometry(0, 0, 400, 400);
QQuickView *view = new QQuickView(&window);
QVERIFY(view);
view->setResizeMode(QQuickView::SizeRootObjectToView);
QCOMPARE(QSize(0,0), view->initialSize());
view->setSource(testFileUrl("resizemodeitem.qml"));
QQuickItem* item = qobject_cast<QQuickItem*>(view->rootObject());
QVERIFY(item);
window.show();
view->show();
// initial size from root object
QCOMPARE(item->width(), 200.0);
QCOMPARE(item->height(), 200.0);
QCOMPARE(view->size(), QSize(200, 200));
QCOMPARE(view->size(), view->sizeHint());
QCOMPARE(view->size(), view->initialSize());
// size update from view
view->resize(QSize(80,100));
QTRY_COMPARE(item->width(), 80.0);
QCOMPARE(item->height(), 100.0);
QCOMPARE(view->size(), QSize(80, 100));
QCOMPARE(view->size(), view->sizeHint());
view->setResizeMode(QQuickView::SizeViewToRootObject);
// size update from view disabled
view->resize(QSize(60,80));
QCOMPARE(item->width(), 80.0);
QCOMPARE(item->height(), 100.0);
QTest::qWait(50);
QCOMPARE(view->size(), QSize(60, 80));
// size update from root object
item->setWidth(250);
item->setHeight(350);
QCOMPARE(item->width(), 250.0);
QCOMPARE(item->height(), 350.0);
QTRY_COMPARE(view->size(), QSize(250, 350));
QCOMPARE(view->size(), QSize(250, 350));
QCOMPARE(view->size(), view->sizeHint());
// reset window
window.hide();
delete view;
view = new QQuickView(&window);
QVERIFY(view);
view->setResizeMode(QQuickView::SizeViewToRootObject);
view->setSource(testFileUrl("resizemodeitem.qml"));
item = qobject_cast<QQuickItem*>(view->rootObject());
QVERIFY(item);
window.show();
view->show();
// initial size for root object
QCOMPARE(item->width(), 200.0);
QCOMPARE(item->height(), 200.0);
QCOMPARE(view->size(), view->sizeHint());
QCOMPARE(view->size(), view->initialSize());
// size update from root object
item->setWidth(80);
item->setHeight(100);
QCOMPARE(item->width(), 80.0);
QCOMPARE(item->height(), 100.0);
QTRY_COMPARE(view->size(), QSize(80, 100));
QCOMPARE(view->size(), QSize(80, 100));
QCOMPARE(view->size(), view->sizeHint());
// size update from root object disabled
view->setResizeMode(QQuickView::SizeRootObjectToView);
item->setWidth(60);
item->setHeight(80);
QCOMPARE(view->width(), 80);
QCOMPARE(view->height(), 100);
QCOMPARE(QSize(item->width(), item->height()), view->sizeHint());
// size update from view
view->resize(QSize(200,300));
QTest::qWait(50);
QCOMPARE(item->width(), 200.0);
QCOMPARE(item->height(), 300.0);
QCOMPARE(view->size(), QSize(200, 300));
QCOMPARE(view->size(), view->sizeHint());
window.hide();
delete view;
// if we set a specific size for the view then it should keep that size
// for SizeRootObjectToView mode.
view = new QQuickView(&window);
view->resize(300, 300);
//.........这里部分代码省略.........
示例9: main
int main(int argc, char **argv)
{
setenv("QML_BAD_GUI_RENDER_LOOP", "1", 1);
QGuiApplication app(argc, argv);
QString path, urlstring, qmlstring;
bool isFullscreen = false;
QStringList arguments = app.arguments();
for (int i = 0; i < arguments.count(); ++i) {
QString parameter = arguments.at(i);
if (parameter == "-path") {
if (i + 1 >= arguments.count())
qFatal("-path requires an argument");
path = arguments.at(i + 1);
i++;
} else if (parameter == "-url") {
if (i + 1 >= arguments.count())
qFatal("-url requires an argument");
urlstring = arguments.at(i + 1);
i++;
} else if (parameter == "-qml") {
if (i + 1 >= arguments.count())
qFatal("-qml requires an argument");
qmlstring = arguments.at(i + 1);
i++;
} else if (parameter == "-fullscreen") {
isFullscreen = true;
} else if (parameter == "-help") {
qDebug() << "EMail application";
qDebug() << "-fullscreen - show QML fullscreen";
qDebug() << "-path - path to cd to before launching -url";
qDebug() << "-qml - file to launch (default: main.qml inside -path)";
qDebug() << "-url - url to load";
exit(0);
}
}
QQuickView view;
view.setResizeMode(QQuickView::SizeRootObjectToView);
view.rootContext()->setContextProperty("startURL", QVariant(urlstring));
view.rootContext()->setContextProperty("createParentID", QVariant(0));
view.rootContext()->setContextProperty("MozContext", QMozContext::GetInstance());
view.setSource(qmlstring.isEmpty() ? QUrl("qrc:/qml/MainPageQuick.qml") : QUrl(qmlstring));
if (isFullscreen) {
QRect r = QGuiApplication::primaryScreen()->geometry();
view.resize(r.width(), r.height());
view.showFullScreen();
}
else {
view.resize(800, 600);
view.show();
}
QString componentPath(DEFAULT_COMPONENTS_PATH);
qDebug() << "Load components from:" << componentPath + QString("/components") + QString("/EmbedLiteBinComponents.manifest");
QMozContext::GetInstance()->addComponentManifest(componentPath + QString("/components") + QString("/EmbedLiteBinComponents.manifest"));
qDebug() << "Load components from:" << componentPath + QString("/components") + QString("/EmbedLiteJSComponents.manifest");
QMozContext::GetInstance()->addComponentManifest(componentPath + QString("/components") + QString("/EmbedLiteJSComponents.manifest"));
qDebug() << "Load components from:" << componentPath + QString("/chrome") + QString("/EmbedLiteJSScripts.manifest");
QMozContext::GetInstance()->addComponentManifest(componentPath + QString("/chrome") + QString("/EmbedLiteJSScripts.manifest"));
qDebug() << "Load components from:" << componentPath + QString("/chrome") + QString("/EmbedLiteOverrides.manifest");
QMozContext::GetInstance()->addComponentManifest(componentPath + QString("/chrome") + QString("/EmbedLiteOverrides.manifest"));
QTimer::singleShot(0, QMozContext::GetInstance(), SLOT(runEmbedding()));
return app.exec();
}