mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-08-18 13:04:13 +02:00
fix deprecation-warning about "setContent" with qt >= 6.5
This commit is contained in:
@@ -158,11 +158,20 @@ bool EdzPart::parse(const QString &part_xml_path)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
QDomDocument doc;
|
QDomDocument doc;
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 5, 0) // TODO Qt 6.5: remove
|
||||||
QString parse_err;
|
QString parse_err;
|
||||||
int line = 0, col = 0;
|
int line = 0, col = 0;
|
||||||
if (!doc.setContent(&file, &parse_err, &line, &col)) {
|
if (!doc.setContent(&file, &parse_err, &line, &col)) {
|
||||||
m_error = QStringLiteral("Malformed part.xml (line %1): %2")
|
m_error = QStringLiteral("Malformed part.xml (line %1): %2")
|
||||||
.arg(line).arg(parse_err);
|
.arg(line).arg(parse_err);
|
||||||
|
#else
|
||||||
|
const auto result = doc.setContent(&file);
|
||||||
|
if (!result) {
|
||||||
|
m_error = QStringLiteral("Malformed part.xml (line %1, column %2): %3")
|
||||||
|
.arg(result.errorLine)
|
||||||
|
.arg(result.errorColumn)
|
||||||
|
.arg(result.errorMessage);
|
||||||
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
file.close();
|
file.close();
|
||||||
|
|||||||
Reference in New Issue
Block a user