diff --git a/avogadro/qtopengl/CMakeLists.txt b/avogadro/qtopengl/CMakeLists.txt index 8d57100ad0..b1286d779a 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 PRIVATE 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..a4a10bf289 100644 --- a/avogadro/qtopengl/glwidget.h +++ b/avogadro/qtopengl/glwidget.h @@ -13,7 +13,12 @@ #include #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..b2755fd950 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 ) @@ -19,4 +25,14 @@ avogadro_plugin(AlignTool "${aligntool_rcs}" ) -target_link_libraries(AlignTool PRIVATE Avogadro::QtOpenGL) +target_link_libraries(AlignTool PRIVATE Avogadro::Rendering Avogadro::QtOpenGL) + +if(QT_VERSION EQUAL 6) + target_link_libraries(AlignTool PRIVATE Qt6::Gui) +else() + target_link_libraries(AlignTool PRIVATE Qt5::Widgets) +endif() + +target_include_directories(AlignTool + PRIVATE + ${CMAKE_CURRENT_BINARY_DIR}/../../rendering) diff --git a/avogadro/qtplugins/bondcentrictool/CMakeLists.txt b/avogadro/qtplugins/bondcentrictool/CMakeLists.txt index 32a4a52395..d3fd00af8b 100644 --- a/avogadro/qtplugins/bondcentrictool/CMakeLists.txt +++ b/avogadro/qtplugins/bondcentrictool/CMakeLists.txt @@ -19,4 +19,12 @@ avogadro_plugin(BondCentric "${bondcentrictool_rcs}" ) -target_link_libraries(BondCentric PRIVATE Avogadro::QtOpenGL) +target_link_libraries(BondCentric + PRIVATE + Avogadro::Rendering + Avogadro::QtOpenGL) + +target_include_directories(BondCentric + PRIVATE + ${CMAKE_CURRENT_BINARY_DIR}/../../rendering + ${CMAKE_CURRENT_BINARY_DIR}/../../qtopengl) 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/editor/CMakeLists.txt b/avogadro/qtplugins/editor/CMakeLists.txt index 5275780d73..96bb9e535f 100644 --- a/avogadro/qtplugins/editor/CMakeLists.txt +++ b/avogadro/qtplugins/editor/CMakeLists.txt @@ -21,4 +21,9 @@ avogadro_plugin(Editor "${editor_rcs}" ) -target_link_libraries(Editor PRIVATE Avogadro::QtOpenGL) +target_link_libraries(Editor PRIVATE Avogadro::Rendering Avogadro::QtOpenGL) + +target_include_directories(Editor + PRIVATE + ${CMAKE_CURRENT_BINARY_DIR}/../../rendering + ${CMAKE_CURRENT_BINARY_DIR}/../../qtopengl) diff --git a/avogadro/qtplugins/focus/CMakeLists.txt b/avogadro/qtplugins/focus/CMakeLists.txt index 7790544f3b..c22684c044 100644 --- a/avogadro/qtplugins/focus/CMakeLists.txt +++ b/avogadro/qtplugins/focus/CMakeLists.txt @@ -7,4 +7,9 @@ avogadro_plugin(Focus "" ) -target_link_libraries(Focus PRIVATE Avogadro::QtOpenGL) +target_link_libraries(Focus PRIVATE Avogadro::Rendering Avogadro::QtOpenGL) + +target_include_directories(Focus + PRIVATE + ${CMAKE_CURRENT_BINARY_DIR}/../../rendering + ${CMAKE_CURRENT_BINARY_DIR}/../../qtopengl) 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..057e3d8efd 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,7 @@ 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/manipulator/CMakeLists.txt b/avogadro/qtplugins/manipulator/CMakeLists.txt index 46a62e06ab..8ef16bb00a 100644 --- a/avogadro/qtplugins/manipulator/CMakeLists.txt +++ b/avogadro/qtplugins/manipulator/CMakeLists.txt @@ -20,4 +20,12 @@ avogadro_plugin(Manipulator "${manipulator_rcs}" ) -target_link_libraries(Manipulator PRIVATE Avogadro::QtOpenGL) +target_link_libraries(Manipulator + PRIVATE + Avogadro::Rendering + Avogadro::QtOpenGL) + +target_include_directories(Manipulator + PRIVATE + ${CMAKE_CURRENT_BINARY_DIR}/../../rendering + ${CMAKE_CURRENT_BINARY_DIR}/../../qtopengl) diff --git a/avogadro/qtplugins/measuretool/CMakeLists.txt b/avogadro/qtplugins/measuretool/CMakeLists.txt index de2ad45da3..bd835b89bb 100644 --- a/avogadro/qtplugins/measuretool/CMakeLists.txt +++ b/avogadro/qtplugins/measuretool/CMakeLists.txt @@ -19,4 +19,9 @@ avogadro_plugin(MeasureTool "${measuretool_rcs}" ) -target_link_libraries(MeasureTool PRIVATE Avogadro::QtOpenGL) +target_link_libraries(MeasureTool PRIVATE Avogadro::Rendering Avogadro::QtOpenGL) + +target_include_directories(MeasureTool + PRIVATE + ${CMAKE_CURRENT_BINARY_DIR}/../../rendering + ${CMAKE_CURRENT_BINARY_DIR}/../../qtopengl) diff --git a/avogadro/qtplugins/navigator/CMakeLists.txt b/avogadro/qtplugins/navigator/CMakeLists.txt index 79e9b9a487..6c24a97fbf 100644 --- a/avogadro/qtplugins/navigator/CMakeLists.txt +++ b/avogadro/qtplugins/navigator/CMakeLists.txt @@ -19,4 +19,9 @@ avogadro_plugin(Navigator "${navigator_rcs}" ) -target_link_libraries(Navigator PRIVATE Avogadro::QtOpenGL) +target_link_libraries(Navigator PRIVATE Avogadro::Rendering Avogadro::QtOpenGL) + +target_include_directories(Navigator + 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..166100c2cb 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 @@ -12,4 +19,17 @@ target_link_libraries(PlayerTool PRIVATE gwavi gif-h + Avogadro::Rendering Avogadro::QtOpenGL) + +if(QT_VERSION EQUAL 6) + target_link_libraries(PlayerTool + PRIVATE + Qt6::OpenGL + Qt6::OpenGLWidgets) +endif() + +target_include_directories(PlayerTool + PRIVATE + ${CMAKE_CURRENT_BINARY_DIR}/../../rendering + ${CMAKE_CURRENT_BINARY_DIR}/../../qtopengl) 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..e5d8587b3b 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 @@ -7,4 +11,15 @@ avogadro_plugin(ResetView "" ) -target_link_libraries(ResetView PRIVATE Avogadro::QtOpenGL) +target_link_libraries(ResetView PRIVATE Avogadro::Rendering Avogadro::QtOpenGL) + +if(QT_VERSION EQUAL 6) + target_link_libraries(ResetView + PRIVATE + Qt6::OpenGLWidgets) +endif() + +target_include_directories(ResetView + PRIVATE + ${CMAKE_CURRENT_BINARY_DIR}/../../rendering + ${CMAKE_CURRENT_BINARY_DIR}/../../qtopengl) 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/selectiontool/CMakeLists.txt b/avogadro/qtplugins/selectiontool/CMakeLists.txt index 282ef8f453..1ac658281d 100644 --- a/avogadro/qtplugins/selectiontool/CMakeLists.txt +++ b/avogadro/qtplugins/selectiontool/CMakeLists.txt @@ -19,4 +19,9 @@ avogadro_plugin(Selection "${tool_rcs}" ) -target_link_libraries(Selection PRIVATE Avogadro::QtOpenGL) +target_link_libraries(Selection PRIVATE Avogadro::Rendering Avogadro::QtOpenGL) + +target_include_directories(Selection + PRIVATE + ${CMAKE_CURRENT_BINARY_DIR}/../../rendering + ${CMAKE_CURRENT_BINARY_DIR}/../../qtopengl) diff --git a/avogadro/qtplugins/surfaces/CMakeLists.txt b/avogadro/qtplugins/surfaces/CMakeLists.txt index b4235c97ab..300604d140 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 @@ -19,7 +23,19 @@ target_link_libraries(Surfaces Avogadro::Calc Avogadro::QuantumIO Avogadro::QtOpenGL + Avogadro::Rendering Qt::Concurrent gif-h gwavi tinycolormap) + +if(QT_VERSION EQUAL 6) + target_link_libraries(Surfaces + PRIVATE + Qt6::OpenGL) +endif() + +target_include_directories(Surfaces + PRIVATE + ${CMAKE_CURRENT_BINARY_DIR}/../../rendering + ${CMAKE_CURRENT_BINARY_DIR}/../../qtopengl) diff --git a/avogadro/qtplugins/svg/CMakeLists.txt b/avogadro/qtplugins/svg/CMakeLists.txt index d3f8c668a3..2904778d82 100644 --- a/avogadro/qtplugins/svg/CMakeLists.txt +++ b/avogadro/qtplugins/svg/CMakeLists.txt @@ -10,3 +10,7 @@ avogadro_plugin(SVG ) target_link_libraries(SVG PRIVATE Avogadro::QtOpenGL Qt::Svg) + +target_include_directories(SVG + PRIVATE + ${CMAKE_CURRENT_BINARY_DIR}/../../rendering) diff --git a/avogadro/qtplugins/templatetool/CMakeLists.txt b/avogadro/qtplugins/templatetool/CMakeLists.txt index 3f68e6dd79..f06f71b44a 100644 --- a/avogadro/qtplugins/templatetool/CMakeLists.txt +++ b/avogadro/qtplugins/templatetool/CMakeLists.txt @@ -45,4 +45,9 @@ install(DIRECTORY "${AvogadroLibs_SOURCE_DIR}/../fragments" PATTERN ".git" EXCLUDE ) -target_link_libraries(TemplateTool LINK_PRIVATE Avogadro::QtOpenGL) +target_link_libraries(TemplateTool LINK_PRIVATE Avogadro::QtOpenGL Avogadro::Rendering) + +target_include_directories(TemplateTool + PRIVATE + ${CMAKE_CURRENT_BINARY_DIR}/../../rendering + ${CMAKE_CURRENT_BINARY_DIR}/../../qtopengl) 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;