本文整理汇总了C++中QQuickView::setTitle方法的典型用法代码示例。如果您正苦于以下问题:C++ QQuickView::setTitle方法的具体用法?C++ QQuickView::setTitle怎么用?C++ QQuickView::setTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QQuickView
的用法示例。
在下文中一共展示了QQuickView::setTitle方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
void ZLibrary::run(ZLApplication* aApp)
{
if (ZLLanguageUtil::isRTLLanguage(ZLibrary::Language())) {
qApp->setLayoutDirection(Qt::RightToLeft);
}
QString qml(QString::fromStdString(BaseDirectory + BOOKS_QML_FILE));
HDEBUG("qml file" << qPrintable(qml));
QQuickView* view = SailfishApp::createView();
QQmlContext* root = view->rootContext();
QSize screenSize(view->screen()->size());
booksPPI =
#if defined(__i386__)
(screenSize == QSize(1536,2048)) ? 330 : 300;
#elif defined(__arm__)
(screenSize == QSize(540,960)) ? 245 : 290;
#else
# error Unexpected architechture
#endif
HDEBUG("screen" << screenSize << booksPPI << "dpi");
root->setContextProperty("PointsPerInch", booksPPI);
root->setContextProperty("MaximumHintCount", 1);
view->setTitle(qtTrId("books-app-name"));
view->setSource(QUrl::fromLocalFile(qml));
view->show();
HDEBUG("started");
qApp->exec();
HDEBUG("exiting...");
}
示例2: 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();
}
示例3: 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();
}
示例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);
viewer.setTitle(QStringLiteral("QML Chart"));
viewer.setSource(QUrl("qrc:/qml/qmlchart/main.qml"));
viewer.setResizeMode(QQuickView::SizeRootObjectToView);
viewer.show();
return app.exec();
}
示例5: 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();
}
示例6: 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();
}
示例7: main
Q_DECL_EXPORT int main(int argc, char *argv[])
{
QGuiApplication* app = SailfishApp::application(argc, argv);
qmlRegisterType<Creature>("harbour.morzyn", 1,0 , "Creature");
qmlRegisterType<Player>("harbour.morzyn", 1,0 , "Player");
qmlRegisterType<Game>("harbour.morzyn", 1,0 , "Game");
qmlRegisterType<Scroll>("harbour.morzyn", 1,0 , "Scroll");
qmlRegisterType<Statistics>("harbour.morzyn", 1,0 , "Statistics");
qmlRegisterType<Library>("harbour.morzyn", 1,0 , "Library");
QSettings settings(QSettings::IniFormat, QSettings::UserScope, "harbour-morzyn", "morzyn");
if (!settings.contains("fullscreen"))
settings.setValue("fullscreen", QVariant((bool)true));
if (!settings.contains("music"))
settings.setValue("music", QVariant((bool)true));
if (!settings.contains("sound"))
settings.setValue("sound", QVariant((bool)true));
qsrand ( time(NULL) );
QString locale = QLocale::system().name();
QTranslator translator;
translator.load(QString("morzyn_") + locale.left(2).toLower(), SailfishApp::pathTo("translations").toString());
app->installTranslator(&translator);
GameService gs;
Game g;
Constants c;
c.HCOUNT = 10;
c.VCOUNT = 10;
Library library;
Statistics s;
gs.setGame(&g);
gs.setConstants(&c);
gs.setLibrary(&library);
gs.setStatistics(&s);
gs.setSettings(&settings);
QQuickView* view = SailfishApp::createView();
view->rootContext()->setContextProperty("gameService", &gs);
view->rootContext()->setContextProperty("game", &g);
view->rootContext()->setContextProperty("library", &library);
view->rootContext()->setContextProperty("statistics", &s);
view->rootContext()->setContextProperty("os", QVariant("sailfish"));
view->rootContext()->setContextProperty("hCount", QVariant(c.HCOUNT));
view->rootContext()->setContextProperty("vCount", QVariant(c.VCOUNT));
view->rootContext()->setContextProperty("version", QVariant("0.7.17"));
view->setTitle("Morzyn v0.7.17");
view->setSource(SailfishApp::pathTo("qml/morzyn.qml"));
view->show();
return app->exec();
}
示例8: on_actionTextShadow_triggered
void HtmlEditor::on_actionTextShadow_triggered()
{
QQuickView* view = new QQuickView(QUrl::fromLocalFile(qmlFilePath("text_shadow.qml")));
view->setTitle(tr("Text Shadow"));
view->setColor(palette().window().color());
connect(view->rootObject(), SIGNAL(accepted(QString)), SLOT(formatTextShadow(QString)));
connect(view->engine(), SIGNAL(quit()), view, SLOT(close()));
view->show();
}
示例9: main
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
#ifdef PERFORMANCEMONITOR_SUPPORT
PerformanceMonitor::qmlRegisterTypes();
#endif
QUrl fileName;
qreal volume = 0.5;
QStringList args = app.arguments();
#ifdef PERFORMANCEMONITOR_SUPPORT
PerformanceMonitor::State performanceMonitorState;
#endif
for (int i = 1; i < args.size(); ++i) {
const QByteArray arg = args.at(i).toUtf8();
if (arg.startsWith('-')) {
if ("-volume" == arg) {
if (i + 1 < args.size())
volume = 0.01 * args.at(++i).toInt();
else
qtTrace() << "Option \"-volume\" takes a value";
}
#ifdef PERFORMANCEMONITOR_SUPPORT
else if (performanceMonitorState.parseArgument(arg)) {
// Do nothing
}
#endif
else {
qtTrace() << "Option" << arg << "ignored";
}
} else {
if (fileName.isEmpty())
fileName = QUrl::fromLocalFile(arg);
else
qtTrace() << "Argument" << arg << "ignored";
}
}
QQuickView viewer;
viewer.setSource(QUrl(QLatin1String("qrc:///qml/qmlvideofx/Main.qml")));
QQuickItem *rootObject = viewer.rootObject();
rootObject->setProperty("fileName", fileName);
viewer.rootObject()->setProperty("volume", volume);
#ifdef PERFORMANCEMONITOR_SUPPORT
if (performanceMonitorState.valid) {
rootObject->setProperty("perfMonitorsLogging", performanceMonitorState.logging);
rootObject->setProperty("perfMonitorsVisible", performanceMonitorState.visible);
}
QObject::connect(&viewer, SIGNAL(afterRendering()),
rootObject, SLOT(qmlFramePainted()));
#endif
FileReader fileReader;
viewer.rootContext()->setContextProperty("fileReader", &fileReader);
const QUrl appPath(QUrl::fromLocalFile(app.applicationDirPath()));
const QStringList picturesLocation = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation);
const QUrl imagePath = picturesLocation.isEmpty() ? appPath : QUrl::fromLocalFile(picturesLocation.first());
viewer.rootContext()->setContextProperty("imagePath", imagePath);
const QStringList moviesLocation = QStandardPaths::standardLocations(QStandardPaths::MoviesLocation);
const QUrl videoPath = moviesLocation.isEmpty() ? appPath : QUrl::fromLocalFile(moviesLocation.first());
viewer.rootContext()->setContextProperty("videoPath", videoPath);
viewer.setTitle("qmlvideofx");
viewer.setFlags(Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowTitleHint |
Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
viewer.setMinimumSize(QSize(1280, 720));
viewer.setResizeMode(QQuickView::SizeRootObjectToView);
viewer.show();
// Delay invocation of init until the event loop has started, to work around
// a GL context issue on Harmattan: without this, we get the following error
// when the first ShaderEffectItem is created:
// "QGLShaderProgram::addShader: Program and shader are not associated with same context"
QMetaObject::invokeMethod(viewer.rootObject(), "init", Qt::QueuedConnection);
return app.exec();
}
示例10: main
int main(int argc, char *argv[])
{
/* Workaround Qt platform integration plugin not advertising itself
as having the following capabilities:
- QPlatformIntegration::ThreadedOpenGL
- QPlatformIntegration::BufferQueueingOpenGL
*/
setenv("QML_FORCE_THREADED_RENDERER", "1", 1);
setenv("QML_FIXED_ANIMATION_STEP", "1", 1);
// ignore favorites in unity-scopes-shell plugin
setenv("UNITY_SCOPES_NO_FAVORITES", "1", 1);
QGuiApplication::setApplicationName("Unity Scope Tool");
QGuiApplication *application;
application = new QGuiApplication(argc, argv);
QCommandLineParser parser;
parser.setApplicationDescription("Unity Scope Tool\n\n"
"This tool allows development and testing of scopes. Running it without\n"
"any arguments will open a session to all scopes available on the system.\n"
"Otherwise passing a path to a scope config file will open a session with\n"
"only that scope (assuming that the binary implementing the scope can be\n"
"found in the same directory as the config file).");
QCommandLineOption helpOption = parser.addHelpOption();
parser.addPositionalArgument("scopes", "Paths to scope config files to spawn, optionally.", "[scopes...]");
QCommandLineOption includeSystemScopes("include-system-scopes",
"Initialize the registry with scopes installed on this system");
QCommandLineOption includeServerScopes("include-server-scopes",
"Initialize the registry with scopes on the default server");
parser.addOption(includeServerScopes);
parser.addOption(includeSystemScopes);
parser.parse(application->arguments());
if (parser.isSet(helpOption)) {
parser.showHelp();
}
QStringList extraScopes = parser.positionalArguments();
QScopedPointer<RegistryTracker> tracker;
if (!extraScopes.isEmpty()) {
bool systemScopes = parser.isSet(includeSystemScopes);
bool serverScopes = parser.isSet(includeServerScopes);
tracker.reset(new RegistryTracker(extraScopes, systemScopes, serverScopes));
}
bindtextdomain("unity8", translationDirectory().toUtf8().data());
textdomain("unity8");
QQuickView* view = new QQuickView();
view->setResizeMode(QQuickView::SizeRootObjectToView);
view->setTitle(QGuiApplication::applicationName());
view->engine()->setBaseUrl(QUrl::fromLocalFile(::qmlDirectory()));
QUrl source(::qmlDirectory() + "/ScopeTool.qml");
prependImportPaths(view->engine(), ::overrideImportPaths());
prependImportPaths(view->engine(), ::nonMirImportPaths());
appendImportPaths(view->engine(), ::fallbackImportPaths());
view->setSource(source);
view->show();
UnixSignalHandler signal_handler([]{
QGuiApplication::exit(0);
});
signal_handler.setupUnixSignalHandlers();
int result = application->exec();
delete view;
delete application;
return result;
}