Skip to content

Commit

Permalink
Minor tweaks to use QRegularExpression for Qt6 support
Browse files Browse the repository at this point in the history
Signed-off-by: Geoff Hutchison <[email protected]>
  • Loading branch information
ghutchis committed Oct 19, 2024
1 parent 69817c3 commit 0b02b7c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
1 change: 0 additions & 1 deletion avogadro/qtgui/filebrowsewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

#include <QFileInfo>
#include <QProcessEnvironment>
#include <QRegExp>

namespace Avogadro::QtGui {

Expand Down
8 changes: 4 additions & 4 deletions avogadro/qtplugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,13 @@ add_subdirectory(focus)
add_subdirectory(hydrogens)
add_subdirectory(importpqr)
add_subdirectory(insertdna)
add_subdirectory(insertfragment)
add_subdirectory(label)
add_subdirectory(lammpsinput)
add_subdirectory(lineformatinput)
add_subdirectory(manipulator)
add_subdirectory(measuretool)
add_subdirectory(molecularproperties)
add_subdirectory(navigator)
add_subdirectory(networkdatabases)
add_subdirectory(openbabel)
Expand All @@ -143,9 +145,7 @@ if(QT_VERSION EQUAL 5)
add_subdirectory(cp2kinput)
add_subdirectory(forcefield)
add_subdirectory(gamessinput)
add_subdirectory(insertfragment)
add_subdirectory(molecularproperties)
# The SVG library is not available in Qt 6
# The SVG library changed in Qt6
add_subdirectory(svg)
endif()

Expand All @@ -166,8 +166,8 @@ if(QT_VERSION EQUAL 5)
# QRegExp fixes needed in classes these depend on
add_subdirectory(commandscripts)
add_subdirectory(quantuminput)
add_subdirectory(scriptcharges)
endif()
add_subdirectory(scriptcharges)
add_subdirectory(scriptfileformats)

if(USE_LIBARCHIVE)
Expand Down
9 changes: 5 additions & 4 deletions avogadro/qtplugins/scriptcharges/scriptchargemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ Core::Array<double> ScriptChargeModel::potentials(
QJsonObject json;
json[m_formatString] = QString::fromStdString(intermediate);
QJsonArray pointsArray;
for (const auto & i : points) {
for (const auto& i : points) {
QJsonArray point;
point << i.x() << i.y() << i.z();
pointsArray.append(point);
Expand Down Expand Up @@ -357,7 +357,8 @@ void ScriptChargeModel::processElementString(const QString& str)
QString str2(str);
str2.replace(',', ' ');
// then split on whitespace
QStringList strList = str2.split(QRegExp("\\s+"), Qt::SkipEmptyParts);
QStringList strList =
str2.split(QRegularExpression("\\s+"), Qt::SkipEmptyParts);
foreach (QString sstr, strList) {
// these should be numbers or ranges (e.g., 1-84)
if (sstr.contains('-')) {
Expand Down Expand Up @@ -398,7 +399,7 @@ bool ScriptChargeModel::parseElements(const QJsonObject& ob)

} else if (ob["elements"].isArray()) {
QJsonArray arr = ob["elements"].toArray();
for (auto && i : arr) {
for (auto&& i : arr) {
if (i.isString()) {
processElementString(i.toString());
} else if (i.isDouble()) {
Expand All @@ -411,4 +412,4 @@ bool ScriptChargeModel::parseElements(const QJsonObject& ob)
return true;
}

} // namespace Avogadro
} // namespace Avogadro::QtPlugins

0 comments on commit 0b02b7c

Please sign in to comment.