Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port away from deprecated API in Qt 6.6: QColor::setNamedColor #337

Merged
merged 1 commit into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion QXlsx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ target_compile_definitions(QXlsx PRIVATE
QT_USE_QSTRINGBUILDER
QT_NO_SIGNALS_SLOTS_KEYWORDS
QT_USE_FAST_OPERATOR_PLUS
QT_DISABLE_DEPRECATED_BEFORE=0x060200
QT_DISABLE_DEPRECATED_BEFORE=0x060600
)

if (NOT WIN32)
Expand Down
8 changes: 8 additions & 0 deletions QXlsx/source/xlsxcolor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,21 @@ XlsxColor::operator QVariant() const

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;
if (c.startsWith(u'#')) {
color.setNamedColor(c);
} else {
color.setNamedColor(QLatin1Char('#') + c);
}
return color;
#endif
}

QString XlsxColor::toARGBString(const QColor &c)
Expand Down
Loading