From 009ad875f89d7d7bc4447e18c2fbbd485a75e0b5 Mon Sep 17 00:00:00 2001 From: Oleg Shparber Date: Mon, 19 May 2014 00:53:39 -0700 Subject: [PATCH] Fix improper antialiasing property behavior For components antialiased by default the property was returned as false if default true value was set to true again. Task-number: QTBUG-39047 Change-Id: I16960a12b6d38a0d9e487fc6612610c39c4949d4 Reviewed-by: Gunnar Sletta --- src/quick/items/qquickitem.cpp | 8 +++++--- tests/auto/quick/qquicktext/tst_qquicktext.cpp | 7 +++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 3f0dae8..ef2eac4 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -5691,10 +5691,12 @@ void QQuickItem::setAntialiasing(bool aa) { Q_D(QQuickItem); - bool changed = (aa != antialiasing()); - d->antialiasingValid = true; + if (!d->antialiasingValid) { + d->antialiasingValid = true; + d->antialiasing = d->implicitAntialiasing; + } - if (!changed) + if (aa == d->antialiasing) return; d->antialiasing = aa; diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp index 0b69981..d36c55d 100644 --- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp +++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp @@ -1334,6 +1334,13 @@ void tst_qquicktext::antialiasing() text->resetAntialiasing(); QCOMPARE(text->antialiasing(), true); QCOMPARE(spy.count(), 2); + + // QTBUG-39047 + component.setData("import QtQuick 2.0\n Text { antialiasing: true }", QUrl()); + object.reset(component.create()); + text = qobject_cast(object.data()); + QVERIFY(text); + QCOMPARE(text->antialiasing(), true); } void tst_qquicktext::weight() -- 1.7.1