本文整理汇总了C++中QQuickView::setResizeMode方法的典型用法代码示例。如果您正苦于以下问题:C++ QQuickView::setResizeMode方法的具体用法?C++ QQuickView::setResizeMode怎么用?C++ QQuickView::setResizeMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QQuickView
的用法示例。
在下文中一共展示了QQuickView::setResizeMode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
std::cout << "Have " << argc << " arguments:" << std::endl;
for (int i = 0; i < argc; ++i) {
std::cout << argv[i] << std::endl;
}
Client c;
if (argc > 1) {
c.doConnect();
}
QGuiApplication a(argc, argv);
QQuickView view;
QRCodeReader reader;
view.engine()->rootContext()->setContextProperty("qrCodeReader", &reader);
qmlRegisterType<QRCodeGenerator>("Tagger", 0, 1, "QRCodeGenerator");
view.engine()->addImageProvider(QStringLiteral("qrcode"), new QRCodeImageProvider);
view.engine()->addImageProvider(QStringLiteral("reader"), &reader);
view.setResizeMode(QQuickView::SizeRootObjectToView);
view.setSource(QUrl::fromLocalFile("qml/tagger.qml"));
view.show();
return a.exec();
}
示例2: main
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQuickView viewer;
// The following are needed to make examples run without having to install the module
// in desktop environments.
#ifdef Q_OS_WIN
QString extraImportPath(QStringLiteral("%1/../../../../%2"));
#else
QString extraImportPath(QStringLiteral("%1/../../../%2"));
#endif
viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(),
QString::fromLatin1("qml")));
viewer.setSource(QUrl("qrc:/main.qml"));
viewer.setTitle(QStringLiteral("Interaction"));
viewer.setResizeMode(QQuickView::SizeRootObjectToView);
viewer.setColor("#fafafa");
viewer.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: main
int main(int argc, char *argv[])
{
// Qt Charts uses Qt Graphics View Framework for drawing, therefore QApplication must be used.
QApplication app(argc, argv);
QQuickView viewer;
// The following are needed to make examples run without having to install the module
// in desktop environments.
#ifdef Q_OS_WIN
QString extraImportPath(QStringLiteral("%1/../../../../%2"));
#else
QString extraImportPath(QStringLiteral("%1/../../../%2"));
#endif
viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(),
QString::fromLatin1("qml")));
QObject::connect(viewer.engine(), &QQmlEngine::quit, &viewer, &QWindow::close);
QString appKey;
if (argc > 1) {
appKey = argv[1];
qDebug() << "App key for worldweatheronline.com:" << appKey;
} else {
qWarning() << "No app key for worldweatheronline.com given. Using static test data instead of live data.";
}
viewer.setTitle(QStringLiteral("QML Weather"));
viewer.rootContext()->setContextProperty("weatherAppKey", appKey);
viewer.setSource(QUrl("qrc:/qml/qmlweather/main.qml"));
viewer.setResizeMode(QQuickView::SizeRootObjectToView);
viewer.show();
return app.exec();
}
示例5: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QQuickView viewer;
viewer.setResizeMode(QQuickView::SizeRootObjectToView);
QObjectList model_qobjectlist;
model_qobjectlist << new TestObject(0);
model_qobjectlist << new TestObject(1);
model_qobjectlist << new TestObject(2);
viewer.rootContext()->setContextProperty("model_qobjectlist", QVariant::fromValue(model_qobjectlist));
TestObject *model_qobject = new TestObject(0);
viewer.rootContext()->setContextProperty("model_qobject", QVariant::fromValue(model_qobject));
QStringList model_qstringlist;
model_qstringlist << QStringLiteral("A");
model_qstringlist << QStringLiteral("B");
model_qstringlist << QStringLiteral("C");
viewer.rootContext()->setContextProperty("model_qstringlist", model_qstringlist);
TestModel *model_qaim = new TestModel;
viewer.rootContext()->setContextProperty("model_qaim", model_qaim);
viewer.setSource(QStringLiteral("qrc:/qml/main.qml"));
viewer.show();
return app.exec();
}
示例6: main
Q_DECL_EXPORT int main(int argc, char *argv[]) {
QGuiApplication *lApplication = new QGuiApplication(argc, argv);
QQuickView *lView = new QQuickView;
lView->setResizeMode(QQuickView::SizeRootObjectToView);
QVariantList lLevelList;
createAllLevels(lLevelList);
lView->rootContext()->setContextProperty(QStringLiteral("gLevels"), lLevelList);
QNetworkAccessManager lNetworkManager;
LevelModel *lLevelModel = new LevelModel(lLevelList.count(), &lNetworkManager, lApplication);
lView->rootContext()->setContextProperty(QStringLiteral("gLevelModel"), lLevelModel);
HighScoresModel *lHighScoresModel = new HighScoresModel(lApplication);
lView->rootContext()->setContextProperty(QStringLiteral("gHighScoresModel"), lHighScoresModel);
QObject::connect(lLevelModel, SIGNAL(postingSucceded()), lHighScoresModel, SLOT(readScoresFromFile()));
QObject::connect(lView->engine(), SIGNAL(quit()), lApplication, SLOT(quit()));
qmlRegisterType<LevelHighScoresModel>("ChimpModels", 1, 0, "LevelHighScoreModel");
LevelHighScoresModel::registerOtherModels(lLevelModel, lHighScoresModel);
lView->setSource(QStringLiteral("qrc:///qml/Game.qml"));
lView->showFullScreen();
return lApplication->exec();
}
示例7: QDialog
void Fix8Log::aboutSlot()
{
QDialog *aboutDialog = new QDialog();
QVBoxLayout *aboutLayout = new QVBoxLayout(0);
QDialogButtonBox *dialogButtonBox = new QDialogButtonBox();
dialogButtonBox->addButton(QDialogButtonBox::Ok);
connect(dialogButtonBox,SIGNAL(clicked(QAbstractButton*)),
aboutDialog,SLOT(close()));
QQuickView *aboutView = new QQuickView(QUrl("qrc:qml/helpAbout.qml"));
QQuickItem *qmlObject = aboutView->rootObject();
qmlObject->setProperty("color",aboutDialog->palette().color(QPalette::Window));
qmlObject->setProperty("bgColor",aboutDialog->palette().color(QPalette::Window));
qmlObject->setProperty("version",QString::number(Globals::version));
aboutView->setResizeMode(QQuickView::SizeRootObjectToView);
QWidget *aboutWidget = QWidget::createWindowContainer(aboutView,0);
aboutWidget->setPalette(aboutDialog->palette());
aboutWidget->setAutoFillBackground(false);
aboutDialog->setLayout(aboutLayout);
aboutLayout->addWidget(aboutWidget,1);
aboutLayout->addWidget(dialogButtonBox,0);
aboutDialog->resize(500,400);
aboutDialog->setWindowTitle(GUI::Globals::appName);
aboutDialog->exec();
aboutDialog->deleteLater();
}
示例8: main
int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
// qmlRegisterType<TraceView>("SysViz", 1, 0, "TraceView");
qmlRegisterType<ThreadSliceView>("SysViz", 1, 0, "ThreadSliceView");
qmlRegisterType<GraphItem> ("SysViz", 1, 0, "GraphItem");
qmlRegisterType<TraceModel>();
qmlRegisterType<QAbstractListModel>();
qmlRegisterType<CpuFrequencyModel>();
qmlRegisterType<GpuFrequencyModel>();
TraceModel model;
QQuickView view;
QSurfaceFormat format = view.requestedFormat();
format.setSamples(16);
view.setFormat(format);
view.rootContext()->setContextProperty("traceModel", &model);
view.rootContext()->setContextProperty("cm", view.screen()->physicalDotsPerInch() / 2.54);
view.setResizeMode(QQuickView::SizeRootObjectToView);
view.setSource(QUrl::fromLocalFile("qml/main.qml"));
view.setTitle("sysviz");
view.show();
#ifdef QT_DQML_LIB
DQmlLocalServer server(view.engine(), &view, "qml/main.qml");
server.fileTracker()->track("qml", "qml");
#endif
app.exec();
}
示例9: main
int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
FileTest *fileTest = new FileTest();
fileTest->writeFilesToDisk();
fileTest->readFilesFromDisk();
NetworkTest *networkTest = new NetworkTest();
networkTest->TestHttp();
networkTest->TestHttps();
QQuickView view;
GpsClient *gpsClient = new GpsClient(&view);
view.engine()->rootContext()->setContextProperty(QLatin1String("gpsClient"),
gpsClient);
NotificationClient *notificationClient = new NotificationClient(&view);
view.engine()->rootContext()->setContextProperty(QLatin1String("notificationClient"),
notificationClient);
view.setResizeMode(QQuickView::SizeRootObjectToView);
view.setSource(QUrl(QStringLiteral("qrc:/qml/main.qml")));
view.show();
return app.exec();
}
示例10: main
//=====================================================================================================================
int main(int argc, char* argv[])
//=====================================================================================================================
{
QGuiApplication app(argc, argv);
QQuickView viewer;
//QString extraImportPath(QStringLiteral("%1/../../../%2"));
//viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(), QString::fromLatin1("qml")));
// set path to find the plugin
QString extraImportPath(QStringLiteral("%1/../pluginlib"));
QString path = extraImportPath.arg(QGuiApplication::applicationDirPath());
viewer.engine()->addImportPath(path);
// create list of my custom objects
Wrapper wrapper;
// and set the list as model
QQmlContext *ctxt = viewer.rootContext();
ctxt->setContextProperty("wrapper", &wrapper);
// set up connection
QObject::connect(viewer.engine(), &QQmlEngine::quit, &viewer, &QWindow::close);
viewer.setTitle(QStringLiteral("Custom Plugin Demo"));
viewer.setResizeMode(QQuickView::SizeRootObjectToView);
viewer.setSource(QUrl("qrc:/qml/view.qml"));
viewer.show();
return QGuiApplication::exec();
}
示例11: QDialog
FlightLogDialog::FlightLogDialog(QWidget *parent, FlightLogManager *flightLogManager) :
QDialog(parent)
{
qmlRegisterType<ExtendedDebugLogEntry>("org.openpilot", 1, 0, "DebugLogEntry");
qmlRegisterType<UAVOLogSettingsWrapper>("org.openpilot", 1, 0, "UAVOLogSettingsWrapper");
setWindowIcon(QIcon(":/core/images/openpilot_logo_32.png"));
setWindowTitle(tr("Manage flight side logs"));
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setMinimumSize(600, 400);
QQuickView *view = new QQuickView();
view->rootContext()->setContextProperty("dialog", this);
view->rootContext()->setContextProperty("logStatus", flightLogManager->flightLogStatus());
view->rootContext()->setContextProperty("logControl", flightLogManager->flightLogControl());
view->rootContext()->setContextProperty("logSettings", flightLogManager->flightLogSettings());
view->rootContext()->setContextProperty("logManager", flightLogManager);
view->setResizeMode(QQuickView::SizeRootObjectToView);
view->setSource(QUrl("qrc:/flightlog/FlightLogDialog.qml"));
QWidget *container = QWidget::createWindowContainer(view);
container->setMinimumSize(600, 400);
container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
QVBoxLayout *lay = new QVBoxLayout();
lay->setContentsMargins(0, 0, 0, 0);
setLayout(lay);
layout()->addWidget(container);
}
示例12: 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();
}
示例13: main
int main(int argc, char* argv[])
{
QGuiApplication app(argc,argv);
qmlRegisterType<Connector>("Connector", 1, 0, "Connector");
app.setOrganizationName("QtProject");\
app.setOrganizationDomain("qt-project.org");\
app.setApplicationName(QFileInfo(app.applicationFilePath()).baseName());\
QQuickView view;\
if (qgetenv("QT_QUICK_CORE_PROFILE").toInt()) {\
QSurfaceFormat f = view.format();\
f.setProfile(QSurfaceFormat::CoreProfile);\
f.setVersion(4, 4);\
view.setFormat(f);\
}\
view.connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit()));\
new QQmlFileSelector(view.engine(), &view);\
view.setSource(QUrl("qrc:///demos/tweetsearch/tweetsearch.qml")); \
view.setResizeMode(QQuickView::SizeRootObjectToView);\
if (QGuiApplication::platformName() == QLatin1String("qnx") || \
QGuiApplication::platformName() == QLatin1String("eglfs")) {\
view.showFullScreen();\
} else {\
view.show();\
}\
return app.exec();\
}
示例14: main
int main(int argc, char *argv[])
{
int ret;
QGuiApplication app(argc, argv);
QQuickView *pParentView = new QQuickView();
pParentView->setResizeMode(QQuickView::SizeRootObjectToView);
QQmlEngine *engine = pParentView->engine();
qmlRegisterType<TestListModel>("TestListModel",1,0,"TestListModel");
#if 1
QDir::setCurrent(QGuiApplication::applicationDirPath());
QmcLoader loader(engine);
QQmlComponent *component = loader.loadComponent("../qml/main.qmc");
#else
QQmlComponent *component = new QQmlComponent(engine, QUrl("../qml/main.qmc"));
#endif
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: 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();
}
}