QmlDesigner.instances: Always use distance field text rendering

This avoids sub pixel antialias artefacts.

We call disableNativeTextRendering() in updateDirtyNodesRecursive(), because
items might be created or change the property after component complete.

Change-Id: Icd9c87b69434a910c9555540ba7bafdc874afc5a
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
Thomas Hartmann
2014-11-19 11:39:19 +01:00
committed by Thomas Hartmann
parent e3ae038387
commit e28fa8406c

View File

@@ -36,6 +36,7 @@
#include <QQuickView>
#include <cmath>
#include <private/qquicktext_p.h>
#include <private/qquicktextinput_p.h>
#include <private/qquicktextedit_p.h>
@@ -191,6 +192,21 @@ bool QuickItemNodeInstance::hasContent() const
return childItemsHaveContent(quickItem());
}
static void disableNativeTextRendering(QQuickItem *item)
{
QQuickText *text = qobject_cast<QQuickText*>(item);
if (text)
text->setRenderType(QQuickText::QtRendering);
QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(item);
if (textInput)
textInput->setRenderType(QQuickTextInput::QtRendering);
QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(item);
if (textEdit)
textEdit->setRenderType(QQuickTextEdit::QtRendering);
}
static void disableTextCursor(QQuickItem *item)
{
foreach (QQuickItem *childItem, item->childItems())
@@ -464,6 +480,7 @@ void QuickItemNodeInstance::updateDirtyNodesRecursive(QQuickItem *parentItem) co
updateDirtyNodesRecursive(childItem);
}
disableNativeTextRendering(parentItem);
DesignerSupport::updateDirtyNode(parentItem);
}