diff --git a/avogadro/qtopengl/CMakeLists.txt b/avogadro/qtopengl/CMakeLists.txt index 8d57100ad0..dc74ef102a 100644 --- a/avogadro/qtopengl/CMakeLists.txt +++ b/avogadro/qtopengl/CMakeLists.txt @@ -1,5 +1,5 @@ if(QT_VERSION EQUAL 6) - find_package(Qt6 COMPONENTS Widgets OpenGLWidgets REQUIRED) + find_package(Qt6 REQUIRED COMPONENTS Widgets OpenGLWidgets) else() find_package(Qt5 COMPONENTS Widgets REQUIRED) endif() @@ -19,7 +19,7 @@ target_sources(QtOpenGL PRIVATE ) avogadro_add_library(QtOpenGL) -target_link_libraries(QtOpenGL Avogadro::Rendering Avogadro::QtGui Qt::Widgets) +target_link_libraries(QtOpenGL PUBLIC Avogadro::Rendering Avogadro::QtGui Qt::Widgets) if(QT_VERSION EQUAL 6) - target_link_libraries(QtOpenGL Qt::OpenGLWidgets) + target_link_libraries(QtOpenGL PRIVATE Qt6::OpenGLWidgets) endif() diff --git a/avogadro/qtopengl/glwidget.h b/avogadro/qtopengl/glwidget.h index be600aaba5..c1bb8cf696 100644 --- a/avogadro/qtopengl/glwidget.h +++ b/avogadro/qtopengl/glwidget.h @@ -13,7 +13,12 @@ #include #include + +#if QT_VERSION >= 0x060000 +#include +#else #include +#endif class QTimer; diff --git a/avogadro/qtplugins/aligntool/CMakeLists.txt b/avogadro/qtplugins/aligntool/CMakeLists.txt index 6b579404d9..d4f9e464e8 100644 --- a/avogadro/qtplugins/aligntool/CMakeLists.txt +++ b/avogadro/qtplugins/aligntool/CMakeLists.txt @@ -1,3 +1,9 @@ +if(QT_VERSION EQUAL 6) + find_package(Qt6 COMPONENTS Gui REQUIRED) +else() + find_package(Qt5 COMPONENTS Widgets REQUIRED) +endif() + set(aligntool_srcs aligntool.cpp ) @@ -20,3 +26,9 @@ avogadro_plugin(AlignTool ) target_link_libraries(AlignTool PRIVATE Avogadro::QtOpenGL) + +if(QT_VERSION EQUAL 6) + target_link_libraries(AlignTool PRIVATE Qt6::Gui) +else() + target_link_libraries(AlignTool PRIVATE Qt5::Widgets) +endif() diff --git a/avogadro/qtplugins/coordinateeditor/coordinateeditordialog.cpp b/avogadro/qtplugins/coordinateeditor/coordinateeditordialog.cpp index f73260d420..7928ce451a 100644 --- a/avogadro/qtplugins/coordinateeditor/coordinateeditordialog.cpp +++ b/avogadro/qtplugins/coordinateeditor/coordinateeditordialog.cpp @@ -675,7 +675,7 @@ QString CoordinateEditorDialog::detectInputFormat() const FORMAT_DEBUG(qDebug() << "\n\nExamining sample:" << sample;) // Split the string into tokens, and identify the type of each. - QList tokens(sample.split(TOKEN_SEPARATOR, QString::SkipEmptyParts)); + QList tokens(sample.split(TOKEN_SEPARATOR, Qt::SkipEmptyParts)); QList tokenTypes; tokenTypes.reserve(tokens.size()); size_t tokenTypeCounts[3] = { 0, 0, 0 }; diff --git a/avogadro/qtplugins/forcefield/CMakeLists.txt b/avogadro/qtplugins/forcefield/CMakeLists.txt index 0ffd8de432..cbd6fb14a6 100644 --- a/avogadro/qtplugins/forcefield/CMakeLists.txt +++ b/avogadro/qtplugins/forcefield/CMakeLists.txt @@ -1,3 +1,9 @@ +if(QT_VERSION EQUAL 6) + find_package(Qt6 COMPONENTS Gui REQUIRED) +else() + find_package(Qt5 COMPONENTS Widgets REQUIRED) +endif() + set(forcefield_srcs forcefield.cpp forcefielddialog.cpp @@ -28,6 +34,12 @@ avogadro_plugin(Forcefield target_link_libraries(Forcefield PRIVATE Avogadro::Calc) +if(QT_VERSION EQUAL 6) + target_link_libraries(Forcefield PRIVATE Qt6::Gui) +else() + target_link_libraries(Forcefield PRIVATE Qt5::Widgets) +endif() + if (BUILD_GPL_PLUGINS AND OpenBabel3_LIBRARY) target_link_libraries(Forcefield PRIVATE OpenBabel3) endif() diff --git a/avogadro/qtplugins/forcefield/obmmenergy.cpp b/avogadro/qtplugins/forcefield/obmmenergy.cpp index 594dba9f80..41bae1977f 100644 --- a/avogadro/qtplugins/forcefield/obmmenergy.cpp +++ b/avogadro/qtplugins/forcefield/obmmenergy.cpp @@ -224,8 +224,9 @@ Real OBMMEnergy::value(const Eigen::VectorXd& x) input = "coord\n"; for (Index i = 0; i < x.size(); i += 3) { // write as x y z (space separated) - input += QString::number(x[i]) + " " + QString::number(x[i + 1]) + " " + - QString::number(x[i + 2]) + "\n"; + input += QString::number(x[i]).toUtf8() + " " + + QString::number(x[i + 1]).toUtf8() + " " + + QString::number(x[i + 2]).toUtf8() + "\n"; } result = writeAndRead(input); @@ -257,8 +258,9 @@ void OBMMEnergy::gradient(const Eigen::VectorXd& x, Eigen::VectorXd& grad) QByteArray result, input = "coord\n"; for (Index i = 0; i < x.size(); i += 3) { // write as x y z (space separated) - input += QString::number(x[i]) + " " + QString::number(x[i + 1]) + " " + - QString::number(x[i + 2]) + "\n"; + input += QString::number(x[i]).toUtf8() + " " + + QString::number(x[i + 1]).toUtf8() + " " + + QString::number(x[i + 2]).toUtf8() + "\n"; } result = writeAndRead(input); diff --git a/avogadro/qtplugins/forcefield/scriptenergy.cpp b/avogadro/qtplugins/forcefield/scriptenergy.cpp index f7bc5c7e9f..6d9925caf3 100644 --- a/avogadro/qtplugins/forcefield/scriptenergy.cpp +++ b/avogadro/qtplugins/forcefield/scriptenergy.cpp @@ -19,6 +19,8 @@ #include #include +#include + #include #include #include @@ -115,8 +117,9 @@ Real ScriptEnergy::value(const Eigen::VectorXd& x) QByteArray input; for (Index i = 0; i < x.size(); i += 3) { // write as x y z (space separated) - input += QString::number(x[i]) + " " + QString::number(x[i + 1]) + " " + - QString::number(x[i + 2]) + "\n"; + input += QString::number(x[i]).toUtf8() + " " + + QString::number(x[i + 1]).toUtf8() + " " + + QString::number(x[i + 2]).toUtf8() + "\n"; } QByteArray result = m_interpreter->asyncWriteAndResponse(input); @@ -125,7 +128,7 @@ Real ScriptEnergy::value(const Eigen::VectorXd& x) double energy = 0.0; for (auto line : lines) { if (line.startsWith("AvogadroEnergy:")) { - QStringList items = line.split(" ", QString::SkipEmptyParts); + QStringList items = line.split(" ", Qt::SkipEmptyParts); if (items.size() > 1) { energy = items[1].toDouble(); break; @@ -148,8 +151,9 @@ void ScriptEnergy::gradient(const Eigen::VectorXd& x, Eigen::VectorXd& grad) QByteArray input; for (Index i = 0; i < x.size(); i += 3) { // write as x y z (space separated) - input += QString::number(x[i]) + " " + QString::number(x[i + 1]) + " " + - QString::number(x[i + 2]) + "\n"; + input += QString::number(x[i]).toUtf8() + " " + + QString::number(x[i + 1]).toUtf8() + " " + + QString::number(x[i + 2]).toUtf8() + "\n"; } QByteArray result = m_interpreter->asyncWriteAndResponse(input); @@ -165,7 +169,7 @@ void ScriptEnergy::gradient(const Eigen::VectorXd& x, Eigen::VectorXd& grad) } if (readingGrad) { - QStringList items = line.split(" ", QString::SkipEmptyParts); + QStringList items = line.split(" ", Qt::SkipEmptyParts); if (items.size() == 3) { grad[i] = items[0].toDouble(); grad[i + 1] = items[1].toDouble(); @@ -365,7 +369,8 @@ void ScriptEnergy::processElementString(const QString& str) QString str2(str); str2.replace(',', ' '); // then split on whitespace - QStringList strList = str2.split(QRegExp("\\s+"), QString::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('-')) { diff --git a/avogadro/qtplugins/label/CMakeLists.txt b/avogadro/qtplugins/label/CMakeLists.txt index 8b666cbc51..97bd0cdf7a 100644 --- a/avogadro/qtplugins/label/CMakeLists.txt +++ b/avogadro/qtplugins/label/CMakeLists.txt @@ -25,4 +25,12 @@ avogadro_plugin(LabelEditor ) target_link_libraries(Label LINK_PRIVATE Avogadro::Rendering) -target_link_libraries(LabelEditor LINK_PRIVATE Avogadro::QtOpenGL) \ No newline at end of file +target_link_libraries(LabelEditor + LINK_PRIVATE + Avogadro::Rendering + Avogadro::QtOpenGL) + +target_include_directories(LabelEditor + PRIVATE + ${CMAKE_CURRENT_BINARY_DIR}/../../rendering + ${CMAKE_CURRENT_BINARY_DIR}/../../qtopengl) diff --git a/avogadro/qtplugins/playertool/CMakeLists.txt b/avogadro/qtplugins/playertool/CMakeLists.txt index f0df58510e..a9c5cccb26 100644 --- a/avogadro/qtplugins/playertool/CMakeLists.txt +++ b/avogadro/qtplugins/playertool/CMakeLists.txt @@ -1,3 +1,10 @@ +if(QT_VERSION EQUAL 6) + find_package(Qt6 + REQUIRED COMPONENTS + OpenGL + OpenGLWidgets) +endif() + avogadro_plugin(PlayerTool "Player tool" ToolPlugin @@ -13,3 +20,10 @@ target_link_libraries(PlayerTool gwavi gif-h Avogadro::QtOpenGL) + +if(QT_VERSION EQUAL 6) + target_link_libraries(PlayerTool + PRIVATE + Qt6::OpenGL + Qt6::OpenGLWidgets) +endif() diff --git a/avogadro/qtplugins/qtaim/qtaimwavefunction.cpp b/avogadro/qtplugins/qtaim/qtaimwavefunction.cpp index 76350805a3..8500f71c13 100644 --- a/avogadro/qtplugins/qtaim/qtaimwavefunction.cpp +++ b/avogadro/qtplugins/qtaim/qtaimwavefunction.cpp @@ -134,7 +134,7 @@ bool QTAIMWavefunction::initializeWithWFNFile(const QString& fileName) while (fileContentsByLine.first().startsWith("TYPE ASSIGNMENTS")) { QString line(fileContentsByLine.first().mid(20, -1)); - QStringList splitLine(line.split(" ", QString::SkipEmptyParts)); + QStringList splitLine(line.split(" ", Qt::SkipEmptyParts)); for (qint64 i = 0; i < splitLine.length(); ++i) { typeAssignmentsList.append(splitLine.at(i).toLongLong()); @@ -261,7 +261,7 @@ bool QTAIMWavefunction::initializeWithWFNFile(const QString& fileName) while (fileContentsByLine.first().startsWith("EXPONENTS")) { QString line(fileContentsByLine.first().mid(9, -1)); - QStringList splitLine(line.split(" ", QString::SkipEmptyParts)); + QStringList splitLine(line.split(" ", Qt::SkipEmptyParts)); for (qint64 i = 0; i < splitLine.length(); ++i) { QString str(splitLine.at(i)); @@ -324,7 +324,7 @@ bool QTAIMWavefunction::initializeWithWFNFile(const QString& fileName) m_molecularOrbitalEigenvalues[i] = molecularOrbitalEigenvaluesList.at(i); moCoefficientsStringList = - moCoefficientsStringList.join(" ").split(" ", QString::SkipEmptyParts); + moCoefficientsStringList.join(" ").split(" ", Qt::SkipEmptyParts); for (qint64 i = 0; i < moCoefficientsStringList.length(); ++i) { QString str(moCoefficientsStringList.at(i)); diff --git a/avogadro/qtplugins/resetview/CMakeLists.txt b/avogadro/qtplugins/resetview/CMakeLists.txt index 9da8631992..ab6a89d264 100644 --- a/avogadro/qtplugins/resetview/CMakeLists.txt +++ b/avogadro/qtplugins/resetview/CMakeLists.txt @@ -1,3 +1,7 @@ +if(QT_VERSION EQUAL 6) + find_package(Qt6 REQUIRED COMPONENTS OpenGLWidgets) +endif() + avogadro_plugin(ResetView "Manipulate the view camera." ExtensionPlugin @@ -8,3 +12,9 @@ avogadro_plugin(ResetView ) target_link_libraries(ResetView PRIVATE Avogadro::QtOpenGL) + +if(QT_VERSION EQUAL 6) + target_link_libraries(ResetView + PRIVATE + Qt6::OpenGLWidgets) +endif() diff --git a/avogadro/qtplugins/scriptcharges/scriptchargemodel.cpp b/avogadro/qtplugins/scriptcharges/scriptchargemodel.cpp index 5fa58a1a6c..831fe24fe5 100644 --- a/avogadro/qtplugins/scriptcharges/scriptchargemodel.cpp +++ b/avogadro/qtplugins/scriptcharges/scriptchargemodel.cpp @@ -357,7 +357,7 @@ void ScriptChargeModel::processElementString(const QString& str) QString str2(str); str2.replace(',', ' '); // then split on whitespace - QStringList strList = str2.split(QRegExp("\\s+"), QString::SkipEmptyParts); + QStringList strList = str2.split(QRegExp("\\s+"), Qt::SkipEmptyParts); foreach (QString sstr, strList) { // these should be numbers or ranges (e.g., 1-84) if (sstr.contains('-')) { diff --git a/avogadro/qtplugins/surfaces/CMakeLists.txt b/avogadro/qtplugins/surfaces/CMakeLists.txt index b4235c97ab..256a65e45d 100644 --- a/avogadro/qtplugins/surfaces/CMakeLists.txt +++ b/avogadro/qtplugins/surfaces/CMakeLists.txt @@ -1,3 +1,7 @@ +if(QT_VERSION EQUAL 6) + find_package(Qt6 REQUIRED COMPONENTS OpenGL) +endif() + set(surfaces_srcs gaussiansetconcurrent.cpp slatersetconcurrent.cpp @@ -23,3 +27,9 @@ target_link_libraries(Surfaces gif-h gwavi tinycolormap) + +if(QT_VERSION EQUAL 6) + target_link_libraries(Surfaces + PRIVATE + Qt6::OpenGL) +endif() diff --git a/avogadro/quantumio/gamessukout.cpp b/avogadro/quantumio/gamessukout.cpp index dcb6b1d098..c49eb4e95a 100644 --- a/avogadro/quantumio/gamessukout.cpp +++ b/avogadro/quantumio/gamessukout.cpp @@ -43,7 +43,7 @@ bool tokenize(std::vector& vcr, const char* buf, splitString += QString(delimstr); splitString += QString("]"); QRegExp splitter(splitString); - foreach (const QString& str, tmp.split(splitter, QString::SkipEmptyParts)) + foreach (const QString& str, tmp.split(splitter, Qt::SkipEmptyParts)) vcr.push_back(str.toStdString()); return true;