mirror of
https://github.com/QtExcel/QXlsx.git
synced 2025-01-30 05:02:52 +08:00
Port away from deprecated API in Qt 6.6: QColor::setNamedColor
The replacement, QColor::fromString() exists since Qt 6.4.
This commit is contained in:
parent
12ff98db76
commit
db36c652ed
@ -147,7 +147,7 @@ target_compile_definitions(QXlsx PRIVATE
|
|||||||
QT_USE_QSTRINGBUILDER
|
QT_USE_QSTRINGBUILDER
|
||||||
QT_NO_SIGNALS_SLOTS_KEYWORDS
|
QT_NO_SIGNALS_SLOTS_KEYWORDS
|
||||||
QT_USE_FAST_OPERATOR_PLUS
|
QT_USE_FAST_OPERATOR_PLUS
|
||||||
QT_DISABLE_DEPRECATED_BEFORE=0x060200
|
QT_DISABLE_DEPRECATED_BEFORE=0x060600
|
||||||
)
|
)
|
||||||
|
|
||||||
if (NOT WIN32)
|
if (NOT WIN32)
|
||||||
|
@ -116,6 +116,13 @@ XlsxColor::operator QVariant() const
|
|||||||
|
|
||||||
QColor XlsxColor::fromARGBString(const QString &c)
|
QColor XlsxColor::fromARGBString(const QString &c)
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
|
||||||
|
if (c.startsWith(u'#')) {
|
||||||
|
return QColor::fromString(c);
|
||||||
|
} else {
|
||||||
|
return QColor::fromString(QLatin1Char('#') + c);
|
||||||
|
}
|
||||||
|
#else
|
||||||
QColor color;
|
QColor color;
|
||||||
if (c.startsWith(u'#')) {
|
if (c.startsWith(u'#')) {
|
||||||
color.setNamedColor(c);
|
color.setNamedColor(c);
|
||||||
@ -123,6 +130,7 @@ QColor XlsxColor::fromARGBString(const QString &c)
|
|||||||
color.setNamedColor(QLatin1Char('#') + c);
|
color.setNamedColor(QLatin1Char('#') + c);
|
||||||
}
|
}
|
||||||
return color;
|
return color;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QString XlsxColor::toARGBString(const QColor &c)
|
QString XlsxColor::toARGBString(const QColor &c)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user