From e68e34095057a9d7d7aedbaf8ad9773913aa4794 Mon Sep 17 00:00:00 2001 From: ctrlaltca Date: Sun, 24 Mar 2024 11:39:46 +0100 Subject: More qt6 porting (#2622) * Port QColor::setNamedColor to QColor::fromString * Port from QVariant::Type to QmetaType::Type * KviCoreActions: port from QAction::parentWidget to qobject_cast + QAction::parent * KviIrcView: port QString::fromUtf16 usage to the non-obsolete char16_t* overload * KviTopicWidget: port QMouseEvent to a non-obsolete overload * Port QMouseEvent from old pos(), x(), y(), to position() * Port obsolete QMessageBox usage to custom buttons * KviApplication: initialize the dbus notify message "replace ID" to 0 * KviIrcConnection: port deprecated QString::count() to QString::size() * KvsObject_*: port QColor::setNamedColor to QColor::fromString * KvsObject_widget: port QWidget::isTopLevel to QWidget::isWindow * KviMainWindow: use QKeyCombination instead of int for shortcuts * QHttp: avoid deprecated methods for QCryptographicHash * ScriptEditorWidget: use the new signature for QMenu::addAction() * KviInputEditor: Extract ACCEL_KEY from header and avoid warning * KviStringConversion: convert old Qt5 font weights to new "css" font weights * syntax fix--- src/modules/objects/KvsObject_tableWidget.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/modules/objects/KvsObject_tableWidget.cpp') diff --git a/src/modules/objects/KvsObject_tableWidget.cpp b/src/modules/objects/KvsObject_tableWidget.cpp index f1e15edc5..a462db55b 100644 --- a/src/modules/objects/KvsObject_tableWidget.cpp +++ b/src/modules/objects/KvsObject_tableWidget.cpp @@ -336,11 +336,19 @@ KVSO_CLASS_FUNCTION(tableWidget, setForeground) QString szColor; pColArray->asString(szColor); // maybe a color name? +#if (QT_VERSION < QT_VERSION_CHECK(6, 4, 0)) color.setNamedColor(szColor); +#else + color = QColor::fromString(szColor); +#endif if(!color.isValid()) { // isn't a color name: lets try with an hex triplet +#if (QT_VERSION < QT_VERSION_CHECK(6, 4, 0)) color.setNamedColor("#" + szColor); +#else + color = QColor::fromString("#" + szColor); +#endif if(!color.isValid()) { c->warning(__tr2qs_ctx("Not a valid color!", "objects")); -- cgit v1.3.1-10-gc9f91