From 61e3fe7fd903981a75951ab360b37d186335afcb Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 15 Feb 2022 10:13:46 +0100 Subject: [PATCH] =?UTF-8?q?Do=20not=20assume=20implicit=20string-ish=20?= =?UTF-8?q?=E2=86=92=20QColor=20conversion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We want to mark the corresponding QColor ctor(s) explicit. Use Qt::GlobalColor or the new QColor::fromString() instead. Change-Id: I68bf75a094e6821b97682de5a0ffd975834d22d0 Reviewed-by: Allan Sandfeld Jensen --- examples/embedded/flickable/main.cpp | 4 ++-- tests/auto/corelib/io/qsettings/tst_qsettings.cpp | 2 +- tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/embedded/flickable/main.cpp b/examples/embedded/flickable/main.cpp index 139baa6ba7..cb3920d428 100644 --- a/examples/embedded/flickable/main.cpp +++ b/examples/embedded/flickable/main.cpp @@ -101,8 +101,8 @@ public: m_colorNames << (str + " " + c); QStringList duet = c.split(' '); - m_firstColor << duet[0]; - m_secondColor << duet[1]; + m_firstColor << QColor::fromString(duet[0]); + m_secondColor << QColor::fromString(duet[1]); } setAttribute(Qt::WA_OpaquePaintEvent, true); diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp index 820a879d63..c4ede66381 100644 --- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp +++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp @@ -3548,7 +3548,7 @@ void tst_QSettings::rainersSyncBugOnMac() void tst_QSettings::recursionBug() { QPixmap pix(10,10); - pix.fill("blue"); + pix.fill(Qt::blue); { QSettings settings(settingsPath("starrunner.ini"), QSettings::IniFormat); diff --git a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp index a987c06d15..e022b7edbc 100644 --- a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp +++ b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp @@ -2180,7 +2180,7 @@ void tst_QTextEdit::setDocumentPreservesPalette() QPalette defaultPal = ed->palette(); QPalette whitePal = ed->palette(); - whitePal.setColor(QPalette::Active, QPalette::Text, "white"); + whitePal.setColor(QPalette::Active, QPalette::Text, Qt::white); QVERIFY(whitePal != ed->palette());