Removing QColor (from Qt::Widgets) from core modules. (#4247)

This commit is contained in:
louib 2020-01-26 21:38:43 -05:00 committed by Jonathan White
parent 8bac8a7163
commit c8ab3b5f4f
15 changed files with 47 additions and 97 deletions

View file

@ -1047,22 +1047,21 @@ QDateTime KdbxXmlReader::readDateTime()
return Clock::currentDateTimeUtc();
}
QColor KdbxXmlReader::readColor()
QString KdbxXmlReader::readColor()
{
QString colorStr = readString();
if (colorStr.isEmpty()) {
return {};
return colorStr;
}
if (colorStr.length() != 7 || colorStr[0] != '#') {
if (m_strictMode) {
raiseError(tr("Invalid color value"));
}
return {};
return colorStr;
}
QColor color;
for (int i = 0; i <= 2; ++i) {
QString rgbPartStr = colorStr.mid(1 + 2 * i, 2);
bool ok;
@ -1071,19 +1070,11 @@ QColor KdbxXmlReader::readColor()
if (m_strictMode) {
raiseError(tr("Invalid color rgb part"));
}
return {};
}
if (i == 0) {
color.setRed(rgbPart);
} else if (i == 1) {
color.setGreen(rgbPart);
} else {
color.setBlue(rgbPart);
return colorStr;
}
}
return color;
return colorStr;
}
int KdbxXmlReader::readNumber()