aboutsummaryrefslogtreecommitdiffstats
path: root/tools/qmlscene
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2017-07-24 15:15:18 +0200
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2017-08-23 14:16:51 +0000
commit460925b3f1dd9d2301b9c69558bd68843cd5f978 (patch)
tree69169f8b3f35a4e6a2e124c62e416336b779ae06 /tools/qmlscene
parent51763b1b191c0839ea05c75855b9e09b65b80546 (diff)
Add a way to set the default render type of text-like elements
f3446071da8357620d0c8593a04e3b4fbba88f21 introduced a build-time way to select the default render type of text-like elements. This patch adds also a way to select it at runtime, via a setter on QQuickWindow. (QQuickWindow has been chosen as convenience, rather than adding another namespace/class to just have this setter.) Given that QT_QUICK_DEFAULT_TEXT_RENDER_TYPE was never documented, I've taken the liberty of changing the accepted values for it (to match the new enumerator names in QQuickWindow, rather than the ones in QQuickText/QQuickTextEdit/etc.). [ChangeLog][QtQuick][QQuickWindow] It is now possible to set the default render type of text-like elements globally via the QQuickWindow::setTextRenderType() function. If you were using the (undocumented) QT_QUICK_DEFAULT_TEXT_RENDER_TYPE macro when building Qt Quick for the same purpose, note that the macro value needs now to be set to the "NativeTextRendering" value, instead of "NativeRendering". Change-Id: Id4b2dc3ec823971486e445ca4173b8be848fb4e3 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'tools/qmlscene')
-rw-r--r--tools/qmlscene/main.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp
index f411c6becc..fc8b9c5292 100644
--- a/tools/qmlscene/main.cpp
+++ b/tools/qmlscene/main.cpp
@@ -159,6 +159,7 @@ struct Options
, coreProfile(false)
, verbose(false)
, applicationType(DefaultQmlApplicationType)
+ , textRenderType(QQuickWindow::textRenderType())
{
// QtWebEngine needs a shared context in order for the GPU thread to
// upload textures.
@@ -182,6 +183,7 @@ struct Options
QVector<Qt::ApplicationAttribute> applicationAttributes;
QString translationFile;
QmlApplicationType applicationType;
+ QQuickWindow::TextRenderType textRenderType;
};
#if defined(QMLSCENE_BUNDLE)
@@ -377,6 +379,7 @@ static void usage()
#ifdef QT_WIDGETS_LIB
puts(" --apptype [gui|widgets] ...........Select which application class to use. Default is widgets.");
#endif
+ puts(" --textrendertype [qt|native].......Select the default render type for text-like elements.");
puts(" -I <path> ........................ Add <path> to the list of import paths");
puts(" -P <path> ........................ Add <path> to the list of plugin paths");
puts(" -translation <translationfile> ... Set the language to run in");
@@ -456,6 +459,19 @@ static QUrl parseUrlArgument(const QString &arg)
return url;
}
+static QQuickWindow::TextRenderType parseTextRenderType(const QString &renderType)
+{
+ if (renderType == QLatin1String("qt"))
+ return QQuickWindow::QtTextRendering;
+ else if (renderType == QLatin1String("native"))
+ return QQuickWindow::NativeTextRendering;
+
+ usage();
+
+ Q_UNREACHABLE();
+ return QQuickWindow::QtTextRendering;
+}
+
int main(int argc, char ** argv)
{
Options options;
@@ -536,6 +552,8 @@ int main(int argc, char ** argv)
pluginPaths.append(arguments.at(++i));
else if (lowerArgument == QLatin1String("--apptype"))
++i; // Consume previously parsed argument
+ else if (lowerArgument == QLatin1String("--textrendertype") && i + 1 < size)
+ options.textRenderType = parseTextRenderType(arguments.at(++i));
else if (lowerArgument == QLatin1String("--help")
|| lowerArgument == QLatin1String("-help")
|| lowerArgument == QLatin1String("--h")
@@ -564,6 +582,8 @@ int main(int argc, char ** argv)
}
#endif
+ QQuickWindow::setTextRenderType(options.textRenderType);
+
QUnifiedTimer::instance()->setSlowModeEnabled(options.slowAnimations);
if (options.url.isEmpty())