From e823c351c6226765ccfe66e2ee93a2797dcc9721 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 26 Nov 2018 11:22:07 +0100 Subject: Fix resolve() on fonts returned from QWidget::font() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Set the inherited properties as resolved on the font, so non-default values are passed on in contexts that does resolve logic like QPainter. One test is updated as it actually tests what it is supposed to on more configurations. Fixes: QTBUG-39560 Change-Id: Ief668e992ccdc091337a259a4c1306a00e67c73f Reviewed-by: Tor Arne Vestbø --- tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp') diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 360e6986f6..3b9c9060fa 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -166,6 +166,7 @@ private slots: void getSetCheck(); void fontPropagation(); void fontPropagation2(); + void fontPropagation3(); void palettePropagation(); void palettePropagation2(); void enabledPropagation(); @@ -819,6 +820,18 @@ void tst_QWidget::fontPropagation2() QVERIFY(child5->font().italic()); } +void tst_QWidget::fontPropagation3() +{ + QWidget parent; + QWidget *child = new QWidget(&parent); + parent.setFont(QFont("Monospace", 9)); + QImage image(32, 32, QImage::Format_RGB32); + QPainter p(&image); + p.setFont(child->font()); + QCOMPARE(p.font().family(), child->font().family()); + QCOMPARE(p.font().pointSize(), child->font().pointSize()); +} + void tst_QWidget::palettePropagation() { QScopedPointer testWidget(new QWidget); -- cgit v1.2.3