aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquicktextinput_p_p.h
diff options
context:
space:
mode:
authorStephen Kelly <ske@ableton.com>2015-07-17 13:04:04 +0200
committerStephen Kelly <ske@ableton.com>2015-10-13 13:37:09 +0000
commitf3446071da8357620d0c8593a04e3b4fbba88f21 (patch)
tree1f1c84d385beef31694412af1d9963eecfd355cf /src/quick/items/qquicktextinput_p_p.h
parent60866c99bc908a5c5a2a9cdfa74b00d692233f2f (diff)
Add a way to set default font rendering at build time.
QML text rendering elements have a renderType property controlling whether to use 'Qt' rendering or 'Native' rendering. There is no reason to mix different types of rendering in one static ui. The element-local properties may be used to change the rendering type during animation for example, but otherwise there should be an application-wide rendering mode for text. That means that all Text-based elements in QML should default to the same rendering mode. Additionally, applications wishing to use NativeRendering, wish to use it for all text-based elements, so they require changing the defaults of the elements themselves, still allowing the possibility of changing the rendering mode during animation. Creating third party wrappers for each of the QML text rendering types is not a solution because an application requires the same font rendering for all text. That is, whether written directly with QML Text* elements, or using QtQuick controls, or another 3rd party component set, it is necessary to set the same font rendering mode for all text, except in temporary execptional cases. The known options to achieve this are 1) Create an environment variable to set the default rendering. 2) Add C++ API to set the default 3) Add a build-time option to set the default. The first option is unsatisfying because it is fragile and is easy to get wrong. The second option is incomplete because it does not affect qmlscene etc, so it would require adding a command line argument to qmlscene to change the default. That is unsatisfying because it is also fragile. It is necessary for the sanity of developers and designers (and also end users) that qmlscene use the correct default by default. It must be easy to create qml files for designers to run with qmlscene and which look correct. The third option is the one chosen for this patch. It is most suitable for environments where the Qt build and settings are contained because a particular Qt build is shipped with the application using it (This is the most common way Qt is used). It affects all uses of the text rendering elements, whether used through qmlscene or through another entry point, and it allows changing the property in QML code away from the build-time-determined default. When building Qt, -DQT_QUICK_DEFAULT_TEXT_RENDER_TYPE=NativeRendering may be passed to configure to affect the default rendering for the Qt build. It also leaves the question why the default text rendering is 'Qt' instead of being 'Native', given that many of the Qt controls need to switch to Native anyway (though this depends on the platform and the style). Change-Id: Ib0eed61caf4895b29e5c05e0418fad9962779f85 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Diffstat (limited to 'src/quick/items/qquicktextinput_p_p.h')
-rw-r--r--src/quick/items/qquicktextinput_p_p.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/quick/items/qquicktextinput_p_p.h b/src/quick/items/qquicktextinput_p_p.h
index 4946adc7e7..fa7462c0c5 100644
--- a/src/quick/items/qquicktextinput_p_p.h
+++ b/src/quick/items/qquicktextinput_p_p.h
@@ -115,7 +115,11 @@ public:
, vAlign(QQuickTextInput::AlignTop)
, wrapMode(QQuickTextInput::NoWrap)
, m_echoMode(QQuickTextInput::Normal)
+#if defined(QT_QUICK_DEFAULT_TEXT_RENDER_TYPE)
+ , renderType(QQuickTextInput::QT_QUICK_DEFAULT_TEXT_RENDER_TYPE)
+#else
, renderType(QQuickTextInput::QtRendering)
+#endif
, updateType(UpdatePaintNode)
, mouseSelectionMode(QQuickTextInput::SelectCharacters)
, m_layoutDirection(Qt::LayoutDirectionAuto)