Gui: For Qt 6.5 and later, use ParseOptions in xml
This commit is contained in:
committed by
Chris Hennes
parent
d1c8362076
commit
fc72817079
@@ -480,6 +480,15 @@ void StdCmdFreezeViews::onRestoreViews()
|
||||
}
|
||||
|
||||
QDomDocument xmlDocument;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6,5,0)
|
||||
if (const auto result = xmlDocument.setContent(&file, QDomDocument::ParseOption::UseNamespaceProcessing); !result) {
|
||||
std::cerr << "Parse error in XML content at line " << result.errorLine
|
||||
<< ", column " << result.errorColumn << ": "
|
||||
<< qPrintable(result.errorMessage) << std::endl;
|
||||
return;
|
||||
}
|
||||
#else
|
||||
QString errorStr;
|
||||
int errorLine;
|
||||
int errorColumn;
|
||||
@@ -491,6 +500,7 @@ void StdCmdFreezeViews::onRestoreViews()
|
||||
<< (const char*)errorStr.toLatin1() << std::endl;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
// get the root element
|
||||
QDomElement root = xmlDocument.documentElement();
|
||||
|
||||
@@ -469,6 +469,11 @@ DocumentRecoveryPrivate::XmlConfig DocumentRecoveryPrivate::readXmlFile(const QS
|
||||
if (!file.open(QFile::ReadOnly))
|
||||
return cfg;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6,5,0)
|
||||
if (!domDocument.setContent(&file, QDomDocument::ParseOption::UseNamespaceProcessing)) {
|
||||
return cfg;
|
||||
}
|
||||
#else
|
||||
QString errorStr;
|
||||
int errorLine;
|
||||
int errorColumn;
|
||||
@@ -477,6 +482,7 @@ DocumentRecoveryPrivate::XmlConfig DocumentRecoveryPrivate::readXmlFile(const QS
|
||||
&errorColumn)) {
|
||||
return cfg;
|
||||
}
|
||||
#endif
|
||||
|
||||
QDomElement root = domDocument.documentElement();
|
||||
if (root.tagName() != QLatin1String("AutoRecovery")) {
|
||||
|
||||
Reference in New Issue
Block a user