diff --git a/avogadro/calc/lennardjones.cpp b/avogadro/calc/lennardjones.cpp index da7f6cfa25..383a05dbcf 100644 --- a/avogadro/calc/lennardjones.cpp +++ b/avogadro/calc/lennardjones.cpp @@ -12,8 +12,8 @@ namespace Avogadro::Calc { LennardJones::LennardJones() - : m_vdw(true), m_depth(100.0), m_exponent(6), m_cell(nullptr), - m_molecule(nullptr) + : m_molecule(nullptr), m_cell(nullptr), m_vdw(true), m_depth(100.0), + m_exponent(6) { // defined for 1-118 for (unsigned int i = 1; i <= 118; ++i) { diff --git a/avogadro/core/mesh.cpp b/avogadro/core/mesh.cpp index 6f6ad8089d..196610b09c 100644 --- a/avogadro/core/mesh.cpp +++ b/avogadro/core/mesh.cpp @@ -19,9 +19,9 @@ Mesh::Mesh() : m_stable(true), m_other(0), m_cube(0), m_lock(new Mutex) Mesh::Mesh(const Mesh& other) : m_vertices(other.m_vertices), m_normals(other.m_normals), - m_colors(other.m_colors), m_name(other.m_name), m_stable(true), - m_isoValue(other.m_isoValue), m_other(other.m_other), m_cube(other.m_cube), - m_lock(new Mutex), m_triangles(other.m_triangles) + m_colors(other.m_colors), m_triangles(other.m_triangles), + m_name(other.m_name), m_stable(true), m_isoValue(other.m_isoValue), + m_other(other.m_other), m_cube(other.m_cube), m_lock(new Mutex) { } @@ -60,7 +60,6 @@ const Vector3f* Mesh::vertex(int n) const return &(m_vertices[n * 3]); } - bool Mesh::setTriangles(const Core::Array& values) { m_triangles.clear(); @@ -68,12 +67,11 @@ bool Mesh::setTriangles(const Core::Array& values) return true; } -const Core::Array&Mesh::triangles() const +const Core::Array& Mesh::triangles() const { return m_triangles; } - bool Mesh::setVertices(const Core::Array& values) { m_vertices.clear(); @@ -86,7 +84,7 @@ bool Mesh::addVertices(const Core::Array& values) if (m_vertices.capacity() < m_vertices.size() + values.size()) m_vertices.reserve(m_vertices.capacity() * 2); if (values.size() % 3 == 0) { - for (const auto & value : values) + for (const auto& value : values) m_vertices.push_back(value); return true; } else { @@ -116,7 +114,7 @@ bool Mesh::addNormals(const Core::Array& values) if (m_normals.capacity() < m_normals.size() + values.size()) m_normals.reserve(m_normals.capacity() * 2); if (values.size() % 3 == 0) { - for (const auto & value : values) + for (const auto& value : values) m_normals.push_back(value); return true; } else { @@ -184,7 +182,8 @@ Mesh& Mesh::operator=(const Mesh& other) return *this; } -void Mesh::smooth(int iterationCount) { +void Mesh::smooth(int iterationCount) +{ if (m_vertices.empty() || iterationCount <= 0) return; @@ -206,10 +205,10 @@ void Mesh::smooth(int iterationCount) { // Remove duplicate neighbors and sort for faster lookups later (if needed) for (auto& neighbors : adjacencyList) { std::sort(neighbors.begin(), neighbors.end()); - neighbors.erase(std::unique(neighbors.begin(), neighbors.end()), neighbors.end()); + neighbors.erase(std::unique(neighbors.begin(), neighbors.end()), + neighbors.end()); } - float weight = 1.0f; for (int iteration = 0; iteration < iterationCount; ++iteration) { Array newVertices = m_vertices; // Store smoothed vertices @@ -229,7 +228,6 @@ void Mesh::smooth(int iterationCount) { m_vertices = newVertices; // Update vertices after processing all } - m_normals.clear(); m_normals.resize(m_vertices.size(), Vector3f(0.0f, 0.0f, 0.0f)); @@ -246,8 +244,7 @@ void Mesh::smooth(int iterationCount) { m_normals[i] += triangleNormal; m_normals[j] += triangleNormal; m_normals[k] += triangleNormal; - - } + } for (auto& normal : m_normals) { normal.normalize(); diff --git a/avogadro/core/molecule.cpp b/avogadro/core/molecule.cpp index eed67bf9c5..7c271e336e 100644 --- a/avogadro/core/molecule.cpp +++ b/avogadro/core/molecule.cpp @@ -46,9 +46,8 @@ Molecule::Molecule(const Molecule& other) m_basisSet(other.m_basisSet ? other.m_basisSet->clone() : nullptr), m_unitCell(other.m_unitCell ? new UnitCell(*other.m_unitCell) : nullptr), m_residues(other.m_residues), m_hallNumber(other.m_hallNumber), - m_graph(other.m_graph), m_bondOrders(other.m_bondOrders), - m_atomicNumbers(other.m_atomicNumbers), - m_frozenAtomMask(other.m_frozenAtomMask), + m_frozenAtomMask(other.m_frozenAtomMask), m_graph(other.m_graph), + m_bondOrders(other.m_bondOrders), m_atomicNumbers(other.m_atomicNumbers), m_layers(LayerManager::getMoleculeLayer(this)) { // Copy over any meshes @@ -142,9 +141,8 @@ Molecule::Molecule(Molecule&& other) noexcept m_selectedAtoms(std::move(other.m_selectedAtoms)), m_meshes(std::move(other.m_meshes)), m_cubes(std::move(other.m_cubes)), m_residues(other.m_residues), m_hallNumber(other.m_hallNumber), - m_graph(other.m_graph), m_bondOrders(other.m_bondOrders), - m_atomicNumbers(other.m_atomicNumbers), - m_frozenAtomMask(other.m_frozenAtomMask), + m_frozenAtomMask(other.m_frozenAtomMask), m_graph(other.m_graph), + m_bondOrders(other.m_bondOrders), m_atomicNumbers(other.m_atomicNumbers), m_layers(LayerManager::getMoleculeLayer(this)) { m_basisSet = other.m_basisSet; diff --git a/avogadro/molequeue/batchjob.cpp b/avogadro/molequeue/batchjob.cpp index e160806cdc..b30c403605 100644 --- a/avogadro/molequeue/batchjob.cpp +++ b/avogadro/molequeue/batchjob.cpp @@ -206,14 +206,14 @@ void BatchJob::setup() MoleQueueManager& mqManager = MoleQueueManager::instance(); Client& client = mqManager.client(); - connect(&client, SIGNAL(submitJobResponse(int, uint)), - SLOT(handleSubmissionReply(int, uint))); - connect(&client, SIGNAL(lookupJobResponse(int, QJsonObject)), - SLOT(handleLookupJobReply(int, QJsonObject))); - connect(&client, SIGNAL(jobStateChanged(uint, QString, QString)), - SLOT(handleJobStateChange(uint, QString, QString))); - connect(&client, SIGNAL(errorReceived(int, int, QString, QJsonValue)), - SLOT(handleErrorResponse(int, int, QString, QJsonValue))); + connect(&client, &Client::submitJobResponse, this, + &BatchJob::handleSubmissionReply); + connect(&client, &Client::lookupJobResponse, this, + &BatchJob::handleLookupJobReply); + connect(&client, &Client::jobStateChanged, this, + &BatchJob::handleJobStateChange); + connect(&client, &Client::errorReceived, this, + &BatchJob::handleErrorResponse); } -} // namespace Avogadro +} // namespace Avogadro::MoleQueue diff --git a/avogadro/molequeue/client/client.cpp b/avogadro/molequeue/client/client.cpp index 17643d4d8d..781631a76e 100644 --- a/avogadro/molequeue/client/client.cpp +++ b/avogadro/molequeue/client/client.cpp @@ -28,14 +28,14 @@ bool Client::connectToServer(const QString& serverName) { if (!m_jsonRpcClient) { m_jsonRpcClient = new JsonRpcClient(this); - connect(m_jsonRpcClient, SIGNAL(resultReceived(QJsonObject)), - SLOT(processResult(QJsonObject))); - connect(m_jsonRpcClient, SIGNAL(notificationReceived(QJsonObject)), - SLOT(processNotification(QJsonObject))); - connect(m_jsonRpcClient, SIGNAL(errorReceived(QJsonObject)), - SLOT(processError(QJsonObject))); - connect(m_jsonRpcClient, SIGNAL(connectionStateChanged()), - SIGNAL(connectionStateChanged())); + connect(m_jsonRpcClient, &JsonRpcClient::resultReceived, this, + &Client::processResult); + connect(m_jsonRpcClient, &JsonRpcClient::notificationReceived, this, + &Client::processNotification); + connect(m_jsonRpcClient, &JsonRpcClient::errorReceived, this, + &Client::processError); + connect(m_jsonRpcClient, &JsonRpcClient::connectionStateChanged, this, + &Client::connectionStateChanged); } return m_jsonRpcClient->connectToServer(serverName); diff --git a/avogadro/molequeue/client/jsonrpcclient.cpp b/avogadro/molequeue/client/jsonrpcclient.cpp index 56ef521c12..9d92e17ce4 100644 --- a/avogadro/molequeue/client/jsonrpcclient.cpp +++ b/avogadro/molequeue/client/jsonrpcclient.cpp @@ -5,19 +5,17 @@ #include "jsonrpcclient.h" -#include #include +#include #include #include namespace Avogadro::MoleQueue { -JsonRpcClient::JsonRpcClient(QObject *parent_) : - QObject(parent_), - m_packetCounter(0), - m_socket(nullptr) +JsonRpcClient::JsonRpcClient(QObject* parent_) + : QObject(parent_), m_packetCounter(0), m_socket(nullptr) { - connect(this, SIGNAL(newPacket(QByteArray)), SLOT(readPacket(QByteArray)), + connect(this, &JsonRpcClient::newPacket, this, &JsonRpcClient::readPacket, Qt::QueuedConnection); } @@ -34,13 +32,12 @@ bool JsonRpcClient::isConnected() const return m_socket->isOpen(); } -bool JsonRpcClient::connectToServer(const QString &serverName_) +bool JsonRpcClient::connectToServer(const QString& serverName_) { if (m_socket && m_socket->isOpen()) { if (m_socket->serverName() == serverName_) { return false; - } - else { + } else { m_socket->close(); delete m_socket; m_socket = nullptr; @@ -50,13 +47,12 @@ bool JsonRpcClient::connectToServer(const QString &serverName_) // New connection. if (m_socket == nullptr) { m_socket = new QLocalSocket(this); - connect(m_socket, SIGNAL(readyRead()), this, SLOT(readSocket())); + connect(m_socket, &QIODevice::readyRead, this, &JsonRpcClient::readSocket); } if (serverName_.isEmpty()) { return false; - } - else { + } else { m_socket->connectToServer(serverName_); return isConnected(); } @@ -84,7 +80,7 @@ QJsonObject JsonRpcClient::emptyRequest() return request; } -bool JsonRpcClient::sendRequest(const QJsonObject &request) +bool JsonRpcClient::sendRequest(const QJsonObject& request) { if (!m_socket) return false; @@ -103,16 +99,14 @@ void JsonRpcClient::readPacket(const QByteArray message) QJsonDocument reader = QJsonDocument::fromJson(message, &error); if (error.error != QJsonParseError::NoError) { - emit badPacketReceived("Unparsable message received\n:" - + error.errorString() + "\nContent: " + message); + emit badPacketReceived("Unparsable message received\n:" + + error.errorString() + "\nContent: " + message); return; - } - else if (!reader.isObject()) { + } else if (!reader.isObject()) { // We need a valid object, something bad happened. emit badPacketReceived("Packet did not contain a valid JSON object."); return; - } - else { + } else { QJsonObject root = reader.object(); if (root["method"] != QJsonValue::Null) { if (root["id"] != QJsonValue::Null) @@ -123,8 +117,7 @@ void JsonRpcClient::readPacket(const QByteArray message) if (root["result"] != QJsonValue::Null) { // This is a result packet, and should emit a signal. emit resultReceived(root); - } - else if (root["error"] != QJsonValue::Null) { + } else if (root["error"] != QJsonValue::Null) { emit errorReceived(root); } } @@ -138,8 +131,8 @@ void JsonRpcClient::readSocket() stream >> json; emit newPacket(json); if (m_socket->bytesAvailable() > 0) - QTimer::singleShot(0, this, SLOT(readSocket())); + QTimer::singleShot(0, this, &JsonRpcClient::readSocket); } } -} // End namespace Avogadro +} // namespace Avogadro::MoleQueue diff --git a/avogadro/molequeue/inputgeneratordialog.cpp b/avogadro/molequeue/inputgeneratordialog.cpp index 447a518bb0..048df963cd 100644 --- a/avogadro/molequeue/inputgeneratordialog.cpp +++ b/avogadro/molequeue/inputgeneratordialog.cpp @@ -16,7 +16,8 @@ InputGeneratorDialog::InputGeneratorDialog(QWidget* parent_) : QDialog(parent_), ui(new Ui::InputGeneratorDialog) { ui->setupUi(this); - connect(ui->widget, SIGNAL(closeClicked()), SLOT(accept())); + connect(ui->widget, &InputGeneratorWidget::closeClicked, this, + &QDialog::accept); } InputGeneratorDialog::InputGeneratorDialog(const QString& scriptFileName, @@ -24,7 +25,8 @@ InputGeneratorDialog::InputGeneratorDialog(const QString& scriptFileName, : QDialog(parent_), ui(new Ui::InputGeneratorDialog) { ui->setupUi(this); - connect(ui->widget, SIGNAL(closeClicked()), SLOT(accept())); + connect(ui->widget, &InputGeneratorWidget::closeClicked, this, + &QDialog::accept); this->setInputGeneratorScript(scriptFileName); } @@ -68,4 +70,4 @@ void InputGeneratorDialog::setMolecule(Molecule* mol) ui->widget->setMolecule(mol); } -} // namespace Avogadro +} // namespace Avogadro::MoleQueue diff --git a/avogadro/molequeue/inputgeneratorwidget.cpp b/avogadro/molequeue/inputgeneratorwidget.cpp index 4c1ae8914b..782484276d 100644 --- a/avogadro/molequeue/inputgeneratorwidget.cpp +++ b/avogadro/molequeue/inputgeneratorwidget.cpp @@ -68,8 +68,10 @@ void InputGeneratorWidget::setMolecule(QtGui::Molecule* mol) // make sure to call the base class method QtGui::JsonWidget::setMolecule(mol); - connect(mol, SIGNAL(changed(unsigned int)), SLOT(updatePreviewText())); - connect(mol, SIGNAL(changed(unsigned int)), SLOT(updateTitlePlaceholder())); + connect(mol, &QtGui::Molecule::changed, this, + &InputGeneratorWidget::updatePreviewText); + connect(mol, &QtGui::Molecule::changed, this, + &InputGeneratorWidget::updateTitlePlaceholder); } updateTitlePlaceholder(); @@ -132,7 +134,8 @@ void InputGeneratorWidget::showEvent(QShowEvent* e) // Update the preview text if an update was requested while hidden. Use a // single shot to allow the dialog to show before popping up any warnings. if (m_updatePending) - QTimer::singleShot(0, this, SLOT(updatePreviewTextImmediately())); + QTimer::singleShot(0, this, + &InputGeneratorWidget::updatePreviewTextImmediately); } void InputGeneratorWidget::updatePreviewText() @@ -141,7 +144,8 @@ void InputGeneratorWidget::updatePreviewText() return; m_updatePending = true; - QTimer::singleShot(250, this, SLOT(updatePreviewTextImmediately())); + QTimer::singleShot(250, this, + &InputGeneratorWidget::updatePreviewTextImmediately); } void InputGeneratorWidget::updatePreviewTextImmediately() @@ -234,7 +238,8 @@ void InputGeneratorWidget::updatePreviewTextImmediately() auto* edit = new QTextEdit(this); edit->setObjectName(fileName); edit->setFontFamily("monospace"); - connect(edit, SIGNAL(textChanged()), this, SLOT(textEditModified())); + connect(edit, &QTextEdit::textChanged, this, + &InputGeneratorWidget::textEditModified); m_ui->tabWidget->addTab(edit, fileName); m_textEdits.insert(fileName, edit); } @@ -623,22 +628,26 @@ QJsonObject InputGeneratorWidget::promptForBatchJobOptions() const void InputGeneratorWidget::connectButtons() { - connect(m_ui->debugCheckBox, SIGNAL(toggled(bool)), &m_inputGenerator, - SLOT(setDebug(bool))); - connect(m_ui->debugCheckBox, SIGNAL(toggled(bool)), - SLOT(updatePreviewText())); - connect(m_ui->defaultsButton, SIGNAL(clicked()), SLOT(defaultsClicked())); - connect(m_ui->generateButton, SIGNAL(clicked()), SLOT(generateClicked())); - connect(m_ui->closeButton, SIGNAL(clicked()), SIGNAL(closeClicked())); - connect(m_ui->warningTextButton, SIGNAL(clicked()), - SLOT(toggleWarningText())); + connect(m_ui->debugCheckBox, &QAbstractButton::toggled, &m_inputGenerator, + &InputGenerator::setDebug); + connect(m_ui->debugCheckBox, &QAbstractButton::toggled, this, + &InputGeneratorWidget::updatePreviewText); + connect(m_ui->defaultsButton, &QAbstractButton::clicked, this, + &InputGeneratorWidget::defaultsClicked); + connect(m_ui->generateButton, &QAbstractButton::clicked, this, + &InputGeneratorWidget::generateClicked); + connect(m_ui->closeButton, &QAbstractButton::clicked, this, + &InputGeneratorWidget::closeClicked); + connect(m_ui->warningTextButton, &QAbstractButton::clicked, this, + &InputGeneratorWidget::toggleWarningText); // disable the compute button if Molequeue is not running MoleQueueManager& mqManager = MoleQueueManager::instance(); if (!mqManager.connectIfNeeded()) { m_ui->computeButton->setEnabled(false); } else { - connect(m_ui->computeButton, SIGNAL(clicked()), SLOT(computeClicked())); + connect(m_ui->computeButton, &QAbstractButton::clicked, this, + &InputGeneratorWidget::computeClicked); } } diff --git a/avogadro/molequeue/molequeuedialog.cpp b/avogadro/molequeue/molequeuedialog.cpp index 6cfaf7ff06..3b2f4609b4 100644 --- a/avogadro/molequeue/molequeuedialog.cpp +++ b/avogadro/molequeue/molequeuedialog.cpp @@ -80,7 +80,8 @@ MoleQueueDialog::SubmitStatus MoleQueueDialog::submitJob( return SubmissionSuccessful; // Update progress dialog - progress.setLabelText(tr("Waiting for job %1 “%2” to finish…", "%1 = job ID, %2 = description") + progress.setLabelText(tr("Waiting for job %1 “%2” to finish…", + "%1 = job ID, %2 = description") .arg(dlg.widget().moleQueueId()) .arg(jobTemplate.description())); progress.setCancelButtonText(tr("Stop waiting")); @@ -106,8 +107,8 @@ MoleQueueDialog::SubmitStatus MoleQueueDialog::submitJob( progress.setCancelButton(nullptr); // Job completed -- overwrite job template with updated job details. - connect(&dlg.widget(), SIGNAL(jobUpdated(MoleQueue::JobObject)), - &dlg.widget(), SLOT(setJobTemplate(MoleQueue::JobObject))); + connect(&dlg.widget(), &MoleQueueWidget::jobUpdated, &dlg.widget(), + &MoleQueueWidget::setJobTemplate); QList lookupSignal; lookupSignal << MetaMethod(&dlg.widget(), SIGNAL(jobUpdated(MoleQueue::JobObject))); @@ -124,9 +125,10 @@ MoleQueueDialog::SubmitStatus MoleQueueDialog::submitJob( return JobFinished; } else { progress.hide(); - QMessageBox::warning(&dlg, tr("Error Submitting Job"), - tr("The job has been rejected by MoleQueue: %1", "%1 = error") - .arg(dlg.widget().submissionError())); + QMessageBox::warning( + &dlg, tr("Error Submitting Job"), + tr("The job has been rejected by MoleQueue: %1", "%1 = error") + .arg(dlg.widget().submissionError())); continue; } } else { @@ -180,7 +182,7 @@ bool MoleQueueDialog::waitForSignal(const QList& signalList, QTimer limiter; if (msTimeout >= 0) { limiter.setSingleShot(true); - connect(&limiter, SIGNAL(timeout()), &waiter, SLOT(quit())); + connect(&limiter, &QTimer::timeout, &waiter, &QEventLoop::quit); limiter.start(msTimeout); } @@ -200,4 +202,4 @@ void MoleQueueDialog::done(int r) } } -} // namespace Avogadro +} // namespace Avogadro::MoleQueue diff --git a/avogadro/molequeue/molequeuemanager.cpp b/avogadro/molequeue/molequeuemanager.cpp index bef35b1749..8e319adc06 100644 --- a/avogadro/molequeue/molequeuemanager.cpp +++ b/avogadro/molequeue/molequeuemanager.cpp @@ -12,8 +12,8 @@ MoleQueueManager* MoleQueueManager::m_instance = nullptr; MoleQueueManager::MoleQueueManager(QObject* parent_) : QObject(parent_), m_client(this), m_queueModel(this) { - connect(&m_client, SIGNAL(queueListReceived(QJsonObject)), - SLOT(updateQueueModel(QJsonObject))); + connect(&m_client, &Client::queueListReceived, this, + &MoleQueueManager::updateQueueModel); } MoleQueueManager& MoleQueueManager::instance() @@ -63,4 +63,4 @@ void MoleQueueManager::updateQueueModel(const QJsonObject& json) emit queueListUpdated(); } -} // namespace Avogadro +} // namespace Avogadro::MoleQueue diff --git a/avogadro/molequeue/molequeuewidget.cpp b/avogadro/molequeue/molequeuewidget.cpp index 6034239897..472b1ac6e0 100644 --- a/avogadro/molequeue/molequeuewidget.cpp +++ b/avogadro/molequeue/molequeuewidget.cpp @@ -25,8 +25,8 @@ MoleQueueWidget::MoleQueueWidget(QWidget* parent_) { m_ui->setupUi(this); - connect(m_ui->refreshProgramsButton, SIGNAL(clicked()), - SLOT(refreshPrograms())); + connect(m_ui->refreshProgramsButton, &QAbstractButton::clicked, this, + &MoleQueueWidget::refreshPrograms); MoleQueueManager& mqManager = MoleQueueManager::instance(); m_ui->queueListView->setModel(&mqManager.queueListModel()); @@ -107,8 +107,8 @@ void MoleQueueWidget::showAndSelectProgram(const QString& programName) MoleQueueManager& mqManager = MoleQueueManager::instance(); setProperty("selectProgramName", programName); - connect(&mqManager, SIGNAL(queueListUpdated()), - SLOT(showAndSelectProgramHandler())); + connect(&mqManager, &MoleQueueManager::queueListUpdated, this, + &MoleQueueWidget::showAndSelectProgramHandler); if (mqManager.connectIfNeeded()) mqManager.requestQueueList(); @@ -180,8 +180,8 @@ void MoleQueueWidget::showAndSelectProgramHandler() MoleQueueManager& mqManager = MoleQueueManager::instance(); const QString program(property("selectProgramName").toString()); setProperty("selectProgramName", QVariant()); - disconnect(&mqManager, SIGNAL(queueListUpdated()), this, - SLOT(showAndSelectProgramHandler())); + disconnect(&mqManager, &MoleQueueManager::queueListUpdated, this, + &MoleQueueWidget::showAndSelectProgramHandler); // Get all program nodes that match the name QModelIndexList list(mqManager.queueListModel().findProgramIndices(program)); @@ -255,11 +255,11 @@ void MoleQueueWidget::listenForLookupJobReply(bool listen) { Client& mqClient(MoleQueueManager::instance().client()); if (listen) { - connect(&mqClient, SIGNAL(lookupJobResponse(int, QJsonObject)), this, - SLOT(onLookupJobReply(int, QJsonObject))); + connect(&mqClient, &Client::lookupJobResponse, this, + &MoleQueueWidget::onLookupJobReply); } else { - disconnect(&mqClient, SIGNAL(lookupJobResponse(int, QJsonObject)), this, - SLOT(onLookupJobReply(int, QJsonObject))); + disconnect(&mqClient, &Client::lookupJobResponse, this, + &MoleQueueWidget::onLookupJobReply); } } @@ -268,15 +268,15 @@ void MoleQueueWidget::listenForJobSubmitReply(bool listen) MoleQueue::Client& mqClient(MoleQueueManager::instance().client()); if (listen) { - connect(&mqClient, SIGNAL(submitJobResponse(int, uint)), this, - SLOT(onSubmissionSuccess(int, uint))); - connect(&mqClient, SIGNAL(errorReceived(int, uint, QString)), this, - SLOT(onSubmissionFailure(int, uint, QString))); + connect(&mqClient, &Client::submitJobResponse, this, + &MoleQueueWidget::onSubmissionSuccess); + connect(&mqClient, &Client::errorReceived, this, + &MoleQueueWidget::onSubmissionFailure); } else { - disconnect(&mqClient, SIGNAL(submitJobResponse(int, uint)), this, - SLOT(onSubmissionSuccess(int, uint))); - disconnect(&mqClient, SIGNAL(errorReceived(int, uint, QString)), this, - SLOT(onSubmissionFailure(int, uint, QString))); + disconnect(&mqClient, &Client::submitJobResponse, this, + &MoleQueueWidget::onSubmissionSuccess); + disconnect(&mqClient, &Client::errorReceived, this, + &MoleQueueWidget::onSubmissionFailure); } } @@ -285,11 +285,11 @@ void MoleQueueWidget::listenForJobStateChange(bool listen) MoleQueue::Client& mqClient(MoleQueueManager::instance().client()); if (listen) { - connect(&mqClient, SIGNAL(jobStateChanged(uint, QString, QString)), this, - SLOT(onJobStateChange(uint, QString, QString))); + connect(&mqClient, &Client::jobStateChanged, this, + &MoleQueueWidget::onJobStateChange); } else { - disconnect(&mqClient, SIGNAL(jobStateChanged(uint, QString, QString)), this, - SLOT(onJobStateChange(uint, QString, QString))); + disconnect(&mqClient, &Client::jobStateChanged, this, + &MoleQueueWidget::onJobStateChange); } } @@ -299,4 +299,4 @@ bool MoleQueueWidget::programSelected() return sel.size() > 0; } -} // namespace Avogadro +} // namespace Avogadro::MoleQueue diff --git a/avogadro/qtgui/colorbutton.cpp b/avogadro/qtgui/colorbutton.cpp index 321a3f17ad..06feebd82f 100644 --- a/avogadro/qtgui/colorbutton.cpp +++ b/avogadro/qtgui/colorbutton.cpp @@ -18,7 +18,7 @@ ColorButton::ColorButton(QWidget* parent) { setMinimumSize(35, 20); - connect(this, SIGNAL(clicked()), this, SLOT(changeColor())); + connect(this, &QAbstractButton::clicked, this, &ColorButton::changeColor); } ColorButton::ColorButton(const QColor& initial, QWidget* parent) @@ -26,7 +26,7 @@ ColorButton::ColorButton(const QColor& initial, QWidget* parent) { setMinimumSize(35, 20); - connect(this, SIGNAL(clicked()), this, SLOT(changeColor())); + connect(this, &QAbstractButton::clicked, this, &ColorButton::changeColor); } void ColorButton::changeColor() @@ -85,4 +85,4 @@ bool ColorButton::event(QEvent* e) return QAbstractButton::event(e); } -} // namespace Avogadro \ No newline at end of file +} // namespace Avogadro::QtGui diff --git a/avogadro/qtgui/containerwidget.cpp b/avogadro/qtgui/containerwidget.cpp index c7b280bc49..ebcd2cf1c7 100644 --- a/avogadro/qtgui/containerwidget.cpp +++ b/avogadro/qtgui/containerwidget.cpp @@ -13,10 +13,8 @@ namespace Avogadro::QtGui { ContainerWidget::ContainerWidget(QWidget* p, Qt::WindowFlags f) - : QWidget(p, f) - , m_viewWidget(nullptr) - , m_label(new QLabel(QStringLiteral(" "), this)) - , m_active(false) + : QWidget(p, f), m_viewWidget(nullptr), + m_label(new QLabel(QStringLiteral(" "), this)), m_active(false) { auto* h = new QHBoxLayout; h->setContentsMargins(0, 0, 0, 0); @@ -27,13 +25,15 @@ ContainerWidget::ContainerWidget(QWidget* p, Qt::WindowFlags f) h->addWidget(m_label); h->addStretch(); auto* button = new QPushButton(tr("Split Horizontal"), this); - connect(button, SIGNAL(clicked()), SIGNAL(splitHorizontal())); + connect(button, &QAbstractButton::clicked, this, + &ContainerWidget::splitHorizontal); h->addWidget(button); button = new QPushButton(tr("Split Vertical"), this); - connect(button, SIGNAL(clicked()), SIGNAL(splitVertical())); + connect(button, &QAbstractButton::clicked, this, + &ContainerWidget::splitVertical); h->addWidget(button); button = new QPushButton(tr("Close"), this); - connect(button, SIGNAL(clicked()), SIGNAL(closeView())); + connect(button, &QAbstractButton::clicked, this, &ContainerWidget::closeView); h->addWidget(button); v->addLayout(h); setLayout(v); @@ -62,4 +62,4 @@ void ContainerWidget::setActive(bool active) } } -} // End Avogadro namespace +} // namespace Avogadro::QtGui diff --git a/avogadro/qtgui/filebrowsewidget.cpp b/avogadro/qtgui/filebrowsewidget.cpp index ecede6989f..6591d9812e 100644 --- a/avogadro/qtgui/filebrowsewidget.cpp +++ b/avogadro/qtgui/filebrowsewidget.cpp @@ -38,10 +38,11 @@ FileBrowseWidget::FileBrowseWidget(QWidget* theParent) m_edit->setCompleter(fsCompleter); // Connections: - connect(m_button, SIGNAL(clicked()), SLOT(browse())); - connect(m_edit, SIGNAL(textChanged(QString)), SLOT(testFileName())); - connect(m_edit, SIGNAL(textChanged(QString)), - SIGNAL(fileNameChanged(QString))); + connect(m_button, &QAbstractButton::clicked, this, &FileBrowseWidget::browse); + connect(m_edit, &QLineEdit::textChanged, this, + &FileBrowseWidget::testFileName); + connect(m_edit, &QLineEdit::textChanged, this, + &FileBrowseWidget::fileNameChanged); setMode(ExistingFile); } diff --git a/avogadro/qtgui/gaussiansetconcurrent.cpp b/avogadro/qtgui/gaussiansetconcurrent.cpp index 1c5f3e370a..3e3af3066f 100644 --- a/avogadro/qtgui/gaussiansetconcurrent.cpp +++ b/avogadro/qtgui/gaussiansetconcurrent.cpp @@ -43,7 +43,8 @@ GaussianSetConcurrent::GaussianSetConcurrent(QObject* p) : QObject(p), m_gaussianShells(nullptr), m_set(nullptr), m_tools(nullptr) { // Watch for the future - connect(&m_watcher, SIGNAL(finished()), this, SLOT(calculationComplete())); + connect(&m_watcher, &QFutureWatcherBase::finished, this, + &GaussianSetConcurrent::calculationComplete); } GaussianSetConcurrent::~GaussianSetConcurrent() diff --git a/avogadro/qtgui/insertfragmentdialog.cpp b/avogadro/qtgui/insertfragmentdialog.cpp index 34b7393130..3de53eb06c 100644 --- a/avogadro/qtgui/insertfragmentdialog.cpp +++ b/avogadro/qtgui/insertfragmentdialog.cpp @@ -130,21 +130,21 @@ InsertFragmentDialog::InsertFragmentDialog(QWidget* aParent, QString directory) m_ui->directoryTreeView->setSelectionBehavior(QAbstractItemView::SelectRows); m_ui->directoryTreeView->setUniformRowHeights(true); - connect(m_ui->insertFragmentButton, SIGNAL(clicked(bool)), this, - SLOT(activated())); + connect(m_ui->insertFragmentButton, &QAbstractButton::clicked, this, + &InsertFragmentDialog::activated); - connect(m_ui->directoryTreeView, SIGNAL(doubleClicked(const QModelIndex)), - this, SLOT(activated())); + connect(m_ui->directoryTreeView, &QAbstractItemView::doubleClicked, this, + &InsertFragmentDialog::activated); - connect(m_ui->directoryTreeView, SIGNAL(activated(const QModelIndex)), this, - SLOT(activated())); + connect(m_ui->directoryTreeView, &QAbstractItemView::activated, this, + &InsertFragmentDialog::activated); - connect(m_ui->filterLineEdit, SIGNAL(textChanged(const QString&)), this, - SLOT(filterTextChanged(const QString&))); + connect(m_ui->filterLineEdit, &QLineEdit::textChanged, this, + &InsertFragmentDialog::filterTextChanged); connect(m_ui->directoryTreeView->selectionModel(), - SIGNAL(currentChanged(const QModelIndex&, const QModelIndex&)), this, - SLOT(currentChanged(const QModelIndex&, const QModelIndex&))); + &QItemSelectionModel::currentChanged, this, + &InsertFragmentDialog::currentChanged); } InsertFragmentDialog::~InsertFragmentDialog() diff --git a/avogadro/qtgui/jsonwidget.cpp b/avogadro/qtgui/jsonwidget.cpp index 8f4ed59e01..9f01c90da2 100644 --- a/avogadro/qtgui/jsonwidget.cpp +++ b/avogadro/qtgui/jsonwidget.cpp @@ -31,8 +31,8 @@ namespace Avogadro::QtGui { JsonWidget::JsonWidget(QWidget* parent_) - : QWidget(parent_), m_molecule(nullptr), m_currentLayout(nullptr), - m_centralWidget(nullptr), m_empty(true), m_batchMode(false) + : QWidget(parent_), m_molecule(nullptr), m_empty(true), m_batchMode(false), + m_currentLayout(nullptr), m_centralWidget(nullptr) { } diff --git a/avogadro/qtgui/multiviewwidget.cpp b/avogadro/qtgui/multiviewwidget.cpp index 25f283951e..e1afa225fb 100644 --- a/avogadro/qtgui/multiviewwidget.cpp +++ b/avogadro/qtgui/multiviewwidget.cpp @@ -21,10 +21,7 @@ class ActiveWidgetFilter : public QObject Q_OBJECT public: - ActiveWidgetFilter(MultiViewWidget* p = nullptr) - : QObject(p) - , m_widget(p) - {} + ActiveWidgetFilter(MultiViewWidget* p = nullptr) : QObject(p), m_widget(p) {} signals: void activeWidget(QWidget* widget); @@ -46,11 +43,10 @@ class ActiveWidgetFilter : public QObject }; MultiViewWidget::MultiViewWidget(QWidget* p, Qt::WindowFlags f) - : QWidget(p, f) - , m_factory(nullptr) - , m_activeWidget(nullptr) - , m_activeFilter(new ActiveWidgetFilter(this)) -{} + : QWidget(p, f), m_factory(nullptr), m_activeWidget(nullptr), + m_activeFilter(new ActiveWidgetFilter(this)) +{ +} MultiViewWidget::~MultiViewWidget() {} @@ -172,9 +168,12 @@ void MultiViewWidget::removeView() ContainerWidget* MultiViewWidget::createContainer(QWidget* widget) { auto* container = new ContainerWidget; - connect(container, SIGNAL(splitHorizontal()), SLOT(splitHorizontal())); - connect(container, SIGNAL(splitVertical()), SLOT(splitVertical())); - connect(container, SIGNAL(closeView()), SLOT(removeView())); + connect(container, &ContainerWidget::splitHorizontal, this, + &MultiViewWidget::splitHorizontal); + connect(container, &ContainerWidget::splitVertical, this, + &MultiViewWidget::splitVertical); + connect(container, &ContainerWidget::closeView, this, + &MultiViewWidget::removeView); if (widget) { container->setViewWidget(widget); @@ -189,7 +188,8 @@ ContainerWidget* MultiViewWidget::createContainer(QWidget* widget) auto* button = new QPushButton(name); button->setProperty("name", name); button->setToolTip(tr("Create a new view")); - connect(button, SIGNAL(clicked()), SLOT(createView())); + connect(button, &QAbstractButton::clicked, this, + &MultiViewWidget::createView); auto* h = new QHBoxLayout; h->addStretch(); h->addWidget(button); @@ -238,6 +238,6 @@ void MultiViewWidget::splitView(Qt::Orientation orient, } } -} // End Avogadro namespace +} // namespace Avogadro::QtGui #include "multiviewwidget.moc" diff --git a/avogadro/qtgui/periodictableview.cpp b/avogadro/qtgui/periodictableview.cpp index 8346ac7a89..2b6b55f8c8 100644 --- a/avogadro/qtgui/periodictableview.cpp +++ b/avogadro/qtgui/periodictableview.cpp @@ -30,7 +30,8 @@ PeriodicTableView::PeriodicTableView(QWidget* parent_) setRenderHint(QPainter::Antialiasing); setWindowTitle(tr("Periodic Table")); resize(490, 270); - connect(table, SIGNAL(elementChanged(int)), this, SLOT(elementClicked(int))); + connect(table, &PeriodicTableScene::elementChanged, this, + &PeriodicTableView::elementClicked); } PeriodicTableView::~PeriodicTableView() @@ -68,7 +69,7 @@ void PeriodicTableView::keyPressEvent(QKeyEvent* event_) // This is the first character typed. // Wait for 2 seconds, then clear the buffer, // this ensures we can get multi-character elements. - QTimer::singleShot(2000, this, SLOT(clearKeyPressBuffer())); + QTimer::singleShot(2000, this, &PeriodicTableView::clearKeyPressBuffer); } if (event_->key() == Qt::Key_Escape || event_->key() == Qt::Key_Return || @@ -147,4 +148,4 @@ void PeriodicTableView::resizeEvent(QResizeEvent* e) setTransform(scaleTransform); } -} // namespace Avogadro +} // namespace Avogadro::QtGui diff --git a/avogadro/qtgui/scenepluginmodel.cpp b/avogadro/qtgui/scenepluginmodel.cpp index 739e6712d0..415d7d3d98 100644 --- a/avogadro/qtgui/scenepluginmodel.cpp +++ b/avogadro/qtgui/scenepluginmodel.cpp @@ -153,7 +153,8 @@ void ScenePluginModel::addItem(ScenePlugin* item) if (!m_scenePlugins.contains(item)) { m_scenePlugins.append(item); item->setParent(this); - connect(item, SIGNAL(drawablesChanged()), SIGNAL(pluginConfigChanged())); + connect(item, &ScenePlugin::drawablesChanged, this, + &ScenePluginModel::pluginConfigChanged); } } diff --git a/avogadro/qtgui/slatersetconcurrent.cpp b/avogadro/qtgui/slatersetconcurrent.cpp index baeb3d69ef..49c6c21e7b 100644 --- a/avogadro/qtgui/slatersetconcurrent.cpp +++ b/avogadro/qtgui/slatersetconcurrent.cpp @@ -32,7 +32,8 @@ SlaterSetConcurrent::SlaterSetConcurrent(QObject* p) : QObject(p), m_shells(nullptr), m_set(nullptr), m_tools(nullptr) { // Watch for the future - connect(&m_watcher, SIGNAL(finished()), this, SLOT(calculationComplete())); + connect(&m_watcher, &QFutureWatcherBase::finished, this, + &SlaterSetConcurrent::calculationComplete); } SlaterSetConcurrent::~SlaterSetConcurrent() diff --git a/avogadro/qtplugins/3dmol/3dmol.cpp b/avogadro/qtplugins/3dmol/3dmol.cpp index f75b3f4116..19d17d0bbb 100644 --- a/avogadro/qtplugins/3dmol/3dmol.cpp +++ b/avogadro/qtplugins/3dmol/3dmol.cpp @@ -29,7 +29,7 @@ ThreeDMol::ThreeDMol(QObject* parent_) { m_action->setEnabled(true); m_action->setText("&3DMol HTML Snippet…"); - connect(m_action, SIGNAL(triggered()), SLOT(showDialog())); + connect(m_action, &QAction::triggered, this, &ThreeDMol::showDialog); } QString ThreeDMol::description() const diff --git a/avogadro/qtplugins/3dmol/3dmoldialog.cpp b/avogadro/qtplugins/3dmol/3dmoldialog.cpp index a148f15535..640c1b5cd6 100644 --- a/avogadro/qtplugins/3dmol/3dmoldialog.cpp +++ b/avogadro/qtplugins/3dmol/3dmoldialog.cpp @@ -55,10 +55,13 @@ void ThreeDMolDialog::setMolecule(QtGui::Molecule* mol) if (!m_molecule) return; - connect(m_molecule, SIGNAL(changed(unsigned int)), SLOT(updateLabels())); - connect(m_molecule, SIGNAL(destroyed()), SLOT(moleculeDestroyed())); - connect(m_ui->closeButton, SIGNAL(clicked()), SLOT(close())); - connect(m_ui->copyButton, SIGNAL(clicked()), SLOT(copyToClipboard())); + connect(m_molecule, &QtGui::Molecule::changed, this, + &ThreeDMolDialog::updateLabels); + connect(m_molecule, &QObject::destroyed, this, + &ThreeDMolDialog::moleculeDestroyed); + connect(m_ui->closeButton, &QAbstractButton::clicked, this, &QWidget::close); + connect(m_ui->copyButton, &QAbstractButton::clicked, this, + &ThreeDMolDialog::copyToClipboard); updateLabels(); } @@ -123,4 +126,4 @@ void ThreeDMolDialog::copyToClipboard() QApplication::clipboard()->setText(m_ui->plainTextEdit->toPlainText()); } -} // namespace Avogadro +} // namespace Avogadro::QtPlugins diff --git a/avogadro/qtplugins/alchemy/alchemy.cpp b/avogadro/qtplugins/alchemy/alchemy.cpp index a9bb60dff5..930cca090d 100644 --- a/avogadro/qtplugins/alchemy/alchemy.cpp +++ b/avogadro/qtplugins/alchemy/alchemy.cpp @@ -21,8 +21,8 @@ using Core::Array; using Core::Elements; Alchemy::Alchemy(QObject* parent_) - : Avogadro::QtGui::ExtensionPlugin(parent_), - m_action(new QAction(tr("Change Elements…"), this)), m_molecule(nullptr) + : Avogadro::QtGui::ExtensionPlugin(parent_), m_molecule(nullptr), + m_action(new QAction(tr("Change Elements…"), this)) { m_action->setProperty("menu priority", 750); diff --git a/avogadro/qtplugins/aligntool/aligntool.cpp b/avogadro/qtplugins/aligntool/aligntool.cpp index b90fc3a9b5..e543232158 100644 --- a/avogadro/qtplugins/aligntool/aligntool.cpp +++ b/avogadro/qtplugins/aligntool/aligntool.cpp @@ -43,8 +43,8 @@ namespace Avogadro::QtPlugins { AlignTool::AlignTool(QObject* parent_) : QtGui::ToolPlugin(parent_), m_activateAction(new QAction(this)), - m_molecule(nullptr), m_toolWidget(nullptr), m_renderer(nullptr), - m_alignType(0), m_axis(0) + m_molecule(nullptr), m_renderer(nullptr), m_axis(0), m_alignType(0), + m_toolWidget(nullptr) { m_activateAction->setText(tr("Align")); m_activateAction->setToolTip( @@ -90,7 +90,7 @@ QWidget* AlignTool::toolWidget() const // Button to actually perform actions auto* buttonAlign = new QPushButton(m_toolWidget); buttonAlign->setText(tr("Align")); - connect(buttonAlign, SIGNAL(clicked()), this, SLOT(align())); + connect(buttonAlign, &QAbstractButton::clicked, this, &AlignTool::align); auto* gridLayout = new QGridLayout(); gridLayout->addWidget(labelAxis, 0, 0, 1, 1, Qt::AlignRight); @@ -112,8 +112,8 @@ QWidget* AlignTool::toolWidget() const connect(comboAxis, SIGNAL(currentIndexChanged(int)), this, SLOT(axisChanged(int))); - connect(m_toolWidget, SIGNAL(destroyed()), this, - SLOT(toolWidgetDestroyed())); + connect(m_toolWidget, &QObject::destroyed, this, + &AlignTool::toolWidgetDestroyed); } return m_toolWidget; diff --git a/avogadro/qtplugins/apbs/apbs.cpp b/avogadro/qtplugins/apbs/apbs.cpp index 719d3e3c1d..d7964c1ad8 100644 --- a/avogadro/qtplugins/apbs/apbs.cpp +++ b/avogadro/qtplugins/apbs/apbs.cpp @@ -30,12 +30,12 @@ Apbs::Apbs(QObject* parent_) { auto* action = new QAction(this); action->setText(tr("Run APBS…")); - connect(action, SIGNAL(triggered()), this, SLOT(onRunApbs())); + connect(action, &QAction::triggered, this, &Apbs::onRunApbs); m_actions.append(action); action = new QAction(this); action->setText(tr("Open Output File…")); - connect(action, SIGNAL(triggered()), this, SLOT(onOpenOutputFile())); + connect(action, &QAction::triggered, this, &Apbs::onOpenOutputFile); m_actions.append(action); } @@ -72,8 +72,7 @@ void Apbs::onOpenOutputFile() void Apbs::meshGeneratorFinished() { - auto* generator = - qobject_cast(sender()); + auto* generator = qobject_cast(sender()); if (!generator) { return; } @@ -155,12 +154,11 @@ bool Apbs::loadOpenDxFile(const QString& fileName, QtGui::Molecule& molecule) qApp->processEvents(); Mesh* mesh = molecule.addMesh(); - auto* meshGenerator = - new QtGui::MeshGenerator(cube, mesh, 0.1f); - connect(meshGenerator, SIGNAL(finished()), this, - SLOT(meshGeneratorFinished())); - connect(meshGenerator, SIGNAL(progressValueChanged(int)), this, - SLOT(onMeshGeneratorProgress(int))); + auto* meshGenerator = new QtGui::MeshGenerator(cube, mesh, 0.1f); + connect(meshGenerator, &QThread::finished, this, + &Apbs::meshGeneratorFinished); + connect(meshGenerator, &QtGui::MeshGenerator::progressValueChanged, this, + &Apbs::onMeshGeneratorProgress); meshGenerator->run(); // generate negative mesh @@ -171,10 +169,10 @@ bool Apbs::loadOpenDxFile(const QString& fileName, QtGui::Molecule& molecule) mesh = molecule.addMesh(); meshGenerator = new QtGui::MeshGenerator(cube, mesh, -0.1f); - connect(meshGenerator, SIGNAL(finished()), this, - SLOT(meshGeneratorFinished())); - connect(meshGenerator, SIGNAL(progressValueChanged(int)), this, - SLOT(onMeshGeneratorProgress(int))); + connect(meshGenerator, &QThread::finished, this, + &Apbs::meshGeneratorFinished); + connect(meshGenerator, &QtGui::MeshGenerator::progressValueChanged, this, + &Apbs::onMeshGeneratorProgress); meshGenerator->run(); m_progressDialog->setValue(100); @@ -184,4 +182,4 @@ bool Apbs::loadOpenDxFile(const QString& fileName, QtGui::Molecule& molecule) return true; } -} +} // namespace Avogadro::QtPlugins diff --git a/avogadro/qtplugins/apbs/apbsdialog.cpp b/avogadro/qtplugins/apbs/apbsdialog.cpp index f7d74e3297..b500ecb546 100644 --- a/avogadro/qtplugins/apbs/apbsdialog.cpp +++ b/avogadro/qtplugins/apbs/apbsdialog.cpp @@ -31,13 +31,15 @@ ApbsDialog::ApbsDialog(QWidget* parent_) { m_ui->setupUi(this); - connect(m_ui->closeButton, SIGNAL(clicked()), this, SLOT(reject())); - connect(m_ui->openPdbFileButton, SIGNAL(clicked()), this, - SLOT(openPdbFile())); - connect(m_ui->openPqrFileButton, SIGNAL(clicked()), this, - SLOT(openPqrFile())); - connect(m_ui->runApbsButton, SIGNAL(clicked()), this, SLOT(runApbs())); - connect(m_ui->runPdb2PqrButton, SIGNAL(clicked()), this, SLOT(runPdb2Pqr())); + connect(m_ui->closeButton, &QAbstractButton::clicked, this, &QDialog::reject); + connect(m_ui->openPdbFileButton, &QAbstractButton::clicked, this, + &ApbsDialog::openPdbFile); + connect(m_ui->openPqrFileButton, &QAbstractButton::clicked, this, + &ApbsDialog::openPqrFile); + connect(m_ui->runApbsButton, &QAbstractButton::clicked, this, + &ApbsDialog::runApbs); + connect(m_ui->runPdb2PqrButton, &QAbstractButton::clicked, this, + &ApbsDialog::runPdb2Pqr); connect(m_ui->saveInputFileButton, SIGNAL(clicked()), this, SLOT(saveInputFile())); } @@ -115,7 +117,7 @@ void ApbsDialog::runApbs() m_cubeFileName = "pot-PE0.dx"; ApbsOutputDialog dialog(this); - connect(&dialog, SIGNAL(accepted()), this, SLOT(accept())); + connect(&dialog, &QDialog::accepted, this, &QDialog::accept); int code = dialog.exec(); if (code == QDialog::Accepted) { m_loadStructureFile = dialog.loadStructureFile(); @@ -218,4 +220,4 @@ void ApbsDialog::updatePreviewTextImmediately() m_ui->textEdit->setText(m_inputGenerator->fileContents("apbs.in")); } -} +} // namespace Avogadro::QtPlugins diff --git a/avogadro/qtplugins/applycolors/applycolors.cpp b/avogadro/qtplugins/applycolors/applycolors.cpp index 28c5f66fd6..acafe6d6be 100644 --- a/avogadro/qtplugins/applycolors/applycolors.cpp +++ b/avogadro/qtplugins/applycolors/applycolors.cpp @@ -45,53 +45,55 @@ ApplyColors::ApplyColors(QObject* parent_) action = new QAction(tr("By Custom Color…"), this); action->setData(atomColors); - connect(action, SIGNAL(triggered()), SLOT(openColorDialog())); + connect(action, &QAction::triggered, this, &ApplyColors::openColorDialog); m_actions.append(action); action = new QAction(tr("By Atomic Index…"), this); action->setData(atomColors); - connect(action, SIGNAL(triggered()), SLOT(applyIndexColors())); + connect(action, &QAction::triggered, this, &ApplyColors::applyIndexColors); m_actions.append(action); action = new QAction(tr("By Distance…"), this); action->setData(atomColors); - connect(action, SIGNAL(triggered()), SLOT(applyDistanceColors())); + connect(action, &QAction::triggered, this, &ApplyColors::applyDistanceColors); m_actions.append(action); action = new QAction(tr("By Element"), this); action->setData(atomColors); - connect(action, SIGNAL(triggered()), SLOT(resetColors())); + connect(action, &QAction::triggered, this, &ApplyColors::resetColors); m_actions.append(action); // not sure if we want to color atoms by residue or not... action = new QAction(tr("By Custom Color…"), this); action->setData(residueColors); - connect(action, SIGNAL(triggered()), SLOT(openColorDialogResidue())); + connect(action, &QAction::triggered, this, + &ApplyColors::openColorDialogResidue); m_actions.append(action); action = new QAction(tr("By Chain"), this); action->setData(residueColors); - connect(action, SIGNAL(triggered()), SLOT(resetColorsResidue())); + connect(action, &QAction::triggered, this, &ApplyColors::resetColorsResidue); m_actions.append(action); action = new QAction(tr("By Partial Charge…"), this); action->setData(atomColors); - connect(action, SIGNAL(triggered()), SLOT(applyChargeColors())); + connect(action, &QAction::triggered, this, &ApplyColors::applyChargeColors); m_actions.append(action); action = new QAction(tr("By Secondary Structure"), this); action->setData(residueColors); - connect(action, SIGNAL(triggered()), SLOT(applySecondaryStructureColors())); + connect(action, &QAction::triggered, this, + &ApplyColors::applySecondaryStructureColors); m_actions.append(action); action = new QAction(tr("By Amino Acid"), this); action->setData(residueColors); - connect(action, SIGNAL(triggered()), SLOT(applyAminoColors())); + connect(action, &QAction::triggered, this, &ApplyColors::applyAminoColors); m_actions.append(action); action = new QAction(tr("By Shapely Scheme"), this); action->setData(residueColors); - connect(action, SIGNAL(triggered()), SLOT(applyShapelyColors())); + connect(action, &QAction::triggered, this, &ApplyColors::applyShapelyColors); m_actions.append(action); } @@ -165,8 +167,8 @@ void ApplyColors::openColorDialog() { if (m_dialog == nullptr) { m_dialog = new QColorDialog(qobject_cast(parent())); - connect(m_dialog, SIGNAL(currentColorChanged(const QColor&)), - SLOT(applyCustomColor(const QColor&))); + connect(m_dialog, &QColorDialog::currentColorChanged, this, + &ApplyColors::applyCustomColor); } m_dialog->exec(); @@ -385,8 +387,8 @@ void ApplyColors::openColorDialogResidue() m_dialog = new QColorDialog(qobject_cast(parent())); } m_dialog->disconnect(); - connect(m_dialog, SIGNAL(currentColorChanged(const QColor&)), - SLOT(applyCustomColorResidue(const QColor&))); + connect(m_dialog, &QColorDialog::currentColorChanged, this, + &ApplyColors::applyCustomColorResidue); m_dialog->exec(); } diff --git a/avogadro/qtplugins/bonding/bonding.cpp b/avogadro/qtplugins/bonding/bonding.cpp index e0901f7f9d..c8d53236bd 100644 --- a/avogadro/qtplugins/bonding/bonding.cpp +++ b/avogadro/qtplugins/bonding/bonding.cpp @@ -42,11 +42,11 @@ Bonding::Bonding(QObject* parent_) m_orderAction->setProperty("menu priority", 735); m_clearAction->setProperty("menu priority", 720); - connect(m_action, SIGNAL(triggered()), SLOT(bond())); - connect(m_createBondsAction, SIGNAL(triggered()), SLOT(createBond())); - connect(m_orderAction, SIGNAL(triggered()), SLOT(bondOrders())); - connect(m_clearAction, SIGNAL(triggered()), SLOT(clearBonds())); - connect(m_configAction, SIGNAL(triggered()), SLOT(configure())); + connect(m_action, &QAction::triggered, this, &Bonding::bond); + connect(m_createBondsAction, &QAction::triggered, this, &Bonding::createBond); + connect(m_orderAction, &QAction::triggered, this, &Bonding::bondOrders); + connect(m_clearAction, &QAction::triggered, this, &Bonding::clearBonds); + connect(m_configAction, &QAction::triggered, this, &Bonding::configure); } QList Bonding::actions() const @@ -103,8 +103,10 @@ void Bonding::configure() m_ui->toleranceSpinBox->setValue(m_tolerance); m_ui->minimumSpinBox->setValue(m_minDistance); - connect(m_ui->buttonBox, SIGNAL(accepted()), this, SLOT(setValues())); - connect(m_ui->buttonBox, SIGNAL(rejected()), m_dialog, SLOT(close())); + connect(m_ui->buttonBox, &QDialogButtonBox::accepted, this, + &Bonding::setValues); + connect(m_ui->buttonBox, &QDialogButtonBox::rejected, m_dialog, + &QWidget::close); } m_dialog->show(); diff --git a/avogadro/qtplugins/centroid/centroid.cpp b/avogadro/qtplugins/centroid/centroid.cpp index cfd4c658e4..0e44b0f6c4 100644 --- a/avogadro/qtplugins/centroid/centroid.cpp +++ b/avogadro/qtplugins/centroid/centroid.cpp @@ -29,9 +29,9 @@ Centroid::Centroid(QObject* parent_) m_comAction->setProperty("menu priority", 180); m_normalAction->setProperty("menu priority", 170); - connect(m_centroidAction, SIGNAL(triggered()), SLOT(addCentroid())); - connect(m_comAction, SIGNAL(triggered()), SLOT(addCenterOfMass())); - connect(m_normalAction, SIGNAL(triggered()), SLOT(normal())); + connect(m_centroidAction, &QAction::triggered, this, &Centroid::addCentroid); + connect(m_comAction, &QAction::triggered, this, &Centroid::addCenterOfMass); + connect(m_normalAction, &QAction::triggered, this, &Centroid::normal); } QList Centroid::actions() const diff --git a/avogadro/qtplugins/commandscripts/command.cpp b/avogadro/qtplugins/commandscripts/command.cpp index 0cc58778a5..82a70f1061 100644 --- a/avogadro/qtplugins/commandscripts/command.cpp +++ b/avogadro/qtplugins/commandscripts/command.cpp @@ -194,8 +194,9 @@ void Command::menuActivated() auto* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); - connect(buttonBox, SIGNAL(accepted()), this, SLOT(run())); - connect(buttonBox, SIGNAL(rejected()), m_currentDialog, SLOT(reject())); + connect(buttonBox, &QDialogButtonBox::accepted, this, &Command::run); + connect(buttonBox, &QDialogButtonBox::rejected, m_currentDialog, + &QDialog::reject); vbox->addWidget(buttonBox); m_currentDialog->setLayout(vbox); m_currentDialog->exec(); @@ -210,8 +211,8 @@ void Command::run() m_progress->deleteLater(); if (m_currentScript) { - disconnect(m_currentScript, SIGNAL(finished()), this, - SLOT(processFinished())); + disconnect(m_currentScript, &QtGui::InterfaceScript::finished, this, + &Command::processFinished); m_currentScript->deleteLater(); } @@ -223,7 +224,8 @@ void Command::run() m_currentInterface->interfaceScript().scriptFilePath(); m_currentScript = new InterfaceScript(scriptFilePath, parent()); - connect(m_currentScript, SIGNAL(finished()), this, SLOT(processFinished())); + connect(m_currentScript, &QtGui::InterfaceScript::finished, this, + &Command::processFinished); // no cancel button - just an indication we're waiting... QString title = tr("Processing %1").arg(m_currentScript->displayName()); @@ -293,8 +295,8 @@ void Command::configurePython() dlg.setLayout(layout); // Connect - connect(buttonBox, SIGNAL(accepted()), &dlg, SLOT(accept())); - connect(buttonBox, SIGNAL(rejected()), &dlg, SLOT(reject())); + connect(buttonBox, &QDialogButtonBox::accepted, &dlg, &QDialog::accept); + connect(buttonBox, &QDialogButtonBox::rejected, &dlg, &QDialog::reject); // Show dialog auto response = static_cast(dlg.exec()); @@ -337,7 +339,7 @@ void Command::addAction(const QString& label, const QString& scriptFilePath) auto* action = new QAction(tr(label.toUtf8()), this); action->setData(scriptFilePath); action->setEnabled(true); - connect(action, SIGNAL(triggered()), SLOT(menuActivated())); + connect(action, &QAction::triggered, this, &Command::menuActivated); m_actions << action; } diff --git a/avogadro/qtplugins/configurepython/configurepython.cpp b/avogadro/qtplugins/configurepython/configurepython.cpp index 4906d0db6b..755567de54 100644 --- a/avogadro/qtplugins/configurepython/configurepython.cpp +++ b/avogadro/qtplugins/configurepython/configurepython.cpp @@ -31,7 +31,7 @@ ConfigurePython::ConfigurePython(QObject* parent_) m_action->setEnabled(true); m_action->setText(tr("Python Settings…")); m_action->setProperty("menu priority", 510); - connect(m_action, SIGNAL(triggered()), SLOT(showDialog())); + connect(m_action, &QAction::triggered, this, &ConfigurePython::showDialog); // check for Python on first launch QStringList paths = pythonPaths(); diff --git a/avogadro/qtplugins/coordinateeditor/coordinateeditor.cpp b/avogadro/qtplugins/coordinateeditor/coordinateeditor.cpp index fd7b789b7a..d9c43b59bb 100644 --- a/avogadro/qtplugins/coordinateeditor/coordinateeditor.cpp +++ b/avogadro/qtplugins/coordinateeditor/coordinateeditor.cpp @@ -17,12 +17,10 @@ CoordinateEditor::CoordinateEditor(QObject* parent_) m_action(new QAction(tr("Atomic &Coordinate Editor…"), this)) { m_action->setProperty("menu priority", 900); - connect(m_action, SIGNAL(triggered()), SLOT(triggered())); + connect(m_action, &QAction::triggered, this, &CoordinateEditor::triggered); } -CoordinateEditor::~CoordinateEditor() -{ -} +CoordinateEditor::~CoordinateEditor() {} QList CoordinateEditor::actions() const { @@ -46,7 +44,8 @@ void CoordinateEditor::triggered() if (!m_dialog) { m_dialog = new CoordinateEditorDialog(qobject_cast(parent())); m_dialog->setMolecule(m_molecule); - connect(m_dialog, SIGNAL(pastedMolecule()), SLOT(pastedMolecule())); + connect(m_dialog, &CoordinateEditorDialog::pastedMolecule, this, + &CoordinateEditor::pastedMolecule); } m_dialog->show(); @@ -59,4 +58,4 @@ void CoordinateEditor::pastedMolecule() requestActiveTool("Navigator"); } -} // namespace Avogadro +} // namespace Avogadro::QtPlugins diff --git a/avogadro/qtplugins/coordinateeditor/coordinateeditordialog.cpp b/avogadro/qtplugins/coordinateeditor/coordinateeditordialog.cpp index 6f9c21f508..e8cb6592be 100644 --- a/avogadro/qtplugins/coordinateeditor/coordinateeditordialog.cpp +++ b/avogadro/qtplugins/coordinateeditor/coordinateeditordialog.cpp @@ -140,8 +140,8 @@ CoordinateEditorDialog::CoordinateEditorDialog(QWidget* parent_) // Set up text editor m_ui->text->setFont(QFont(EDITOR_FONT, qApp->font().pointSize())); - connect(m_ui->text->document(), SIGNAL(modificationChanged(bool)), - SLOT(textModified(bool))); + connect(m_ui->text->document(), &QTextDocument::modificationChanged, this, + &CoordinateEditorDialog::textModified); // Setup spec edit QRegularExpression specRegExp("[#ZGSLNabcxyz01_]*"); @@ -149,19 +149,28 @@ CoordinateEditorDialog::CoordinateEditorDialog(QWidget* parent_) m_ui->spec->setValidator(specValidator); connect(m_ui->presets, SIGNAL(currentIndexChanged(int)), SLOT(presetChanged(int))); - connect(m_ui->spec, SIGNAL(textChanged(QString)), SLOT(specChanged())); - connect(m_ui->spec, SIGNAL(textEdited(QString)), SLOT(specEdited())); + connect(m_ui->spec, &QLineEdit::textChanged, this, + &CoordinateEditorDialog::specChanged); + connect(m_ui->spec, &QLineEdit::textEdited, this, + &CoordinateEditorDialog::specEdited); connect(m_ui->distanceUnit, SIGNAL(currentIndexChanged(int)), SLOT(updateText())); - connect(m_ui->help, SIGNAL(clicked()), SLOT(helpClicked())); - connect(m_ui->cut, SIGNAL(clicked()), SLOT(cutClicked())); - connect(m_ui->copy, SIGNAL(clicked()), SLOT(copyClicked())); - connect(m_ui->paste, SIGNAL(clicked()), SLOT(pasteClicked())); - connect(m_ui->revert, SIGNAL(clicked()), SLOT(revertClicked())); - connect(m_ui->clear, SIGNAL(clicked()), SLOT(clearClicked())); - connect(m_ui->apply, SIGNAL(clicked()), SLOT(applyClicked())); + connect(m_ui->help, &QAbstractButton::clicked, this, + &CoordinateEditorDialog::helpClicked); + connect(m_ui->cut, &QAbstractButton::clicked, this, + &CoordinateEditorDialog::cutClicked); + connect(m_ui->copy, &QAbstractButton::clicked, this, + &CoordinateEditorDialog::copyClicked); + connect(m_ui->paste, &QAbstractButton::clicked, this, + &CoordinateEditorDialog::pasteClicked); + connect(m_ui->revert, &QAbstractButton::clicked, this, + &CoordinateEditorDialog::revertClicked); + connect(m_ui->clear, &QAbstractButton::clicked, this, + &CoordinateEditorDialog::clearClicked); + connect(m_ui->apply, &QAbstractButton::clicked, this, + &CoordinateEditorDialog::applyClicked); m_ui->cut->setIcon(QIcon::fromTheme("edit-cut")); m_ui->copy->setIcon(QIcon::fromTheme("edit-copy")); @@ -182,7 +191,8 @@ void CoordinateEditorDialog::setMolecule(QtGui::Molecule* mol) if (m_molecule) m_molecule->disconnect(this); m_molecule = mol; - connect(m_molecule, SIGNAL(changed(uint)), SLOT(moleculeChanged(uint))); + connect(m_molecule, &QtGui::Molecule::changed, this, + &CoordinateEditorDialog::moleculeChanged); updateText(); } } @@ -528,7 +538,7 @@ void CoordinateEditorDialog::validateInputWorker() // If we're not at the end, post this method back into the event loop. if (!lineCursor.atEnd()) { - QTimer::singleShot(0, this, SLOT(validateInputWorker())); + QTimer::singleShot(0, this, &CoordinateEditorDialog::validateInputWorker); } else { // Otherwise emit the finished signal. emit validationFinished(!m_ui->text->hasInvalidMarks()); @@ -567,7 +577,8 @@ void CoordinateEditorDialog::applyClicked() break; } - connect(this, SIGNAL(validationFinished(bool)), SLOT(applyFinish(bool))); + connect(this, &CoordinateEditorDialog::validationFinished, this, + &CoordinateEditorDialog::applyFinish); validateInput(); } @@ -577,8 +588,8 @@ void CoordinateEditorDialog::applyFinish(bool valid) m_validate->collectAtoms = false; QVector atoms(m_validate->atoms); m_validate->atoms.clear(); - disconnect(this, SIGNAL(validationFinished(bool)), this, - SLOT(applyFinish(bool))); + disconnect(this, &CoordinateEditorDialog::validationFinished, this, + &CoordinateEditorDialog::applyFinish); if (!valid) { QMessageBox::critical(this, tr("Error applying geometry"), @@ -654,9 +665,11 @@ void CoordinateEditorDialog::buildPresets() void CoordinateEditorDialog::listenForTextEditChanges(bool enable) { if (enable) - connect(m_ui->text, SIGNAL(textChanged()), this, SLOT(validateInput())); + connect(m_ui->text, &QTextEdit::textChanged, this, + &CoordinateEditorDialog::validateInput); else - disconnect(m_ui->text, SIGNAL(textChanged()), this, SLOT(validateInput())); + disconnect(m_ui->text, &QTextEdit::textChanged, this, + &CoordinateEditorDialog::validateInput); } QString CoordinateEditorDialog::detectInputFormat() const diff --git a/avogadro/qtplugins/copypaste/copypaste.cpp b/avogadro/qtplugins/copypaste/copypaste.cpp index 6b17ff1adc..f5f77c7489 100644 --- a/avogadro/qtplugins/copypaste/copypaste.cpp +++ b/avogadro/qtplugins/copypaste/copypaste.cpp @@ -37,28 +37,28 @@ CopyPaste::CopyPaste(QObject* parent_) m_cutAction->setShortcut(QKeySequence::Cut); m_cutAction->setIcon(QIcon::fromTheme("edit-cut")); m_cutAction->setProperty("menu priority", 560); - connect(m_cutAction, SIGNAL(triggered()), SLOT(cut())); + connect(m_cutAction, &QAction::triggered, this, &CopyPaste::cut); m_copyAction->setShortcut(QKeySequence::Copy); m_copyAction->setIcon(QIcon::fromTheme("edit-copy")); m_copyAction->setProperty("menu priority", 550); - connect(m_copyAction, SIGNAL(triggered()), SLOT(copyCJSON())); + connect(m_copyAction, &QAction::triggered, this, &CopyPaste::copyCJSON); m_copySMILES->setProperty("menu priority", 540); - connect(m_copySMILES, SIGNAL(triggered()), SLOT(copySMILES())); + connect(m_copySMILES, &QAction::triggered, this, &CopyPaste::copySMILES); m_copyInChI->setProperty("menu priority", 530); - connect(m_copyInChI, SIGNAL(triggered()), SLOT(copyInChI())); + connect(m_copyInChI, &QAction::triggered, this, &CopyPaste::copyInChI); m_pasteAction->setShortcut(QKeySequence::Paste); m_pasteAction->setIcon(QIcon::fromTheme("edit-paste")); m_pasteAction->setProperty("menu priority", 510); - connect(m_pasteAction, SIGNAL(triggered()), SLOT(paste())); + connect(m_pasteAction, &QAction::triggered, this, &CopyPaste::paste); m_clearAction->setShortcut(QKeySequence::Delete); m_clearAction->setIcon(QIcon::fromTheme("edit-clear")); m_clearAction->setProperty("menu priority", 500); - connect(m_clearAction, SIGNAL(triggered()), SLOT(clear())); + connect(m_clearAction, &QAction::triggered, this, &CopyPaste::clear); } CopyPaste::~CopyPaste() diff --git a/avogadro/qtplugins/cp2kinput/cp2kinput.cpp b/avogadro/qtplugins/cp2kinput/cp2kinput.cpp index ee0d8afcd8..c39c80d717 100644 --- a/avogadro/qtplugins/cp2kinput/cp2kinput.cpp +++ b/avogadro/qtplugins/cp2kinput/cp2kinput.cpp @@ -13,8 +13,8 @@ #include -#include #include +#include #include namespace Avogadro { @@ -31,7 +31,7 @@ Cp2kInput::Cp2kInput(QObject* parent_) { m_action->setEnabled(true); m_action->setText(tr("&CP2K…")); - connect(m_action, SIGNAL(triggered()), SLOT(menuActivated())); + connect(m_action, &QAction::triggered, this, &Cp2kInput::menuActivated); } Cp2kInput::~Cp2kInput() {} @@ -98,8 +98,8 @@ void Cp2kInput::menuActivated() { if (!m_dialog) { m_dialog = new Cp2kInputDialog(qobject_cast(parent())); - connect(m_dialog, SIGNAL(openJobOutput(Avogadro::MoleQueue::JobObject)), this, - SLOT(openJobOutput(Avogadro::MoleQueue::JobObject))); + connect(m_dialog, &Cp2kInputDialog::openJobOutput, this, + &Cp2kInput::openJobOutput); } m_dialog->setMolecule(m_molecule); m_dialog->show(); diff --git a/avogadro/qtplugins/cp2kinput/cp2kinputdialog.cpp b/avogadro/qtplugins/cp2kinput/cp2kinputdialog.cpp index 5eec8b6ddf..1be7f6078d 100644 --- a/avogadro/qtplugins/cp2kinput/cp2kinputdialog.cpp +++ b/avogadro/qtplugins/cp2kinput/cp2kinputdialog.cpp @@ -31,9 +31,9 @@ #include #include +using Avogadro::MoleQueue::JobObject; using Avogadro::MoleQueue::MoleQueueDialog; using Avogadro::MoleQueue::MoleQueueManager; -using Avogadro::MoleQueue::JobObject; namespace Avogadro::QtPlugins { @@ -145,8 +145,10 @@ void Cp2kInputDialog::setMolecule(QtGui::Molecule* mol) m_molecule = mol; - connect(mol, SIGNAL(changed(unsigned int)), SLOT(updatePreviewText())); - connect(mol, SIGNAL(changed(unsigned int)), SLOT(updateTitlePlaceholder())); + connect(mol, &QtGui::Molecule::changed, this, + &Cp2kInputDialog::updatePreviewText); + connect(mol, &QtGui::Molecule::changed, this, + &Cp2kInputDialog::updateTitlePlaceholder); updateTitlePlaceholder(); updatePreviewText(); @@ -159,13 +161,13 @@ void Cp2kInputDialog::showEvent(QShowEvent* e) // Update the preview text if an update was requested while hidden. Use a // single shot to allow the dialog to show before popping up any warnings. if (m_updatePending) - QTimer::singleShot(0, this, SLOT(updatePreviewText())); + QTimer::singleShot(0, this, &Cp2kInputDialog::updatePreviewText); } void Cp2kInputDialog::connectBasic() { - connect(ui.titleEdit, SIGNAL(textChanged(QString)), this, - SLOT(updatePreviewText())); + connect(ui.titleEdit, &QLineEdit::textChanged, this, + &Cp2kInputDialog::updatePreviewText); connect(ui.calculateCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updatePreviewText())); connect(ui.calculateCombo, SIGNAL(currentIndexChanged(int)), this, @@ -190,8 +192,8 @@ void Cp2kInputDialog::connectBasic() SLOT(updatePreviewText())); connect(ui.ewaldgmaxSpin, SIGNAL(valueChanged(double)), this, SLOT(updatePreviewText())); - connect(ui.lsdcheckBox, SIGNAL(stateChanged(bool)), this, - SLOT(updatePreviewText())); + connect(ui.lsdcheckBox, &QCheckBox::stateChanged, this, + &Cp2kInputDialog::updatePreviewText); connect(ui.maxscfspinBox, SIGNAL(valueChanged(int)), this, SLOT(updatePreviewText())); connect(ui.epsscfSpinBox, SIGNAL(valueChanged(double)), this, @@ -210,11 +212,15 @@ void Cp2kInputDialog::connectPreview() {} void Cp2kInputDialog::connectButtons() { - connect(ui.resetAllButton, SIGNAL(clicked()), SLOT(resetClicked())); - connect(ui.defaultsButton, SIGNAL(clicked()), SLOT(defaultsClicked())); - connect(ui.generateButton, SIGNAL(clicked()), SLOT(generateClicked())); - connect(ui.computeButton, SIGNAL(clicked()), SLOT(computeClicked())); - connect(ui.closeButton, SIGNAL(clicked()), SLOT(close())); + connect(ui.resetAllButton, &QAbstractButton::clicked, this, + &Cp2kInputDialog::resetClicked); + connect(ui.defaultsButton, &QAbstractButton::clicked, this, + &Cp2kInputDialog::defaultsClicked); + connect(ui.generateButton, &QAbstractButton::clicked, this, + &Cp2kInputDialog::generateClicked); + connect(ui.computeButton, &QAbstractButton::clicked, this, + &Cp2kInputDialog::computeClicked); + connect(ui.closeButton, &QAbstractButton::clicked, this, &QWidget::close); } void Cp2kInputDialog::buildOptions() @@ -553,8 +559,7 @@ void Cp2kInputDialog::updatePreviewText() auto functional( static_cast(ui.functionalCombo->currentIndex())); auto basis(static_cast(ui.basisCombo->currentIndex())); - auto method( - static_cast(ui.methodCombo->currentIndex())); + auto method(static_cast(ui.methodCombo->currentIndex())); auto EWALDType( static_cast(ui.ewaldtypeCombo->currentIndex())); auto SCFGuess( @@ -1038,4 +1043,4 @@ void Cp2kInputDialog::updateTitlePlaceholder() ui.titleEdit->setPlaceholderText(generateJobTitle()); } -} // end namespace Avogadro +} // namespace Avogadro::QtPlugins diff --git a/avogadro/qtplugins/crystal/crystal.cpp b/avogadro/qtplugins/crystal/crystal.cpp index 6ecd3db438..aafbfea97c 100644 --- a/avogadro/qtplugins/crystal/crystal.cpp +++ b/avogadro/qtplugins/crystal/crystal.cpp @@ -38,46 +38,51 @@ Crystal::Crystal(QObject* parent_) m_wrapAtomsToCellAction(new QAction(this)) { m_importCrystalClipboardAction->setText(tr("Import Crystal from Clipboard…")); - connect(m_importCrystalClipboardAction, SIGNAL(triggered()), - SLOT(importCrystalClipboard())); + connect(m_importCrystalClipboardAction, &QAction::triggered, this, + &Crystal::importCrystalClipboard); m_actions.push_back(m_importCrystalClipboardAction); m_importCrystalClipboardAction->setProperty("menu priority", 220); // this will be changed when the molecule is set: m_toggleUnitCellAction->setText(tr("Toggle Unit Cell")); - connect(m_toggleUnitCellAction, SIGNAL(triggered()), SLOT(toggleUnitCell())); + connect(m_toggleUnitCellAction, &QAction::triggered, this, + &Crystal::toggleUnitCell); m_actions.push_back(m_toggleUnitCellAction); m_toggleUnitCellAction->setProperty("menu priority", 210); m_editUnitCellAction->setText(tr("Edit Unit Cell…")); - connect(m_editUnitCellAction, SIGNAL(triggered()), SLOT(editUnitCell())); + connect(m_editUnitCellAction, &QAction::triggered, this, + &Crystal::editUnitCell); m_actions.push_back(m_editUnitCellAction); m_editUnitCellAction->setProperty("menu priority", 190); m_wrapAtomsToCellAction->setText(tr("&Wrap Atoms to Unit Cell")); - connect(m_wrapAtomsToCellAction, SIGNAL(triggered()), - SLOT(wrapAtomsToCell())); + connect(m_wrapAtomsToCellAction, &QAction::triggered, this, + &Crystal::wrapAtomsToCell); m_actions.push_back(m_wrapAtomsToCellAction); m_wrapAtomsToCellAction->setProperty("menu priority", 180); m_standardOrientationAction->setText(tr("Rotate to Standard &Orientation")); - connect(m_standardOrientationAction, SIGNAL(triggered()), - SLOT(standardOrientation())); + connect(m_standardOrientationAction, &QAction::triggered, this, + &Crystal::standardOrientation); m_actions.push_back(m_standardOrientationAction); m_standardOrientationAction->setProperty("menu priority", 170); m_scaleVolumeAction->setText(tr("Scale Cell &Volume…")); - connect(m_scaleVolumeAction, SIGNAL(triggered()), SLOT(scaleVolume())); + connect(m_scaleVolumeAction, &QAction::triggered, this, + &Crystal::scaleVolume); m_actions.push_back(m_scaleVolumeAction); m_scaleVolumeAction->setProperty("menu priority", 160); m_buildSupercellAction->setText(tr("Build &Supercell…")); - connect(m_buildSupercellAction, SIGNAL(triggered()), SLOT(buildSupercell())); + connect(m_buildSupercellAction, &QAction::triggered, this, + &Crystal::buildSupercell); m_actions.push_back(m_buildSupercellAction); m_buildSupercellAction->setProperty("menu priority", 150); m_niggliReduceAction->setText(tr("Reduce Cell (&Niggli)")); - connect(m_niggliReduceAction, SIGNAL(triggered()), SLOT(niggliReduce())); + connect(m_niggliReduceAction, &QAction::triggered, this, + &Crystal::niggliReduce); m_actions.push_back(m_niggliReduceAction); m_niggliReduceAction->setProperty("menu priority", 140); @@ -116,7 +121,8 @@ void Crystal::setMolecule(QtGui::Molecule* mol) m_unitCellDialog->setMolecule(m_molecule); if (m_molecule) - connect(m_molecule, SIGNAL(changed(uint)), SLOT(moleculeChanged(uint))); + connect(m_molecule, &QtGui::Molecule::changed, this, + &Crystal::moleculeChanged); updateActions(); } diff --git a/avogadro/qtplugins/crystal/crystalscene.cpp b/avogadro/qtplugins/crystal/crystalscene.cpp index 4c9530f5c1..8c9ca62c17 100644 --- a/avogadro/qtplugins/crystal/crystalscene.cpp +++ b/avogadro/qtplugins/crystal/crystalscene.cpp @@ -176,11 +176,12 @@ QWidget* CrystalScene::setupWidget() auto* multiColor = new QCheckBox; multiColor->setChecked(m_multiColor); form->addRow(tr("Color axes:"), multiColor); - connect(multiColor, SIGNAL(toggled(bool)), SLOT(setMultiColor(bool))); + connect(multiColor, &QAbstractButton::toggled, this, + &CrystalScene::setMultiColor); auto* color = new QtGui::ColorButton; - connect(color, SIGNAL(colorChanged(const QColor&)), - SLOT(setColor(const QColor&))); + connect(color, &QtGui::ColorButton::colorChanged, this, + &CrystalScene::setColor); form->addRow(tr("Line color:"), color); v->addLayout(form); diff --git a/avogadro/qtplugins/crystal/unitcelldialog.cpp b/avogadro/qtplugins/crystal/unitcelldialog.cpp index 6c55053d14..787b228d6c 100644 --- a/avogadro/qtplugins/crystal/unitcelldialog.cpp +++ b/avogadro/qtplugins/crystal/unitcelldialog.cpp @@ -27,7 +27,7 @@ const char MATRIX_FMT = 'f'; // Valid value separators in matrix editors: const static QRegularExpression MATRIX_SEP( R"(\s|,|;|\||\[|\]|\{|\}|\(|\)|\&|/|<|>)"); -} +} // namespace namespace Avogadro::QtPlugins { @@ -44,13 +44,15 @@ UnitCellDialog::UnitCellDialog(QWidget* p) connect(m_ui->beta, SIGNAL(valueChanged(double)), SLOT(parametersEdited())); connect(m_ui->gamma, SIGNAL(valueChanged(double)), SLOT(parametersEdited())); - connect(m_ui->cellMatrix, SIGNAL(textChanged()), SLOT(cellMatrixEdited())); + connect(m_ui->cellMatrix, &QPlainTextEdit::textChanged, this, + &UnitCellDialog::cellMatrixEdited); - connect(m_ui->fractionalMatrix, SIGNAL(textChanged()), - SLOT(fractionalMatrixEdited())); + connect(m_ui->fractionalMatrix, &QPlainTextEdit::textChanged, this, + &UnitCellDialog::fractionalMatrixEdited); - connect(m_ui->apply, SIGNAL(clicked()), SLOT(apply())); - connect(m_ui->revert, SIGNAL(clicked()), SLOT(revert())); + connect(m_ui->apply, &QAbstractButton::clicked, this, &UnitCellDialog::apply); + connect(m_ui->revert, &QAbstractButton::clicked, this, + &UnitCellDialog::revert); } UnitCellDialog::~UnitCellDialog() @@ -67,7 +69,8 @@ void UnitCellDialog::setMolecule(QtGui::Molecule* molecule) m_molecule = molecule; if (m_molecule) - connect(m_molecule, SIGNAL(changed(uint)), SLOT(moleculeChanged(uint))); + connect(m_molecule, &QtGui::Molecule::changed, this, + &UnitCellDialog::moleculeChanged); revert(); } @@ -366,4 +369,4 @@ Matrix3 UnitCellDialog::stringToMatrix(const QString& str) return result; } -} // namespace Avogadro +} // namespace Avogadro::QtPlugins diff --git a/avogadro/qtplugins/customelements/customelements.cpp b/avogadro/qtplugins/customelements/customelements.cpp index 08b0222421..d1f0f1c26d 100644 --- a/avogadro/qtplugins/customelements/customelements.cpp +++ b/avogadro/qtplugins/customelements/customelements.cpp @@ -18,14 +18,13 @@ CustomElements::CustomElements(QObject* parent_) : Avogadro::QtGui::ExtensionPlugin(parent_), m_molecule(nullptr), m_reassignAction(new QAction(tr("Reassign &Custom Elements…"), this)) { - connect(m_reassignAction, SIGNAL(triggered()), SLOT(reassign())); + connect(m_reassignAction, &QAction::triggered, this, + &CustomElements::reassign); updateReassignAction(); } -CustomElements::~CustomElements() -{ -} +CustomElements::~CustomElements() {} QString CustomElements::description() const { @@ -51,7 +50,8 @@ void CustomElements::setMolecule(QtGui::Molecule* mol) m_molecule = mol; if (m_molecule) - connect(m_molecule, SIGNAL(changed(uint)), SLOT(moleculeChanged(uint))); + connect(m_molecule, &QtGui::Molecule::changed, this, + &CustomElements::moleculeChanged); updateReassignAction(); } @@ -79,4 +79,4 @@ void CustomElements::updateReassignAction() m_reassignAction->setEnabled(m_molecule && m_molecule->hasCustomElements()); } -} // namespace Avogadro +} // namespace Avogadro::QtPlugins diff --git a/avogadro/qtplugins/dipole/dipole.cpp b/avogadro/qtplugins/dipole/dipole.cpp index 515a85c955..7690e315e1 100644 --- a/avogadro/qtplugins/dipole/dipole.cpp +++ b/avogadro/qtplugins/dipole/dipole.cpp @@ -36,7 +36,7 @@ void Dipole::process(const QtGui::Molecule& molecule, { // check if the molecule is empty // (single atoms don't have a dipole moment) - if (molecule.atomCount() < 0) + if (molecule.atomCount() < 2) return; // check if the molecule has the dipole set @@ -46,7 +46,8 @@ void Dipole::process(const QtGui::Molecule& molecule, } else { // connect to molecule changes connect(&molecule, &QtGui::Molecule::update, this, &Dipole::updateDipole); - connect(&molecule, SIGNAL(changed(unsigned int)), SLOT(updateDipole())); + connect(&molecule, &QtGui::Molecule::changed, this, + &Dipole::updateDipole); } } else { // custom dipole moment set @@ -89,7 +90,7 @@ void Dipole::updateDipole() m_dipoleVector = Calc::ChargeManager::instance().dipoleMoment(m_type, *molecule); // single-shot - QTimer::singleShot(0, this, SLOT(updateFinished())); + QTimer::singleShot(0, this, &Dipole::updateFinished); } } diff --git a/avogadro/qtplugins/editor/editor.cpp b/avogadro/qtplugins/editor/editor.cpp index f76eae113b..3c97df00fb 100644 --- a/avogadro/qtplugins/editor/editor.cpp +++ b/avogadro/qtplugins/editor/editor.cpp @@ -204,7 +204,7 @@ QUndoCommand* Editor::keyPressEvent(QKeyEvent* e) } // Set a timer to clear the buffer on first keypress: if (m_keyPressBuffer.isEmpty()) - QTimer::singleShot(2000, this, SLOT(clearKeyPressBuffer())); + QTimer::singleShot(2000, this, &Editor::clearKeyPressBuffer); m_keyPressBuffer.append(m_keyPressBuffer.isEmpty() ? e->text().toUpper() : e->text().toLower()); diff --git a/avogadro/qtplugins/editor/editortoolwidget.cpp b/avogadro/qtplugins/editor/editortoolwidget.cpp index 73c81796af..24bb0b711c 100644 --- a/avogadro/qtplugins/editor/editortoolwidget.cpp +++ b/avogadro/qtplugins/editor/editortoolwidget.cpp @@ -91,8 +91,8 @@ void EditorToolWidget::elementChanged(int index) if (itemData.toInt() == ELEMENT_SELECTOR_TAG) { if (!m_elementSelector) { m_elementSelector = new QtGui::PeriodicTableView(this); - connect(m_elementSelector, SIGNAL(elementChanged(int)), this, - SLOT(elementSelectedFromTable(int))); + connect(m_elementSelector, &QtGui::PeriodicTableView::elementChanged, + this, &EditorToolWidget::elementSelectedFromTable); } m_elementSelector->setElement(m_currentElement); m_elementSelector->show(); @@ -121,9 +121,10 @@ void EditorToolWidget::updateElementCombo() // Clear and repopulate combo m_ui->element->clear(); foreach (unsigned char atomicNum, allElements) { - m_ui->element->addItem( - QString("%1 (%2)").arg(QtGui::ElementTranslator::name(atomicNum)).arg(atomicNum), - atomicNum); + m_ui->element->addItem(QString("%1 (%2)") + .arg(QtGui::ElementTranslator::name(atomicNum)) + .arg(atomicNum), + atomicNum); } m_ui->element->insertSeparator(m_ui->element->count()); m_ui->element->addItem(tr("Other…"), ELEMENT_SELECTOR_TAG); @@ -220,4 +221,4 @@ void EditorToolWidget::saveElements() QSettings().setValue("editortool/userElements", atomicNums); } -} // namespace Avogadro +} // namespace Avogadro::QtPlugins diff --git a/avogadro/qtplugins/fetchpdb/fetchpdb.cpp b/avogadro/qtplugins/fetchpdb/fetchpdb.cpp index 8b43c92e17..3e9eaf763b 100644 --- a/avogadro/qtplugins/fetchpdb/fetchpdb.cpp +++ b/avogadro/qtplugins/fetchpdb/fetchpdb.cpp @@ -26,7 +26,7 @@ FetchPDB::FetchPDB(QObject* parent_) m_action->setEnabled(true); m_action->setText("Fetch from &PDB…"); m_action->setProperty("menu priority", 180); - connect(m_action, SIGNAL(triggered()), SLOT(showDialog())); + connect(m_action, &QAction::triggered, this, &FetchPDB::showDialog); } FetchPDB::~FetchPDB() {} @@ -93,8 +93,8 @@ void FetchPDB::showDialog() if (!m_network) { m_network = new QNetworkAccessManager(this); - connect(m_network, SIGNAL(finished(QNetworkReply*)), this, - SLOT(replyFinished(QNetworkReply*))); + connect(m_network, &QNetworkAccessManager::finished, this, + &FetchPDB::replyFinished); } // Hard coding the PDB download URL diff --git a/avogadro/qtplugins/focus/focus.cpp b/avogadro/qtplugins/focus/focus.cpp index 3a8e3b59f1..b06d0703c7 100644 --- a/avogadro/qtplugins/focus/focus.cpp +++ b/avogadro/qtplugins/focus/focus.cpp @@ -25,8 +25,9 @@ Focus::Focus(QObject* parent_) m_focusSelectionAction->setProperty("menu priority", 200); m_unfocusAction->setProperty("menu priority", 200); - connect(m_focusSelectionAction, SIGNAL(triggered()), SLOT(focusSelection())); - connect(m_unfocusAction, SIGNAL(triggered()), SLOT(unfocus())); + connect(m_focusSelectionAction, &QAction::triggered, this, + &Focus::focusSelection); + connect(m_unfocusAction, &QAction::triggered, this, &Focus::unfocus); } Focus::~Focus() {} @@ -86,7 +87,7 @@ void Focus::focusSelection() return; if (m_molecule->isSelectionEmpty()) return; - + Eigen::Vector3f selectionCenter(0, 0, 0); std::vector selection; for (Index i = 0; i < m_molecule->atomCount(); ++i) { @@ -101,9 +102,9 @@ void Focus::focusSelection() Eigen::Vector3f pos = m_molecule->atomPosition3d(i).cast(); float distance = (pos - selectionCenter).norm(); if (distance > selectionRadius) - selectionRadius = distance; + selectionRadius = distance; } - + newFocus(selectionCenter, selectionRadius + 10.0f); emit updateRequested(); } @@ -112,9 +113,9 @@ void Focus::unfocus() { if (!m_camera || !m_scene) return; - + newFocus(m_scene->center(), 2.22f * m_scene->radius()); emit updateRequested(); } -} // namespace Avogadro +} // namespace Avogadro::QtPlugins diff --git a/avogadro/qtplugins/forcefield/forcefield.cpp b/avogadro/qtplugins/forcefield/forcefield.cpp index ce779507ae..cdade3c035 100644 --- a/avogadro/qtplugins/forcefield/forcefield.cpp +++ b/avogadro/qtplugins/forcefield/forcefield.cpp @@ -72,7 +72,7 @@ Forcefield::Forcefield(QObject* parent_) action->setShortcut(QKeySequence("Ctrl+Alt+O")); action->setData(optimizeAction); action->setProperty("menu priority", 920); - connect(action, SIGNAL(triggered()), SLOT(optimize())); + connect(action, &QAction::triggered, this, &Forcefield::optimize); m_actions.push_back(action); action = new QAction(this); @@ -80,7 +80,7 @@ Forcefield::Forcefield(QObject* parent_) action->setText(tr("Energy")); // calculate energy action->setData(energyAction); action->setProperty("menu priority", 910); - connect(action, SIGNAL(triggered()), SLOT(energy())); + connect(action, &QAction::triggered, this, &Forcefield::energy); m_actions.push_back(action); action = new QAction(this); @@ -88,7 +88,7 @@ Forcefield::Forcefield(QObject* parent_) action->setText(tr("Forces")); // calculate gradients action->setData(forcesAction); action->setProperty("menu priority", 910); - connect(action, SIGNAL(triggered()), SLOT(forces())); + connect(action, &QAction::triggered, this, &Forcefield::forces); m_actions.push_back(action); action = new QAction(this); @@ -96,7 +96,7 @@ Forcefield::Forcefield(QObject* parent_) action->setText(tr("Configure…")); action->setData(configureAction); action->setProperty("menu priority", 900); - connect(action, SIGNAL(triggered()), SLOT(showDialog())); + connect(action, &QAction::triggered, this, &Forcefield::showDialog); m_actions.push_back(action); action = new QAction(this); @@ -107,14 +107,14 @@ Forcefield::Forcefield(QObject* parent_) action->setEnabled(true); action->setText(tr("Freeze Selected Atoms")); action->setData(freezeAction); - connect(action, SIGNAL(triggered()), SLOT(freezeSelected())); + connect(action, &QAction::triggered, this, &Forcefield::freezeSelected); m_actions.push_back(action); action = new QAction(this); action->setEnabled(true); action->setText(tr("Unfreeze Selected Atoms")); action->setData(unfreezeAction); - connect(action, SIGNAL(triggered()), SLOT(unfreezeSelected())); + connect(action, &QAction::triggered, this, &Forcefield::unfreezeSelected); m_actions.push_back(action); // initialize the calculators diff --git a/avogadro/qtplugins/forcefield/forcefielddialog.cpp b/avogadro/qtplugins/forcefield/forcefielddialog.cpp index 6997467780..dde522d41c 100644 --- a/avogadro/qtplugins/forcefield/forcefielddialog.cpp +++ b/avogadro/qtplugins/forcefield/forcefielddialog.cpp @@ -24,8 +24,8 @@ ForceFieldDialog::ForceFieldDialog(const QStringList& forceFields, ui->forceField->addItems(forceFields); updateRecommendedForceField(); - connect(ui->useRecommended, SIGNAL(toggled(bool)), - SLOT(useRecommendedForceFieldToggled(bool))); + connect(ui->useRecommended, &QAbstractButton::toggled, this, + &ForceFieldDialog::useRecommendedForceFieldToggled); QSettings settings; bool autoDetect = diff --git a/avogadro/qtplugins/forcefield/obmmenergy.cpp b/avogadro/qtplugins/forcefield/obmmenergy.cpp index 49c67194be..f8f3c22478 100644 --- a/avogadro/qtplugins/forcefield/obmmenergy.cpp +++ b/avogadro/qtplugins/forcefield/obmmenergy.cpp @@ -18,12 +18,12 @@ namespace Avogadro::QtPlugins { OBMMEnergy::OBMMEnergy(const std::string& method) - : m_identifier(method), m_name(method), m_process(nullptr), - m_molecule(nullptr), + : m_molecule(nullptr), m_process(nullptr), m_executable("obmm"), + m_identifier(method), #if defined(_WIN32) m_executable("obmm.exe") #else - m_executable("obmm") + m_name(method) #endif { // eventually CJSON might be nice diff --git a/avogadro/qtplugins/forcefield/scriptenergy.cpp b/avogadro/qtplugins/forcefield/scriptenergy.cpp index 1a117b94a2..d81ea28af8 100644 --- a/avogadro/qtplugins/forcefield/scriptenergy.cpp +++ b/avogadro/qtplugins/forcefield/scriptenergy.cpp @@ -30,8 +30,8 @@ namespace Avogadro::QtPlugins { ScriptEnergy::ScriptEnergy(const QString& scriptFileName_) - : m_interpreter(new QtGui::PythonScript(scriptFileName_)), m_valid(true), - m_inputFormat(NotUsed), m_gradients(false), m_ions(false), + : m_interpreter(new QtGui::PythonScript(scriptFileName_)), + m_inputFormat(NotUsed), m_valid(true), m_gradients(false), m_ions(false), m_radicals(false), m_unitCells(false) { m_elements.reset(); diff --git a/avogadro/qtplugins/gamessinput/gamessinput.cpp b/avogadro/qtplugins/gamessinput/gamessinput.cpp index 4328bd0188..598ef463f1 100644 --- a/avogadro/qtplugins/gamessinput/gamessinput.cpp +++ b/avogadro/qtplugins/gamessinput/gamessinput.cpp @@ -32,7 +32,7 @@ GamessInput::GamessInput(QObject* parent_) { m_action->setEnabled(true); m_action->setText(tr("&GAMESS…")); - connect(m_action, SIGNAL(triggered()), SLOT(menuActivated())); + connect(m_action, &QAction::triggered, this, &GamessInput::menuActivated); } GamessInput::~GamessInput() {} @@ -99,8 +99,8 @@ void GamessInput::menuActivated() { if (!m_dialog) { m_dialog = new GamessInputDialog(qobject_cast(parent())); - connect(m_dialog, SIGNAL(openJobOutput(Avogadro::MoleQueue::JobObject)), - this, SLOT(openJobOutput(Avogadro::MoleQueue::JobObject))); + connect(m_dialog, &GamessInputDialog::openJobOutput, this, + &GamessInput::openJobOutput); } m_dialog->setMolecule(m_molecule); m_dialog->show(); diff --git a/avogadro/qtplugins/gamessinput/gamessinputdialog.cpp b/avogadro/qtplugins/gamessinput/gamessinputdialog.cpp index 2d2297da42..9dbf18f9fa 100644 --- a/avogadro/qtplugins/gamessinput/gamessinputdialog.cpp +++ b/avogadro/qtplugins/gamessinput/gamessinputdialog.cpp @@ -129,8 +129,10 @@ void GamessInputDialog::setMolecule(QtGui::Molecule* mol) m_molecule = mol; - connect(mol, SIGNAL(changed(unsigned int)), SLOT(updatePreviewText())); - connect(mol, SIGNAL(changed(unsigned int)), SLOT(updateTitlePlaceholder())); + connect(mol, &QtGui::Molecule::changed, this, + &GamessInputDialog::updatePreviewText); + connect(mol, &QtGui::Molecule::changed, this, + &GamessInputDialog::updateTitlePlaceholder); updateTitlePlaceholder(); updatePreviewText(); @@ -143,13 +145,13 @@ void GamessInputDialog::showEvent(QShowEvent* e) // Update the preview text if an update was requested while hidden. Use a // single shot to allow the dialog to show before popping up any warnings. if (m_updatePending) - QTimer::singleShot(0, this, SLOT(updatePreviewText())); + QTimer::singleShot(0, this, &GamessInputDialog::updatePreviewText); } void GamessInputDialog::connectBasic() { - connect(ui.titleEdit, SIGNAL(textChanged(QString)), this, - SLOT(updatePreviewText())); + connect(ui.titleEdit, &QLineEdit::textChanged, this, + &GamessInputDialog::updatePreviewText); connect(ui.calculateCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updatePreviewText())); connect(ui.calculateCombo, SIGNAL(currentIndexChanged(int)), this, @@ -174,11 +176,15 @@ void GamessInputDialog::connectPreview() {} void GamessInputDialog::connectButtons() { - connect(ui.resetAllButton, SIGNAL(clicked()), SLOT(resetClicked())); - connect(ui.defaultsButton, SIGNAL(clicked()), SLOT(defaultsClicked())); - connect(ui.generateButton, SIGNAL(clicked()), SLOT(generateClicked())); - connect(ui.computeButton, SIGNAL(clicked()), SLOT(computeClicked())); - connect(ui.closeButton, SIGNAL(clicked()), SLOT(close())); + connect(ui.resetAllButton, &QAbstractButton::clicked, this, + &GamessInputDialog::resetClicked); + connect(ui.defaultsButton, &QAbstractButton::clicked, this, + &GamessInputDialog::defaultsClicked); + connect(ui.generateButton, &QAbstractButton::clicked, this, + &GamessInputDialog::generateClicked); + connect(ui.computeButton, &QAbstractButton::clicked, this, + &GamessInputDialog::computeClicked); + connect(ui.closeButton, &QAbstractButton::clicked, this, &QWidget::close); } void GamessInputDialog::buildOptions() diff --git a/avogadro/qtplugins/hydrogens/hydrogens.cpp b/avogadro/qtplugins/hydrogens/hydrogens.cpp index b4cb3a2c7a..11a219dadf 100644 --- a/avogadro/qtplugins/hydrogens/hydrogens.cpp +++ b/avogadro/qtplugins/hydrogens/hydrogens.cpp @@ -8,8 +8,8 @@ #include #include -#include #include +#include #include @@ -21,28 +21,26 @@ Hydrogens::Hydrogens(QObject* parent_) auto* action = new QAction(tr("&Adjust Hydrogens"), this); action->setShortcut(QKeySequence("Ctrl+Alt+H")); action->setProperty("menu priority", 760); - connect(action, SIGNAL(triggered()), SLOT(adjustHydrogens())); + connect(action, &QAction::triggered, this, &Hydrogens::adjustHydrogens); m_actions.append(action); action = new QAction(tr("Add Hydrogens"), this); action->setProperty("menu priority", 750); - connect(action, SIGNAL(triggered()), SLOT(addHydrogens())); + connect(action, &QAction::triggered, this, &Hydrogens::addHydrogens); m_actions.append(action); action = new QAction(tr("Remove E&xtra Hydrogens"), this); action->setProperty("menu priority", 740); - connect(action, SIGNAL(triggered()), SLOT(removeHydrogens())); + connect(action, &QAction::triggered, this, &Hydrogens::removeHydrogens); m_actions.append(action); action = new QAction(tr("&Remove All Hydrogens"), this); action->setProperty("menu priority", 730); - connect(action, SIGNAL(triggered()), SLOT(removeAllHydrogens())); + connect(action, &QAction::triggered, this, &Hydrogens::removeAllHydrogens); m_actions.append(action); } -Hydrogens::~Hydrogens() -{ -} +Hydrogens::~Hydrogens() {} QString Hydrogens::description() const { @@ -107,4 +105,4 @@ void Hydrogens::removeAllHydrogens() } } -} // namespace Avogadro +} // namespace Avogadro::QtPlugins diff --git a/avogadro/qtplugins/importpqr/importpqr.cpp b/avogadro/qtplugins/importpqr/importpqr.cpp index 8038ca713a..9c8aa62b39 100644 --- a/avogadro/qtplugins/importpqr/importpqr.cpp +++ b/avogadro/qtplugins/importpqr/importpqr.cpp @@ -23,11 +23,11 @@ ImportPQR::ImportPQR(QObject* parent_) { m_action->setEnabled(false); m_action->setText(tr("&Search PQR…")); - connect(m_action, SIGNAL(triggered()), SLOT(menuActivated())); + connect(m_action, &QAction::triggered, this, &ImportPQR::menuActivated); // check if PQR is up - connect(m_manager, SIGNAL(finished(QNetworkReply*)), - SLOT(checkAccess(QNetworkReply*))); + connect(m_manager, &QNetworkAccessManager::finished, this, + &ImportPQR::checkAccess); m_manager->get(QNetworkRequest(QUrl("https://pqr.pitt.edu"))); } diff --git a/avogadro/qtplugins/importpqr/pqrrequest.cpp b/avogadro/qtplugins/importpqr/pqrrequest.cpp index 76753cb986..fadd3952e8 100644 --- a/avogadro/qtplugins/importpqr/pqrrequest.cpp +++ b/avogadro/qtplugins/importpqr/pqrrequest.cpp @@ -9,9 +9,9 @@ using json = nlohmann::json; namespace Avogadro::QtPlugins { /** -* @brief Constructor to initialize the NetworkAccessManager and set pointers to -* the widget's ui elements. -*/ + * @brief Constructor to initialize the NetworkAccessManager and set pointers to + * the widget's ui elements. + */ PQRRequest::PQRRequest(QTableWidget* tw, QLabel* gv, QLineEdit* nd, QLabel* fd, PQRWidget* w) { @@ -27,51 +27,51 @@ PQRRequest::PQRRequest(QTableWidget* tw, QLabel* gv, QLineEdit* nd, QLabel* fd, } /** -* @brief Free the ui pointers -*/ + * @brief Free the ui pointers + */ PQRRequest::~PQRRequest() { delete oNetworkAccessManager; } /** -* @brief Sends a network request to search for molecules from PQR; -* @param url The url to query -*/ + * @brief Sends a network request to search for molecules from PQR; + * @param url The url to query + */ void PQRRequest::sendRequest(QString url) { reply = oNetworkAccessManager->get(QNetworkRequest(QUrl(url))); - connect(reply, SIGNAL(finished()), this, SLOT(parseJson())); + connect(reply, &QNetworkReply::finished, this, &PQRRequest::parseJson); } /** -* @brief Sends a network request to download a file from PQR -* @param url The url to send the request to -* @param mol2 The mol2 representation of the molecule to download -*/ + * @brief Sends a network request to download a file from PQR + * @param url The url to send the request to + * @param mol2 The mol2 representation of the molecule to download + */ void PQRRequest::sendRequest(QString url, QString) { reply = oNetworkAccessManager->get(QNetworkRequest(QUrl(url))); currentMolName = nameDisplay->text(); // needed to load mol into Avogadro - connect(reply, SIGNAL(finished()), this, SLOT(getFile())); + connect(reply, &QNetworkReply::finished, this, &PQRRequest::getFile); } /** -* @brief Sends a network request to download a png form PQR -* @param url The url to send the request to -*/ + * @brief Sends a network request to download a png form PQR + * @param url The url to send the request to + */ void PQRRequest::sendPNGRequest(QString url) { reply = oNetworkAccessManager->get(QNetworkRequest(QUrl(url))); - connect(reply, SIGNAL(finished()), this, SLOT(SetPNG())); + connect(reply, &QNetworkReply::finished, this, &PQRRequest::SetPNG); } /** -* @brief Called when a molecule is selected to display information about the -* molecule and start grabbing the SVG preview. -* @param num The row number of the table result selected -* @returns The mol2 of the result for the widget to reference -*/ + * @brief Called when a molecule is selected to display information about the + * molecule and start grabbing the SVG preview. + * @param num The row number of the table result selected + * @returns The mol2 of the result for the widget to reference + */ QString PQRRequest::molSelected(int num) { if (results.empty() || num > static_cast(results.size())) @@ -88,8 +88,8 @@ QString PQRRequest::molSelected(int num) } /** -* @brief Parses the JSON response from querying PQR -*/ + * @brief Parses the JSON response from querying PQR + */ void PQRRequest::parseJson() { if (reply->error() == QNetworkReply::NoError) { @@ -152,8 +152,8 @@ void PQRRequest::parseJson() } /** -* @brief Creates a file after requesting a file from PQR -*/ + * @brief Creates a file after requesting a file from PQR + */ void PQRRequest::getFile() { QByteArray molData = reply->readAll(); @@ -162,8 +162,8 @@ void PQRRequest::getFile() } /** -* @brief Loads PNG data after sending a request -*/ + * @brief Loads PNG data after sending a request + */ void PQRRequest::SetPNG() { QByteArray pngData = reply->readAll(); @@ -172,9 +172,9 @@ void PQRRequest::SetPNG() } /** -* @brief Takes a formula string and returns a QString with subscript tags -* @param formula The formula string -*/ + * @brief Takes a formula string and returns a QString with subscript tags + * @param formula The formula string + */ QString PQRRequest::parseSubscripts(QString formula) { std::string str = formula.toStdString(); @@ -192,9 +192,9 @@ QString PQRRequest::parseSubscripts(QString formula) } /** -* @brief Takes a formula string and returns the molecular mass of the molecule -* @param formula The formula string -*/ + * @brief Takes a formula string and returns the molecular mass of the molecule + * @param formula The formula string + */ float PQRRequest::getMolMass(QString formula) { std::string str = formula.toStdString(); @@ -244,4 +244,4 @@ float PQRRequest::getMolMass(QString formula) } return totalMass; } -} // namespace Avogadro +} // namespace Avogadro::QtPlugins diff --git a/avogadro/qtplugins/importpqr/pqrwidget.cpp b/avogadro/qtplugins/importpqr/pqrwidget.cpp index 2156da1ed5..d643b5cf25 100644 --- a/avogadro/qtplugins/importpqr/pqrwidget.cpp +++ b/avogadro/qtplugins/importpqr/pqrwidget.cpp @@ -19,10 +19,12 @@ PQRWidget::PQRWidget(QWidget* parent, ImportPQR* p) ui->tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); ui->tableWidget->setSortingEnabled(true); - connect(ui->searchButton, SIGNAL(clicked(bool)), this, SLOT(searchAction())); - connect(ui->downloadButton, SIGNAL(clicked(bool)), this, SLOT(downloadMol())); - connect(ui->tableWidget, SIGNAL(cellClicked(int, int)), this, - SLOT(molSelected(int, int))); + connect(ui->searchButton, &QAbstractButton::clicked, this, + &PQRWidget::searchAction); + connect(ui->downloadButton, &QAbstractButton::clicked, this, + &PQRWidget::downloadMol); + connect(ui->tableWidget, &QTableWidget::cellClicked, this, + &PQRWidget::molSelected); request = new PQRRequest(ui->tableWidget, ui->pngPreview, ui->nameDisplay, ui->formulaDisplay, this); @@ -35,8 +37,8 @@ PQRWidget::~PQRWidget() } /** -* @brief Called when the search button is clicked to send a query to PQR -*/ + * @brief Called when the search button is clicked to send a query to PQR + */ void PQRWidget::searchAction() { ui->downloadButton->setEnabled(false); @@ -46,12 +48,12 @@ void PQRWidget::searchAction() } /** -* @brief Called when a table result is double clicked to display preview -* information -* about the result before downloading. -* @param row The row of the result selected. -* @param col The column of the result selected. -*/ + * @brief Called when a table result is double clicked to display preview + * information + * about the result before downloading. + * @param row The row of the result selected. + * @param col The column of the result selected. + */ void PQRWidget::molSelected(int row, int) { currentlySelectedMol = request->molSelected(row); @@ -62,8 +64,8 @@ void PQRWidget::molSelected(int row, int) } /** -* @brief Called when PNG data is ready to be loaded -*/ + * @brief Called when PNG data is ready to be loaded + */ void PQRWidget::loadPNG(QByteArray& pngData) { QPixmap pixmap; @@ -74,10 +76,10 @@ void PQRWidget::loadPNG(QByteArray& pngData) } /** -* @brief Called when the download button is clicked to send a request to -* download -* molecule information from PQR. -*/ + * @brief Called when the download button is clicked to send a request to + * download + * molecule information from PQR. + */ void PQRWidget::downloadMol() { QString mol2url = currentlySelectedMol; @@ -93,4 +95,4 @@ void PQRWidget::loadMolecule(QByteArray& molData, QString name) plugin->setMoleculeData(molData, name); } -} // namespace Avogadro +} // namespace Avogadro::QtPlugins diff --git a/avogadro/qtplugins/insertdna/insertdna.cpp b/avogadro/qtplugins/insertdna/insertdna.cpp index 2e539d5b09..b1ce235488 100644 --- a/avogadro/qtplugins/insertdna/insertdna.cpp +++ b/avogadro/qtplugins/insertdna/insertdna.cpp @@ -42,7 +42,7 @@ InsertDna::InsertDna(QObject* p) { auto* action = new QAction(tr("DNA/RNA…"), this); action->setProperty("menu priority", 870); - connect(action, SIGNAL(triggered()), SLOT(showDialog())); + connect(action, &QAction::triggered, this, &InsertDna::showDialog); m_actions.append(action); } @@ -101,8 +101,8 @@ void InsertDna::constructDialog() numStrands->addButton(m_dialog->doubleStrandRadio, 1); numStrands->setExclusive(true); - connect(m_dialog->insertButton, SIGNAL(clicked()), this, - SLOT(performInsert())); + connect(m_dialog->insertButton, &QAbstractButton::clicked, this, + &InsertDna::performInsert); connect(m_dialog->bpCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateBPTurns(int))); @@ -112,9 +112,9 @@ void InsertDna::constructDialog() // Set the nucleic buttons to update the sequence foreach (const QToolButton* child, m_dialog->findChildren()) { - connect(child, SIGNAL(clicked()), this, SLOT(updateText())); + connect(child, &QAbstractButton::clicked, this, &InsertDna::updateText); } - connect(m_dialog, SIGNAL(destroyed()), this, SLOT(dialogDestroyed())); + connect(m_dialog, &QObject::destroyed, this, &InsertDna::dialogDestroyed); } m_dialog->sequenceText->setPlainText(QString()); } diff --git a/avogadro/qtplugins/insertfragment/insertfragment.cpp b/avogadro/qtplugins/insertfragment/insertfragment.cpp index 7c9a42895f..5af8eacd34 100644 --- a/avogadro/qtplugins/insertfragment/insertfragment.cpp +++ b/avogadro/qtplugins/insertfragment/insertfragment.cpp @@ -26,19 +26,19 @@ using Avogadro::QtGui::Molecule; namespace Avogadro::QtPlugins { InsertFragment::InsertFragment(QObject* parent_) - : Avogadro::QtGui::ExtensionPlugin(parent_), m_crystalDialog(nullptr), - m_moleculeDialog(nullptr), m_reader(nullptr), m_molecule(nullptr) + : Avogadro::QtGui::ExtensionPlugin(parent_), m_moleculeDialog(nullptr), + m_crystalDialog(nullptr), m_molecule(nullptr), m_reader(nullptr) { auto* action = new QAction(tr("Molecule…"), this); action->setProperty("menu priority", 890); action->setData("molecules"); // will also work for crystals - connect(action, SIGNAL(triggered()), SLOT(showDialog())); + connect(action, &QAction::triggered, this, &InsertFragment::showDialog); m_actions.append(action); action = new QAction(tr("Crystal…"), this); action->setData("crystals"); // will also work for crystals action->setProperty("menu priority", 170); - connect(action, SIGNAL(triggered()), SLOT(showDialog())); + connect(action, &QAction::triggered, this, &InsertFragment::showDialog); m_actions.append(action); } diff --git a/avogadro/qtplugins/label/label.cpp b/avogadro/qtplugins/label/label.cpp index 57f59a7341..f59cf42e32 100644 --- a/avogadro/qtplugins/label/label.cpp +++ b/avogadro/qtplugins/label/label.cpp @@ -155,8 +155,8 @@ struct LayerLabel : Core::LayerData auto* form = new QFormLayout; // color button auto* colorButton = new QtGui::ColorButton; - QObject::connect(colorButton, SIGNAL(colorChanged(const QColor&)), slot, - SLOT(setColor(const QColor&))); + QObject::connect(colorButton, &QtGui::ColorButton::colorChanged, slot, + &Label::setColor); form->addRow(QObject::tr("Color:"), colorButton); // radius scalar diff --git a/avogadro/qtplugins/lammpsinput/lammpsinput.cpp b/avogadro/qtplugins/lammpsinput/lammpsinput.cpp index 40e14057d6..d7cd5fba91 100644 --- a/avogadro/qtplugins/lammpsinput/lammpsinput.cpp +++ b/avogadro/qtplugins/lammpsinput/lammpsinput.cpp @@ -28,12 +28,10 @@ LammpsInput::LammpsInput(QObject* parent_) { m_action->setEnabled(true); m_action->setText(tr("&LAMMPS…")); - connect(m_action, SIGNAL(triggered()), SLOT(menuActivated())); + connect(m_action, &QAction::triggered, this, &LammpsInput::menuActivated); } -LammpsInput::~LammpsInput() -{ -} +LammpsInput::~LammpsInput() {} QList LammpsInput::actions() const { @@ -81,5 +79,5 @@ void LammpsInput::menuActivated() m_dialog->setMolecule(m_molecule); m_dialog->show(); } -} -} +} // namespace QtPlugins +} // namespace Avogadro diff --git a/avogadro/qtplugins/lammpsinput/lammpsinputdialog.cpp b/avogadro/qtplugins/lammpsinput/lammpsinputdialog.cpp index 95da2615e0..495d09241a 100644 --- a/avogadro/qtplugins/lammpsinput/lammpsinputdialog.cpp +++ b/avogadro/qtplugins/lammpsinput/lammpsinputdialog.cpp @@ -54,7 +54,8 @@ LammpsInputDialog::LammpsInputDialog(QWidget* parent, Qt::WindowFlags flag) { ui.setupUi(this); // Connect the GUI elements to the correct slots - connect(ui.titleLine, SIGNAL(editingFinished()), this, SLOT(setTitle())); + connect(ui.titleLine, &QLineEdit::editingFinished, this, + &LammpsInputDialog::setTitle); // now for something useful connect(ui.unitsCombo, SIGNAL(currentIndexChanged(int)), this, @@ -71,8 +72,8 @@ LammpsInputDialog::LammpsInputDialog(QWidget* parent, Qt::WindowFlags flag) SLOT(setZBoundaryType(int))); connect(ui.waterPotentialCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setWaterPotential(int))); - connect(ui.readDataLine, SIGNAL(editingFinished()), this, - SLOT(setReadData())); + connect(ui.readDataLine, &QLineEdit::editingFinished, this, + &LammpsInputDialog::setReadData); connect(ui.ensembleCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setEnsemble(int))); connect(ui.tempSpin, SIGNAL(valueChanged(double)), this, @@ -88,25 +89,30 @@ LammpsInputDialog::LammpsInputDialog(QWidget* parent, Qt::WindowFlags flag) SLOT(setYReplicate(int))); connect(ui.zReplicateSpin, SIGNAL(valueChanged(int)), this, SLOT(setZReplicate(int))); - connect(ui.dumpXYZEdit, SIGNAL(editingFinished()), this, SLOT(setDumpXYZ())); + connect(ui.dumpXYZEdit, &QLineEdit::editingFinished, this, + &LammpsInputDialog::setDumpXYZ); connect(ui.dumpStepSpin, SIGNAL(valueChanged(int)), this, SLOT(setDumpStep(int))); connect(ui.velocityDistCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setVelocityDist(int))); connect(ui.velocityTempSpin, SIGNAL(valueChanged(double)), this, SLOT(setVelocityTemp(double))); - connect(ui.zeroMOMCheck, SIGNAL(toggled(bool)), this, SLOT(setZeroMOM(bool))); - connect(ui.zeroLCheck, SIGNAL(toggled(bool)), this, SLOT(setZeroL(bool))); + connect(ui.zeroMOMCheck, &QAbstractButton::toggled, this, + &LammpsInputDialog::setZeroMOM); + connect(ui.zeroLCheck, &QAbstractButton::toggled, this, + &LammpsInputDialog::setZeroL); connect(ui.thermoStyleCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setThermoStyle(int))); connect(ui.thermoSpin, SIGNAL(valueChanged(int)), this, SLOT(setThermoInterval(int))); - connect(ui.generateButton, SIGNAL(clicked()), this, SLOT(generateClicked())); - connect(ui.resetButton, SIGNAL(clicked()), this, SLOT(resetClicked())); + connect(ui.generateButton, &QAbstractButton::clicked, this, + &LammpsInputDialog::generateClicked); + connect(ui.resetButton, &QAbstractButton::clicked, this, + &LammpsInputDialog::resetClicked); - connect(ui.enableFormButton, SIGNAL(clicked()), this, - SLOT(enableFormClicked())); + connect(ui.enableFormButton, &QAbstractButton::clicked, this, + &LammpsInputDialog::enableFormClicked); QSettings settings; readSettings(settings); @@ -161,7 +167,8 @@ void LammpsInputDialog::updatePreviewText() m_jobEdit = new QTextEdit(this); m_jobEdit->setObjectName(m_jobFileName); m_jobEdit->setFontFamily("monospace"); - connect(m_jobEdit, SIGNAL(textChanged()), this, SLOT(textEditModified())); + connect(m_jobEdit, &QTextEdit::textChanged, this, + &LammpsInputDialog::textEditModified); m_jobEdit->setText(generateInputDeck()); ui.tabWidget->insertTab(jobTabPosition, m_jobEdit, m_jobFileName); deckDirty(false); @@ -310,8 +317,8 @@ void LammpsInputDialog::generateClicked() tr("The input files cannot be written:\n\n%1").arg(errors.first()); break; default: { - // If a fatal error occurred, it will be last one in the list. Pop it off - // and tell the user that it was the reason we had to stop. + // If a fatal error occurred, it will be last one in the list. Pop it + // off and tell the user that it was the reason we had to stop. QString fatal = errors.last(); QStringList tmp(errors); tmp.pop_back(); @@ -473,7 +480,8 @@ void LammpsInputDialog::setMolecule(QtGui::Molecule* molecule) m_molecule = molecule; // Update the preview text whenever primitives are changed - connect(molecule, SIGNAL(changed(unsigned int)), SLOT(updatePreviewText())); + connect(molecule, &QtGui::Molecule::changed, this, + &LammpsInputDialog::updatePreviewText); updatePreviewText(); } @@ -632,8 +640,8 @@ QString LammpsInputDialog::generateInputDeck() << "mom " << getZeroMOM() << " " << "dist " << getVelocityDist(m_velocityDist) << "\n"; mol << getEnsemble(m_ensemble) << "\n"; - mol << "timestep " << Qt::fixed << qSetRealNumberPrecision(1) << m_timeStep - << "\n"; + mol << "timestep " << Qt::fixed << qSetRealNumberPrecision(1) + << m_timeStep << "\n"; mol << "\n"; mol << "# Output\n"; @@ -853,9 +861,9 @@ QString LammpsInputDialog::getEnsemble(ensemble t) QString ensembleInput; QTextStream fix(&ensembleInput); fix << "fix ensemble all nvt" - << " temp " << Qt::fixed << qSetRealNumberPrecision(2) << m_temperature - << " " << Qt::fixed << qSetRealNumberPrecision(2) << m_temperature - << " 100 " + << " temp " << Qt::fixed << qSetRealNumberPrecision(2) + << m_temperature << " " << Qt::fixed << qSetRealNumberPrecision(2) + << m_temperature << " 100 " << "tchain " << m_nhChain << "\n"; return ensembleInput; } @@ -869,9 +877,9 @@ QString LammpsInputDialog::getEnsemble(ensemble t) QString ensembleInput; QTextStream fix(&ensembleInput); fix << "fix ensemble all nvt" - << " temp " << Qt::fixed << qSetRealNumberPrecision(2) << m_temperature - << " " << Qt::fixed << qSetRealNumberPrecision(2) << m_temperature - << " 100 " + << " temp " << Qt::fixed << qSetRealNumberPrecision(2) + << m_temperature << " " << Qt::fixed << qSetRealNumberPrecision(2) + << m_temperature << " 100 " << "tchain " << m_nhChain << "\n"; return ensembleInput; } @@ -964,4 +972,4 @@ void LammpsInputDialog::determineAtomTypesSPC(int& hyd, int& oxy) hyd = AtomType.value("O"); oxy = AtomType.value("H"); } -} +} // namespace Avogadro::QtPlugins diff --git a/avogadro/qtplugins/lineformatinput/lineformatinput.cpp b/avogadro/qtplugins/lineformatinput/lineformatinput.cpp index ca5837e798..1583b632ac 100644 --- a/avogadro/qtplugins/lineformatinput/lineformatinput.cpp +++ b/avogadro/qtplugins/lineformatinput/lineformatinput.cpp @@ -25,19 +25,19 @@ using Avogadro::QtGui::FileFormatDialog; namespace Avogadro::QtPlugins { LineFormatInput::LineFormatInput(QObject* parent_) - : Avogadro::QtGui::ExtensionPlugin(parent_), - m_molecule(nullptr), m_reader(nullptr) + : Avogadro::QtGui::ExtensionPlugin(parent_), m_molecule(nullptr), + m_reader(nullptr) { auto* action = new QAction(tr("SMILES…"), this); action->setProperty("menu priority", 800); action->setData("SMILES"); - connect(action, SIGNAL(triggered()), SLOT(showDialog())); + connect(action, &QAction::triggered, this, &LineFormatInput::showDialog); m_actions.append(action); action = new QAction(tr("InChI…"), this); action->setProperty("menu priority", 810); action->setData("InChI"); - connect(action, SIGNAL(triggered()), SLOT(showDialog())); + connect(action, &QAction::triggered, this, &LineFormatInput::showDialog); m_actions.append(action); // These are the line formats that we can load -- key is a user-friendly name, @@ -137,4 +137,4 @@ void LineFormatInput::showDialog() m_reader = nullptr; } -} // namespace Avogadro +} // namespace Avogadro::QtPlugins diff --git a/avogadro/qtplugins/manipulator/manipulator.cpp b/avogadro/qtplugins/manipulator/manipulator.cpp index 5eeeb9b761..49ba1ba6ff 100644 --- a/avogadro/qtplugins/manipulator/manipulator.cpp +++ b/avogadro/qtplugins/manipulator/manipulator.cpp @@ -54,8 +54,8 @@ Manipulator::Manipulator(QObject* parent_) "Right Mouse: \tClick and drag to rotate atoms.\n") .arg(shortcut)); setIcon(); - connect(m_toolWidget->buttonBox, SIGNAL(clicked(QAbstractButton*)), this, - SLOT(buttonClicked(QAbstractButton*))); + connect(m_toolWidget->buttonBox, &QDialogButtonBox::clicked, this, + &Manipulator::buttonClicked); } Manipulator::~Manipulator() {} diff --git a/avogadro/qtplugins/meshes/meshes.cpp b/avogadro/qtplugins/meshes/meshes.cpp index a99587fc5a..28bfea5091 100644 --- a/avogadro/qtplugins/meshes/meshes.cpp +++ b/avogadro/qtplugins/meshes/meshes.cpp @@ -80,24 +80,26 @@ void Meshes::process(const QtGui::Molecule& mol, GroupNode& node) auto colors = mesh->colors(); Core::Array colorsRGB(colors.size()); for (size_t i = 0; i < colors.size(); i++) - colorsRGB[i] = Vector3ub(static_cast(colors[i].red() * 255), - static_cast(colors[i].green() * 255), - static_cast(colors[i].blue() * 255)); + colorsRGB[i] = + Vector3ub(static_cast(colors[i].red() * 255), + static_cast(colors[i].green() * 255), + static_cast(colors[i].blue() * 255)); mesh1->addVertices(mesh->vertices(), mesh->normals(), colorsRGB); } else { mesh1->setColor(m_color1); mesh1->addVertices(mesh->vertices(), mesh->normals()); - } + } // Add the triangles for the first mesh for (size_t i = 0; i < triangles.size(); ++i) { mesh1->addTriangle(triangles[i][0], triangles[i][1], triangles[i][2]); } - mesh1->setRenderPass(m_opacity == 255 ? Rendering::SolidPass : Rendering::TranslucentPass); + mesh1->setRenderPass(m_opacity == 255 ? Rendering::SolidPass + : Rendering::TranslucentPass); // Handle the second mesh if present - if (mol.meshCount() >= 2) { + if (mol.meshCount() >= 2) { auto* mesh2 = new MeshGeometry; geometry->addDrawable(mesh2); @@ -112,7 +114,8 @@ void Meshes::process(const QtGui::Molecule& mol, GroupNode& node) // Add the correct triangles for the second mesh for (size_t i = 0; i < triangles2.size(); ++i) { - mesh2->addTriangle(triangles2[i][0], triangles2[i][1], triangles2[i][2]); + mesh2->addTriangle(triangles2[i][0], triangles2[i][1], + triangles2[i][2]); } mesh2->setRenderPass(m_opacity == 255 ? Rendering::SolidPass @@ -165,21 +168,21 @@ QWidget* Meshes::setupWidget() slide->setRange(0, 255); slide->setTickInterval(5); slide->setValue(m_opacity); - connect(slide, SIGNAL(valueChanged(int)), SLOT(setOpacity(int))); + connect(slide, &QAbstractSlider::valueChanged, this, &Meshes::setOpacity); auto* form = new QFormLayout; form->addRow(tr("Opacity:"), slide); auto* color1 = new QtGui::ColorButton; color1->setColor(QColor(m_color1[0], m_color1[1], m_color1[2])); - connect(color1, SIGNAL(colorChanged(const QColor&)), - SLOT(setColor1(const QColor&))); + connect(color1, &QtGui::ColorButton::colorChanged, this, + &Meshes::setColor1); form->addRow(tr("Color:"), color1); auto* color2 = new QtGui::ColorButton; color2->setColor(QColor(m_color2[0], m_color2[1], m_color2[2])); - connect(color2, SIGNAL(colorChanged(const QColor&)), - SLOT(setColor2(const QColor&))); + connect(color2, &QtGui::ColorButton::colorChanged, this, + &Meshes::setColor2); form->addRow(tr("Color:"), color2); v->addLayout(form); diff --git a/avogadro/qtplugins/molecularproperties/molecularmodel.cpp b/avogadro/qtplugins/molecularproperties/molecularmodel.cpp index 2df78ec083..b7a51d9ac0 100644 --- a/avogadro/qtplugins/molecularproperties/molecularmodel.cpp +++ b/avogadro/qtplugins/molecularproperties/molecularmodel.cpp @@ -40,8 +40,8 @@ MolecularModel::MolecularModel(QObject* parent) : QAbstractTableModel(parent), m_molecule(nullptr) { m_network = new QNetworkAccessManager(this); - connect(m_network, SIGNAL(finished(QNetworkReply*)), this, - SLOT(updateNameReady(QNetworkReply*))); + connect(m_network, &QNetworkAccessManager::finished, this, + &MolecularModel::updateNameReady); } void MolecularModel::setMolecule(QtGui::Molecule* molecule) @@ -87,7 +87,7 @@ QString MolecularModel::name() const m_network->get(QNetworkRequest(QUrl(requestURL))); // don't update again until we're ready - 5 seconds - QTimer::singleShot(5000, this, SLOT(canUpdateName())); + QTimer::singleShot(5000, this, &MolecularModel::canUpdateName); return m_name; } diff --git a/avogadro/qtplugins/molecularproperties/molecularproperties.cpp b/avogadro/qtplugins/molecularproperties/molecularproperties.cpp index 955ac66b28..124e5ea010 100644 --- a/avogadro/qtplugins/molecularproperties/molecularproperties.cpp +++ b/avogadro/qtplugins/molecularproperties/molecularproperties.cpp @@ -27,7 +27,8 @@ MolecularProperties::MolecularProperties(QObject* parent_) m_action->setText(tr("&Molecular…")); m_action->setProperty("menu priority", 990); - connect(m_action, SIGNAL(triggered()), SLOT(showDialog())); + connect(m_action, &QAction::triggered, this, + &MolecularProperties::showDialog); } MolecularProperties::~MolecularProperties() {} diff --git a/avogadro/qtplugins/navigator/navigator.cpp b/avogadro/qtplugins/navigator/navigator.cpp index 4672081f7a..a546f3e143 100644 --- a/avogadro/qtplugins/navigator/navigator.cpp +++ b/avogadro/qtplugins/navigator/navigator.cpp @@ -42,7 +42,8 @@ Navigator::Navigator(QObject* parent_) tr("Navigation Tool \t(%1)\n\n" "Left Mouse: \tClick and drag to rotate the view.\n" "Middle Mouse: \tClick and drag to zoom in or out.\n" - "Right Mouse: \tClick and drag to move the view.\n").arg(shortcut)); + "Right Mouse: \tClick and drag to move the view.\n") + .arg(shortcut)); setIcon(); QSettings settings; m_zoomDirection = settings.value("navigator/zoom", 1).toInt(); @@ -106,8 +107,8 @@ QWidget* Navigator::toolWidget() const swapZoom->setToolTip( tr("Default:\t Scroll down to shrink, scroll up to zoom\n" "Reversed:\t Scroll up to shrink, scroll down to zoom")); - connect(swapZoom, SIGNAL(toggled(bool)), this, - SLOT(swapZoomDirection(bool))); + connect(swapZoom, &QAbstractButton::toggled, this, + &Navigator::swapZoomDirection); layout->addWidget(swapZoom); layout->addStretch(1); diff --git a/avogadro/qtplugins/networkdatabases/networkdatabases.cpp b/avogadro/qtplugins/networkdatabases/networkdatabases.cpp index 2c7b754135..21e1fa5b71 100644 --- a/avogadro/qtplugins/networkdatabases/networkdatabases.cpp +++ b/avogadro/qtplugins/networkdatabases/networkdatabases.cpp @@ -8,9 +8,9 @@ #include #include +#include #include #include -#include #include #include #include @@ -24,12 +24,10 @@ NetworkDatabases::NetworkDatabases(QObject* parent_) m_action->setEnabled(true); m_action->setText("Download by &Name…"); m_action->setProperty("menu priority", 190); - connect(m_action, SIGNAL(triggered()), SLOT(showDialog())); + connect(m_action, &QAction::triggered, this, &NetworkDatabases::showDialog); } -NetworkDatabases::~NetworkDatabases() -{ -} +NetworkDatabases::~NetworkDatabases() {} QList NetworkDatabases::actions() const { @@ -63,8 +61,8 @@ void NetworkDatabases::showDialog() { if (!m_network) { m_network = new QNetworkAccessManager(this); - connect(m_network, SIGNAL(finished(QNetworkReply*)), this, - SLOT(replyFinished(QNetworkReply*))); + connect(m_network, &QNetworkAccessManager::finished, this, + &NetworkDatabases::replyFinished); } if (!m_progressDialog) { m_progressDialog = new QProgressDialog(qobject_cast(parent())); @@ -80,9 +78,9 @@ void NetworkDatabases::showDialog() // Hard coding the NIH resolver download URL - this could be used for other // services - m_network->get(QNetworkRequest( - QUrl("https://cactus.nci.nih.gov/chemical/structure/" + structureName + - "/file?format=sdf&get3d=true"))); + m_network->get( + QNetworkRequest(QUrl("https://cactus.nci.nih.gov/chemical/structure/" + + structureName + "/file?format=sdf&get3d=true"))); m_moleculeName = structureName; m_progressDialog->setLabelText(tr("Querying for %1").arg(structureName)); @@ -115,4 +113,4 @@ void NetworkDatabases::replyFinished(QNetworkReply* reply) emit moleculeReady(1); reply->deleteLater(); } -} +} // namespace Avogadro::QtPlugins diff --git a/avogadro/qtplugins/openbabel/conformersearchdialog.cpp b/avogadro/qtplugins/openbabel/conformersearchdialog.cpp index 23b7c13060..438a2226cc 100644 --- a/avogadro/qtplugins/openbabel/conformersearchdialog.cpp +++ b/avogadro/qtplugins/openbabel/conformersearchdialog.cpp @@ -15,17 +15,17 @@ ConformerSearchDialog::ConformerSearchDialog(QWidget* parent) : QDialog(parent) { ui.setupUi(this); - connect(ui.systematicRadio, SIGNAL(toggled(bool)), this, - SLOT(systematicToggled(bool))); - connect(ui.randomRadio, SIGNAL(toggled(bool)), this, - SLOT(randomToggled(bool))); - connect(ui.weightedRadio, SIGNAL(toggled(bool)), this, - SLOT(weightedToggled(bool))); - connect(ui.geneticRadio, SIGNAL(toggled(bool)), this, - SLOT(geneticToggled(bool))); - - connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton*)), this, - SLOT(buttonClicked(QAbstractButton*))); + connect(ui.systematicRadio, &QAbstractButton::toggled, this, + &ConformerSearchDialog::systematicToggled); + connect(ui.randomRadio, &QAbstractButton::toggled, this, + &ConformerSearchDialog::randomToggled); + connect(ui.weightedRadio, &QAbstractButton::toggled, this, + &ConformerSearchDialog::weightedToggled); + connect(ui.geneticRadio, &QAbstractButton::toggled, this, + &ConformerSearchDialog::geneticToggled); + + connect(ui.buttonBox, &QDialogButtonBox::clicked, this, + &ConformerSearchDialog::buttonClicked); m_method = 1; // systematic m_numConformers = 100; diff --git a/avogadro/qtplugins/openbabel/obcharges.cpp b/avogadro/qtplugins/openbabel/obcharges.cpp index 166310586e..cec94f7701 100644 --- a/avogadro/qtplugins/openbabel/obcharges.cpp +++ b/avogadro/qtplugins/openbabel/obcharges.cpp @@ -62,7 +62,7 @@ public slots: Array m_output; }; -OBCharges::OBCharges(const std::string& id) : m_identifier(id), ChargeModel() +OBCharges::OBCharges(const std::string& id) : ChargeModel(), m_identifier(id) { // set the element mask based on our type / identifier m_elements.reset(); diff --git a/avogadro/qtplugins/openbabel/obfileformat.cpp b/avogadro/qtplugins/openbabel/obfileformat.cpp index b0184aeca2..ffaafe15a6 100644 --- a/avogadro/qtplugins/openbabel/obfileformat.cpp +++ b/avogadro/qtplugins/openbabel/obfileformat.cpp @@ -90,8 +90,8 @@ bool OBFileFormat::read(std::istream& in, Core::Molecule& molecule) // Allow blocking until the read is completed. OBProcess proc; ProcessListener listener; - QObject::connect(&proc, SIGNAL(convertFinished(QByteArray)), &listener, - SLOT(responseReceived(QByteArray))); + QObject::connect(&proc, &OBProcess::convertFinished, &listener, + &ProcessListener::responseReceived); // Just grab the first file extension from the list -- all extensions for a // given format map to the same parsers in OB. @@ -263,8 +263,8 @@ bool OBFileFormat::write(std::ostream& out, const Core::Molecule& molecule) // Block until the OpenBabel conversion finishes: OBProcess proc; ProcessListener listener; - QObject::connect(&proc, SIGNAL(convertFinished(QByteArray)), &listener, - SLOT(responseReceived(QByteArray))); + QObject::connect(&proc, &OBProcess::convertFinished, &listener, + &ProcessListener::responseReceived); // Just grab the first file extension from the list -- all extensions for a // given format map to the same parsers in OB. diff --git a/avogadro/qtplugins/openbabel/obforcefielddialog.cpp b/avogadro/qtplugins/openbabel/obforcefielddialog.cpp index fb122b8780..b44dd52312 100644 --- a/avogadro/qtplugins/openbabel/obforcefielddialog.cpp +++ b/avogadro/qtplugins/openbabel/obforcefielddialog.cpp @@ -35,8 +35,8 @@ OBForceFieldDialog::OBForceFieldDialog(const QStringList& forceFields, ui->forceField->addItems(forceFields); updateRecommendedForceField(); - connect(ui->useRecommended, SIGNAL(toggled(bool)), - SLOT(useRecommendedForceFieldToggled(bool))); + connect(ui->useRecommended, &QAbstractButton::toggled, this, + &OBForceFieldDialog::useRecommendedForceFieldToggled); QSettings settings; bool autoDetect = @@ -323,4 +323,4 @@ void OBForceFieldDialog::updateRecommendedForceField() } } -} // namespace Avogadro +} // namespace Avogadro::QtPlugins diff --git a/avogadro/qtplugins/openbabel/obprocess.cpp b/avogadro/qtplugins/openbabel/obprocess.cpp index d2d924fc78..b117537c0d 100644 --- a/avogadro/qtplugins/openbabel/obprocess.cpp +++ b/avogadro/qtplugins/openbabel/obprocess.cpp @@ -415,8 +415,8 @@ bool OBProcess::optimizeGeometry(const QByteArray& mol, << "--log" << options; // We'll need to read the log (printed to stderr) to update progress - connect(m_process, SIGNAL(readyReadStandardError()), - SLOT(optimizeGeometryReadLog())); + connect(m_process, &QProcess::readyReadStandardError, this, + &OBProcess::optimizeGeometryReadLog); // Initialize the log reader ivars m_optimizeGeometryLog.clear(); @@ -449,8 +449,8 @@ bool OBProcess::generateConformers(const QByteArray& mol, << "--log" << options; // We'll need to read the log (printed to stderr) to update progress - connect(m_process, SIGNAL(readyReadStandardError()), - SLOT(conformerReadLog())); + connect(m_process, &QProcess::readyReadStandardError, this, + &OBProcess::conformerReadLog); // Initialize the log reader ivars m_optimizeGeometryLog.clear(); @@ -565,8 +565,7 @@ void OBProcess::executeObabel(const QStringList& options, QObject* receiver, connect(m_process, SIGNAL(finished(int)), receiver, slot); connect(m_process, SIGNAL(errorOccurred(QProcess::ProcessError)), receiver, slot); - connect(m_process, SIGNAL(errorOccurred(QProcess::ProcessError)), this, - SLOT(obError())); + connect(m_process, &QProcess::errorOccurred, this, &OBProcess::obError); } // Start process @@ -587,7 +586,7 @@ void OBProcess::resetState() m_aborted = false; m_process->disconnect(this); disconnect(m_process); - connect(this, SIGNAL(aborted()), m_process, SLOT(kill())); + connect(this, &OBProcess::aborted, m_process, &QProcess::kill); } } // namespace Avogadro::QtPlugins diff --git a/avogadro/qtplugins/openbabel/openbabel.cpp b/avogadro/qtplugins/openbabel/openbabel.cpp index c2e0f3f811..4410e5c4eb 100644 --- a/avogadro/qtplugins/openbabel/openbabel.cpp +++ b/avogadro/qtplugins/openbabel/openbabel.cpp @@ -45,43 +45,45 @@ OpenBabel::OpenBabel(QObject* p) auto* action = new QAction(this); action->setEnabled(true); action->setText(tr("Optimize Geometry")); - connect(action, SIGNAL(triggered()), SLOT(onOptimizeGeometry())); + connect(action, &QAction::triggered, this, &OpenBabel::onOptimizeGeometry); m_actions.push_back(action); action = new QAction(this); action->setEnabled(true); action->setText(tr("Configure Force Field…")); - connect(action, SIGNAL(triggered()), SLOT(onConfigureGeometryOptimization())); + connect(action, &QAction::triggered, this, + &OpenBabel::onConfigureGeometryOptimization); m_actions.push_back(action); action = new QAction(this); action->setEnabled(true); action->setText(tr("Conformer Search…")); - connect(action, SIGNAL(triggered()), SLOT(onConfigureConformerSearch())); + connect(action, &QAction::triggered, this, + &OpenBabel::onConfigureConformerSearch); m_actions.push_back(action); action = new QAction(this); action->setEnabled(true); action->setText(tr("Perceive Bonds")); - connect(action, SIGNAL(triggered()), SLOT(onPerceiveBonds())); + connect(action, &QAction::triggered, this, &OpenBabel::onPerceiveBonds); m_actions.push_back(action); action = new QAction(this); action->setEnabled(true); action->setText(tr("Add Hydrogens")); - connect(action, SIGNAL(triggered()), SLOT(onAddHydrogens())); + connect(action, &QAction::triggered, this, &OpenBabel::onAddHydrogens); m_actions.push_back(action); action = new QAction(this); action->setEnabled(true); action->setText(tr("Add Hydrogens for pH…")); - connect(action, SIGNAL(triggered()), SLOT(onAddHydrogensPh())); + connect(action, &QAction::triggered, this, &OpenBabel::onAddHydrogensPh); m_actions.push_back(action); action = new QAction(this); action->setEnabled(true); action->setText(tr("Remove Hydrogens")); - connect(action, SIGNAL(triggered()), SLOT(onRemoveHydrogens())); + connect(action, &QAction::triggered, this, &OpenBabel::onRemoveHydrogens); m_actions.push_back(action); refreshReadFormats(); @@ -314,8 +316,8 @@ void OpenBabel::refreshForceFields() // process for the refresh methods. auto* proc = new OBProcess(this); - connect(proc, SIGNAL(queryForceFieldsFinished(QMultiMap)), - SLOT(handleForceFieldsUpdate(QMultiMap))); + connect(proc, &OBProcess::queryForceFieldsFinished, this, + &OpenBabel::handleForceFieldsUpdate); proc->queryForceFields(); } @@ -336,8 +338,8 @@ void OpenBabel::refreshCharges() // process for the refresh methods. auto* proc = new OBProcess(this); - connect(proc, SIGNAL(queryChargesFinished(QMultiMap)), - SLOT(handleChargesUpdate(QMultiMap))); + connect(proc, &OBProcess::queryChargesFinished, this, + &OpenBabel::handleChargesUpdate); proc->queryCharges(); } @@ -469,12 +471,11 @@ void OpenBabel::onOptimizeGeometry() // Connect process disconnect(m_process); m_process->disconnect(this); - connect(m_progress, SIGNAL(canceled()), m_process, SLOT(abort())); - connect(m_process, - SIGNAL(optimizeGeometryStatusUpdate(int, int, double, double)), - SLOT(onOptimizeGeometryStatusUpdate(int, int, double, double))); - connect(m_process, SIGNAL(optimizeGeometryFinished(QByteArray)), - SLOT(onOptimizeGeometryFinished(QByteArray))); + connect(m_progress, &QProgressDialog::canceled, m_process, &OBProcess::abort); + connect(m_process, &OBProcess::optimizeGeometryStatusUpdate, this, + &OpenBabel::onOptimizeGeometryStatusUpdate); + connect(m_process, &OBProcess::optimizeGeometryFinished, this, + &OpenBabel::onOptimizeGeometryFinished); // Generate CML std::string mol; @@ -622,11 +623,11 @@ void OpenBabel::onGenerateConformers() // Connect process disconnect(m_process); m_process->disconnect(this); - connect(m_progress, SIGNAL(canceled()), m_process, SLOT(abort())); - connect(m_process, SIGNAL(conformerStatusUpdate(int, int, double, double)), - SLOT(onConformerStatusUpdate(int, int, double, double))); - connect(m_process, SIGNAL(generateConformersFinished(QByteArray)), - SLOT(onGenerateConformersFinished(QByteArray))); + connect(m_progress, &QProgressDialog::canceled, m_process, &OBProcess::abort); + connect(m_process, &OBProcess::conformerStatusUpdate, this, + &OpenBabel::onConformerStatusUpdate); + connect(m_process, &OBProcess::generateConformersFinished, this, + &OpenBabel::onGenerateConformersFinished); std::string mol; if (!Io::FileFormatManager::instance().writeString(*m_molecule, mol, @@ -753,9 +754,9 @@ void OpenBabel::onPerceiveBonds() // Connect process disconnect(m_process); m_process->disconnect(this); - connect(m_progress, SIGNAL(canceled()), m_process, SLOT(abort())); - connect(m_process, SIGNAL(convertFinished(QByteArray)), - SLOT(onPerceiveBondsFinished(QByteArray))); + connect(m_progress, &QProgressDialog::canceled, m_process, &OBProcess::abort); + connect(m_process, &OBProcess::convertFinished, this, + &OpenBabel::onPerceiveBondsFinished); m_progress->setLabelText(tr("Converting XYZ to Open Babel with %1…") .arg(m_process->obabelExecutable())); @@ -841,9 +842,9 @@ void OpenBabel::onAddHydrogens() // Connect process disconnect(m_process); m_process->disconnect(this); - connect(m_progress, SIGNAL(canceled()), m_process, SLOT(abort())); - connect(m_process, SIGNAL(convertFinished(QByteArray)), - SLOT(onHydrogenOperationFinished(QByteArray))); + connect(m_progress, &QProgressDialog::canceled, m_process, &OBProcess::abort); + connect(m_process, &OBProcess::convertFinished, this, + &OpenBabel::onHydrogenOperationFinished); m_progress->setLabelText( tr("Running %1…").arg(m_process->obabelExecutable())); @@ -891,9 +892,9 @@ void OpenBabel::onAddHydrogensPh() // Connect process disconnect(m_process); m_process->disconnect(this); - connect(m_progress, SIGNAL(canceled()), m_process, SLOT(abort())); - connect(m_process, SIGNAL(convertFinished(QByteArray)), - SLOT(onHydrogenOperationFinished(QByteArray))); + connect(m_progress, &QProgressDialog::canceled, m_process, &OBProcess::abort); + connect(m_process, &OBProcess::convertFinished, this, + &OpenBabel::onHydrogenOperationFinished); m_progress->setLabelText( tr("Running %1…").arg(m_process->obabelExecutable())); @@ -933,9 +934,9 @@ void OpenBabel::onRemoveHydrogens() // Connect process disconnect(m_process); m_process->disconnect(this); - connect(m_progress, SIGNAL(canceled()), m_process, SLOT(abort())); - connect(m_process, SIGNAL(convertFinished(QByteArray)), - SLOT(onHydrogenOperationFinished(QByteArray))); + connect(m_progress, &QProgressDialog::canceled, m_process, &OBProcess::abort); + connect(m_process, &OBProcess::convertFinished, this, + &OpenBabel::onHydrogenOperationFinished); m_progress->setLabelText( tr("Running %1…").arg(m_process->obabelExecutable())); diff --git a/avogadro/qtplugins/openmminput/openmminput.cpp b/avogadro/qtplugins/openmminput/openmminput.cpp index 47f63ba449..d0e269cd44 100644 --- a/avogadro/qtplugins/openmminput/openmminput.cpp +++ b/avogadro/qtplugins/openmminput/openmminput.cpp @@ -28,7 +28,7 @@ OpenMMInput::OpenMMInput(QObject* parent_) { m_action->setEnabled(true); m_action->setText(tr("&OpenMM Script…")); - connect(m_action, SIGNAL(triggered()), SLOT(menuActivated())); + connect(m_action, &QAction::triggered, this, &OpenMMInput::menuActivated); } OpenMMInput::~OpenMMInput() {} diff --git a/avogadro/qtplugins/openmminput/openmminputdialog.cpp b/avogadro/qtplugins/openmminput/openmminputdialog.cpp index d3a4b986d2..fe6dd69408 100644 --- a/avogadro/qtplugins/openmminput/openmminputdialog.cpp +++ b/avogadro/qtplugins/openmminput/openmminputdialog.cpp @@ -71,10 +71,10 @@ OpenMMInputDialog::OpenMMInputDialog(QWidget* parent, Qt::WindowFlags flag) : ui.inputTopEdit->text()); // Connect the GUI elements to the correct slots - connect(ui.jobScriptEdit, SIGNAL(textChanged(QString)), this, - SLOT(setScriptName())); - connect(ui.inputCoordEdit, SIGNAL(textChanged(QString)), this, - SLOT(setInputCoordName())); + connect(ui.jobScriptEdit, &QLineEdit::textChanged, this, + &OpenMMInputDialog::setScriptName); + connect(ui.inputCoordEdit, &QLineEdit::textChanged, this, + &OpenMMInputDialog::setInputCoordName); connect(ui.forceFieldCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setForceField(int))); connect(ui.constraintsCombo, SIGNAL(currentIndexChanged(int)), this, @@ -87,8 +87,8 @@ OpenMMInputDialog::OpenMMInputDialog(QWidget* parent, Qt::WindowFlags flag) SLOT(setIntegratorType(int))); connect(ui.barostatCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setBarostatType(int))); - connect(ui.inputTopEdit, SIGNAL(textChanged(QString)), this, - SLOT(setTopologyName())); + connect(ui.inputTopEdit, &QLineEdit::textChanged, this, + &OpenMMInputDialog::setTopologyName); connect(ui.rigidWaterCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setRigidWater(int))); connect(ui.temperatureSpin, SIGNAL(valueChanged(double)), this, @@ -131,37 +131,41 @@ OpenMMInputDialog::OpenMMInputDialog(QWidget* parent, Qt::WindowFlags flag) SLOT(setPlatformType(int))); connect(ui.precisionCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setPrecisionType(int))); - connect(ui.dcdCheck, SIGNAL(toggled(bool)), this, SLOT(setDCDReporter(bool))); - connect(ui.pdbCheck, SIGNAL(toggled(bool)), this, SLOT(setPDBReporter(bool))); - connect(ui.stateDataCheck, SIGNAL(toggled(bool)), this, - SLOT(setStateDataReporter(bool))); - - connect(ui.stepIndexCheck, SIGNAL(toggled(bool)), this, - SLOT(setStepIndexBoolean(bool))); - connect(ui.timeCheck, SIGNAL(toggled(bool)), this, - SLOT(setTimeBoolean(bool))); - connect(ui.speedCheck, SIGNAL(toggled(bool)), this, - SLOT(setSpeedBoolean(bool))); - connect(ui.progressCheck, SIGNAL(toggled(bool)), this, - SLOT(setProgressBoolean(bool))); - connect(ui.potentialEnergyCheck, SIGNAL(toggled(bool)), this, - SLOT(setPotentialEnergyBoolean(bool))); - connect(ui.kineticEnergyCheck, SIGNAL(toggled(bool)), this, - SLOT(setKineticEnergyBoolean(bool))); - connect(ui.totalEnergyCheck, SIGNAL(toggled(bool)), this, - SLOT(setTotalEnergyBoolean(bool))); - connect(ui.temperatureCheck, SIGNAL(toggled(bool)), this, - SLOT(setTemperatureBoolean(bool))); - connect(ui.volumeCheck, SIGNAL(toggled(bool)), this, - SLOT(setVolumeBoolean(bool))); - connect(ui.densityCheck, SIGNAL(toggled(bool)), this, - SLOT(setDensityBoolean(bool))); - - connect(ui.generateButton, SIGNAL(clicked()), this, SLOT(generateClicked())); - connect(ui.resetButton, SIGNAL(clicked()), this, SLOT(resetClicked())); - - connect(ui.enableFormButton, SIGNAL(clicked()), this, - SLOT(enableFormClicked())); + connect(ui.dcdCheck, &QAbstractButton::toggled, this, + &OpenMMInputDialog::setDCDReporter); + connect(ui.pdbCheck, &QAbstractButton::toggled, this, + &OpenMMInputDialog::setPDBReporter); + connect(ui.stateDataCheck, &QAbstractButton::toggled, this, + &OpenMMInputDialog::setStateDataReporter); + + connect(ui.stepIndexCheck, &QAbstractButton::toggled, this, + &OpenMMInputDialog::setStepIndexBoolean); + connect(ui.timeCheck, &QAbstractButton::toggled, this, + &OpenMMInputDialog::setTimeBoolean); + connect(ui.speedCheck, &QAbstractButton::toggled, this, + &OpenMMInputDialog::setSpeedBoolean); + connect(ui.progressCheck, &QAbstractButton::toggled, this, + &OpenMMInputDialog::setProgressBoolean); + connect(ui.potentialEnergyCheck, &QAbstractButton::toggled, this, + &OpenMMInputDialog::setPotentialEnergyBoolean); + connect(ui.kineticEnergyCheck, &QAbstractButton::toggled, this, + &OpenMMInputDialog::setKineticEnergyBoolean); + connect(ui.totalEnergyCheck, &QAbstractButton::toggled, this, + &OpenMMInputDialog::setTotalEnergyBoolean); + connect(ui.temperatureCheck, &QAbstractButton::toggled, this, + &OpenMMInputDialog::setTemperatureBoolean); + connect(ui.volumeCheck, &QAbstractButton::toggled, this, + &OpenMMInputDialog::setVolumeBoolean); + connect(ui.densityCheck, &QAbstractButton::toggled, this, + &OpenMMInputDialog::setDensityBoolean); + + connect(ui.generateButton, &QAbstractButton::clicked, this, + &OpenMMInputDialog::generateClicked); + connect(ui.resetButton, &QAbstractButton::clicked, this, + &OpenMMInputDialog::resetClicked); + + connect(ui.enableFormButton, &QAbstractButton::clicked, this, + &OpenMMInputDialog::enableFormClicked); QSettings settings; readSettings(settings); @@ -214,7 +218,8 @@ void OpenMMInputDialog::updatePreviewText() m_jobEdit = new QTextEdit(this); m_jobEdit->setObjectName(m_jobFileName); m_jobEdit->setFontFamily("monospace"); - connect(m_jobEdit, SIGNAL(textChanged()), this, SLOT(textEditModified())); + connect(m_jobEdit, &QTextEdit::textChanged, this, + &OpenMMInputDialog::textEditModified); m_jobEdit->setText(generateInputDeck()); ui.tabWidget->insertTab(jobTabPosition, m_jobEdit, m_jobFileName); deckDirty(false); @@ -408,8 +413,8 @@ void OpenMMInputDialog::generateClicked() tr("The input files cannot be written:\n\n%1").arg(errors.first()); break; default: { - // If a fatal error occurred, it will be last one in the list. Pop it off - // and tell the user that it was the reason we had to stop. + // If a fatal error occurred, it will be last one in the list. Pop it + // off and tell the user that it was the reason we had to stop. QString fatal = errors.last(); QStringList tmp(errors); tmp.pop_back(); @@ -640,7 +645,8 @@ void OpenMMInputDialog::setMolecule(QtGui::Molecule* molecule) m_molecule = molecule; // Update the preview text whenever primitives are changed - connect(molecule, SIGNAL(changed(unsigned int)), SLOT(updatePreviewText())); + connect(molecule, &QtGui::Molecule::changed, this, + &OpenMMInputDialog::updatePreviewText); updatePreviewText(); } @@ -956,8 +962,9 @@ QString OpenMMInputDialog::generateInputDeck() scriptStream << "nonbondedMethod=" << "app." << getNonBondedType(m_nonBondedType) << ","; if (m_nonBondedCutoff > 0) { - scriptStream << " nonbondedCutoff=" << Qt::fixed << qSetRealNumberPrecision(4) - << m_nonBondedCutoff << "*unit.nanometers,"; + scriptStream << " nonbondedCutoff=" << Qt::fixed + << qSetRealNumberPrecision(4) << m_nonBondedCutoff + << "*unit.nanometers,"; } if (m_constraintType == None) { scriptStream << " constraints=" << getConstraintType(m_constraintType); @@ -1344,4 +1351,4 @@ void OpenMMInputDialog::writeSettings(QSettings& settings) const settings.setValue("openmm/savepath", m_savePath); } -} // namespace Avogadro +} // namespace Avogadro::QtPlugins diff --git a/avogadro/qtplugins/overlayaxes/overlayaxes.cpp b/avogadro/qtplugins/overlayaxes/overlayaxes.cpp index 6c47c0084c..ed3351666d 100644 --- a/avogadro/qtplugins/overlayaxes/overlayaxes.cpp +++ b/avogadro/qtplugins/overlayaxes/overlayaxes.cpp @@ -11,13 +11,14 @@ #include #include #include + #include #include #include -#include #include +#include #include @@ -236,7 +237,7 @@ OverlayAxes::OverlayAxes(QObject* p) m_render(new RenderImpl), m_glWidget(nullptr), m_axesAction(new QAction(tr("Reference Axes"), this)) { - connect(m_axesAction, SIGNAL(triggered()), SLOT(processAxes())); + connect(m_axesAction, &QAction::triggered, this, &OverlayAxes::processAxes); QSettings settings; m_enabled = settings.value("overlayAxes/enabled", true).toBool(); @@ -325,4 +326,4 @@ void OverlayAxes::setScene(Rendering::Scene* scene) } } -} // namespace Avogadro +} // namespace Avogadro::QtPlugins diff --git a/avogadro/qtplugins/playertool/playertool.cpp b/avogadro/qtplugins/playertool/playertool.cpp index 9345bf06e4..3ced6199fe 100644 --- a/avogadro/qtplugins/playertool/playertool.cpp +++ b/avogadro/qtplugins/playertool/playertool.cpp @@ -69,17 +69,17 @@ QWidget* PlayerTool::toolWidget() const auto* controls = new QHBoxLayout; controls->addStretch(1); auto* leftButton = new QPushButton("<"); - connect(leftButton, SIGNAL(clicked()), SLOT(back())); + connect(leftButton, &QAbstractButton::clicked, this, &PlayerTool::back); controls->addWidget(leftButton); playButton = new QPushButton(tr("Play")); - connect(playButton, SIGNAL(clicked()), SLOT(play())); + connect(playButton, &QAbstractButton::clicked, this, &PlayerTool::play); controls->addWidget(playButton); stopButton = new QPushButton(tr("Stop")); - connect(stopButton, SIGNAL(clicked()), SLOT(stop())); + connect(stopButton, &QAbstractButton::clicked, this, &PlayerTool::stop); controls->addWidget(stopButton); stopButton->setEnabled(false); auto* rightButton = new QPushButton(">"); - connect(rightButton, SIGNAL(clicked()), SLOT(forward())); + connect(rightButton, &QAbstractButton::clicked, this, &PlayerTool::forward); controls->addWidget(rightButton); controls->addStretch(1); layout->addLayout(controls); @@ -99,8 +99,8 @@ QWidget* PlayerTool::toolWidget() const m_slider = new QSlider(Qt::Horizontal); m_slider->setMinimum(0); m_slider->setTickInterval(1); - connect(m_slider, SIGNAL(valueChanged(int)), - SLOT(sliderPositionChanged(int))); + connect(m_slider, &QAbstractSlider::valueChanged, this, + &PlayerTool::sliderPositionChanged); sliderLayout->addWidget(m_slider); layout->addLayout(sliderLayout); if (m_molecule->coordinate3dCount() > 1) @@ -142,7 +142,8 @@ QWidget* PlayerTool::toolWidget() const auto* recordLayout = new QHBoxLayout; recordLayout->addStretch(1); auto* recordButton = new QPushButton(tr("Record Movie…")); - connect(recordButton, SIGNAL(clicked()), SLOT(recordMovie())); + connect(recordButton, &QAbstractButton::clicked, this, + &PlayerTool::recordMovie); recordLayout->addWidget(recordButton); recordLayout->addStretch(1); layout->addLayout(recordLayout); diff --git a/avogadro/qtplugins/plugindownloader/downloaderwidget.cpp b/avogadro/qtplugins/plugindownloader/downloaderwidget.cpp index c8d539c5e8..cf90d6bc0a 100644 --- a/avogadro/qtplugins/plugindownloader/downloaderwidget.cpp +++ b/avogadro/qtplugins/plugindownloader/downloaderwidget.cpp @@ -52,10 +52,10 @@ DownloaderWidget::DownloaderWidget(QWidget* parent) // enable links in the readme to open an external browser m_ui->readmeBrowser->setOpenExternalLinks(true); - connect(m_ui->downloadButton, SIGNAL(clicked(bool)), this, - SLOT(getCheckedRepos())); - connect(m_ui->repoTable, SIGNAL(cellClicked(int, int)), this, - SLOT(downloadREADME(int, int))); + connect(m_ui->downloadButton, &QAbstractButton::clicked, this, + &DownloaderWidget::getCheckedRepos); + connect(m_ui->repoTable, &QTableWidget::cellClicked, this, + &DownloaderWidget::downloadREADME); m_ui->repoTable->setColumnCount(4); m_ui->repoTable->setSelectionBehavior(QAbstractItemView::SelectRows); @@ -84,7 +84,8 @@ void DownloaderWidget::getRepoData(QString url) setRawHeaders(&request); request.setUrl(url); // Set the url m_reply = m_NetworkAccessManager->get(request); - connect(m_reply, SIGNAL(finished()), this, SLOT(updateRepoData())); + connect(m_reply, &QNetworkReply::finished, this, + &DownloaderWidget::updateRepoData); } // Process the master plugin.json hosted on Avogadro.cc @@ -187,7 +188,8 @@ void DownloaderWidget::downloadREADME(int row, int col) setRawHeaders(&request); request.setUrl(url); // Set the url m_reply = m_NetworkAccessManager->get(request); - connect(m_reply, SIGNAL(finished()), this, SLOT(showREADME())); + connect(m_reply, &QNetworkReply::finished, this, + &DownloaderWidget::showREADME); } // display README when the user clicks a row @@ -282,7 +284,8 @@ void DownloaderWidget::downloadNext() setRawHeaders(&request); request.setUrl(url); // Set the url m_reply = m_NetworkAccessManager->get(request); - connect(m_reply, SIGNAL(finished()), this, SLOT(handleRedirect())); + connect(m_reply, &QNetworkReply::finished, this, + &DownloaderWidget::handleRedirect); } } @@ -347,7 +350,8 @@ void DownloaderWidget::handleRedirect() request.setUrl(_urlRedirectedTo); // Set the url m_reply = m_NetworkAccessManager->get(request); // Now we have the actual zip and can extract it - connect(m_reply, SIGNAL(finished()), this, SLOT(unzipPlugin())); + connect(m_reply, &QNetworkReply::finished, this, + &DownloaderWidget::unzipPlugin); } else if (statusCode == 200) { // Normal success response unzipPlugin(); diff --git a/avogadro/qtplugins/plugindownloader/plugindownloader.cpp b/avogadro/qtplugins/plugindownloader/plugindownloader.cpp index f5f797a803..3c4415d4e7 100644 --- a/avogadro/qtplugins/plugindownloader/plugindownloader.cpp +++ b/avogadro/qtplugins/plugindownloader/plugindownloader.cpp @@ -26,7 +26,8 @@ PluginDownloader::PluginDownloader(QObject* parent_) m_downloadAction->setEnabled(true); m_downloadAction->setText(tr("Download Plugins…")); m_downloadAction->setProperty("menu priority", 520); - connect(m_downloadAction, SIGNAL(triggered()), SLOT(showDialog())); + connect(m_downloadAction, &QAction::triggered, this, + &PluginDownloader::showDialog); } PluginDownloader::~PluginDownloader() = default; diff --git a/avogadro/qtplugins/ply/ply.cpp b/avogadro/qtplugins/ply/ply.cpp index 9b07a0d146..a8af1786eb 100644 --- a/avogadro/qtplugins/ply/ply.cpp +++ b/avogadro/qtplugins/ply/ply.cpp @@ -10,11 +10,11 @@ #include #include +#include #include #include #include #include -#include #include #include #include @@ -28,12 +28,10 @@ PLY::PLY(QObject* p) : Avogadro::QtGui::ExtensionPlugin(p), m_molecule(nullptr), m_scene(nullptr), m_camera(nullptr), m_action(new QAction(tr("PLY Render…"), this)) { - connect(m_action, SIGNAL(triggered()), SLOT(render())); + connect(m_action, &QAction::triggered, this, &PLY::render); } -PLY::~PLY() -{ -} +PLY::~PLY() {} QList PLY::actions() const { @@ -82,4 +80,4 @@ void PLY::render() file.close(); } -} // namespace Avogadro +} // namespace Avogadro::QtPlugins diff --git a/avogadro/qtplugins/povray/povray.cpp b/avogadro/qtplugins/povray/povray.cpp index d84e683538..a0c13c405e 100644 --- a/avogadro/qtplugins/povray/povray.cpp +++ b/avogadro/qtplugins/povray/povray.cpp @@ -10,11 +10,11 @@ #include #include +#include #include #include #include #include -#include #include #include #include @@ -28,12 +28,10 @@ POVRay::POVRay(QObject* p) : Avogadro::QtGui::ExtensionPlugin(p), m_molecule(nullptr), m_scene(nullptr), m_camera(nullptr), m_action(new QAction(tr("POV-Ray Render…"), this)) { - connect(m_action, SIGNAL(triggered()), SLOT(render())); + connect(m_action, &QAction::triggered, this, &POVRay::render); } -POVRay::~POVRay() -{ -} +POVRay::~POVRay() {} QList POVRay::actions() const { @@ -82,4 +80,4 @@ void POVRay::render() file.close(); } -} // namespace Avogadro +} // namespace Avogadro::QtPlugins diff --git a/avogadro/qtplugins/propertytables/propertymodel.cpp b/avogadro/qtplugins/propertytables/propertymodel.cpp index e19ea0dccf..0c6b42140b 100644 --- a/avogadro/qtplugins/propertytables/propertymodel.cpp +++ b/avogadro/qtplugins/propertytables/propertymodel.cpp @@ -921,8 +921,8 @@ void PropertyModel::setMolecule(QtGui::Molecule* molecule) updateCache(); - connect(m_molecule, SIGNAL(changed(unsigned int)), this, - SLOT(updateTable(unsigned int))); + connect(m_molecule, &QtGui::Molecule::changed, this, + &PropertyModel::updateTable); } } diff --git a/avogadro/qtplugins/propertytables/propertytables.cpp b/avogadro/qtplugins/propertytables/propertytables.cpp index 430527f0eb..4df2a1f746 100644 --- a/avogadro/qtplugins/propertytables/propertytables.cpp +++ b/avogadro/qtplugins/propertytables/propertytables.cpp @@ -27,28 +27,28 @@ PropertyTables::PropertyTables(QObject* parent_) action->setText(tr("Atom Properties…")); action->setData(PropertyType::AtomType); action->setProperty("menu priority", 880); - connect(action, SIGNAL(triggered()), SLOT(showDialog())); + connect(action, &QAction::triggered, this, &PropertyTables::showDialog); m_actions.append(action); action = new QAction(this); action->setText(tr("Bond Properties…")); action->setData(PropertyType::BondType); action->setProperty("menu priority", 870); - connect(action, SIGNAL(triggered()), SLOT(showDialog())); + connect(action, &QAction::triggered, this, &PropertyTables::showDialog); m_actions.append(action); action = new QAction(this); action->setText(tr("Angle Properties…")); action->setData(PropertyType::AngleType); action->setProperty("menu priority", 860); - connect(action, SIGNAL(triggered()), SLOT(showDialog())); + connect(action, &QAction::triggered, this, &PropertyTables::showDialog); m_actions.append(action); action = new QAction(this); action->setText(tr("Torsion Properties…")); action->setData(PropertyType::TorsionType); action->setProperty("menu priority", 850); - connect(action, SIGNAL(triggered()), SLOT(showDialog())); + connect(action, &QAction::triggered, this, &PropertyTables::showDialog); m_actions.append(action); action = new QAction(this); @@ -56,7 +56,7 @@ PropertyTables::PropertyTables(QObject* parent_) action->setData(PropertyType::ResidueType); action->setProperty("menu priority", 840); action->setEnabled(false); // changed by molecule - connect(action, SIGNAL(triggered()), SLOT(showDialog())); + connect(action, &QAction::triggered, this, &PropertyTables::showDialog); m_actions.append(action); action = new QAction(this); @@ -64,7 +64,7 @@ PropertyTables::PropertyTables(QObject* parent_) action->setData(PropertyType::ConformerType); action->setProperty("menu priority", 830); action->setEnabled(false); // changed by molecule - connect(action, SIGNAL(triggered()), SLOT(showDialog())); + connect(action, &QAction::triggered, this, &PropertyTables::showDialog); m_actions.append(action); } @@ -96,7 +96,8 @@ void PropertyTables::setMolecule(QtGui::Molecule* mol) updateActions(); // update if the molecule changes - connect(m_molecule, SIGNAL(changed(unsigned int)), SLOT(updateActions())); + connect(m_molecule, &QtGui::Molecule::changed, this, + &PropertyTables::updateActions); } void PropertyTables::updateActions() diff --git a/avogadro/qtplugins/propertytables/propertyview.cpp b/avogadro/qtplugins/propertytables/propertyview.cpp index f84e8543bc..9383815d1f 100644 --- a/avogadro/qtplugins/propertytables/propertyview.cpp +++ b/avogadro/qtplugins/propertytables/propertyview.cpp @@ -36,7 +36,7 @@ namespace Avogadro { using QtGui::Molecule; PropertyView::PropertyView(PropertyType type, QWidget* parent) - : QTableView(parent), m_molecule(nullptr), m_type(type), m_model(nullptr) + : QTableView(parent), m_type(type), m_molecule(nullptr), m_model(nullptr) { QString title; switch (type) { diff --git a/avogadro/qtplugins/qtaim/qtaimcriticalpointlocator.cpp b/avogadro/qtplugins/qtaim/qtaimcriticalpointlocator.cpp index 55cc2a1b5b..41f011edc3 100644 --- a/avogadro/qtplugins/qtaim/qtaimcriticalpointlocator.cpp +++ b/avogadro/qtplugins/qtaim/qtaimcriticalpointlocator.cpp @@ -391,12 +391,14 @@ void QTAIMCriticalPointLocator::locateNuclearCriticalPoints() dialog.setLabelText(QString("Nuclear Critical Points Search")); QFutureWatcher futureWatcher; - QObject::connect(&futureWatcher, SIGNAL(finished()), &dialog, SLOT(reset())); - QObject::connect(&dialog, SIGNAL(canceled()), &futureWatcher, SLOT(cancel())); - QObject::connect(&futureWatcher, SIGNAL(progressRangeChanged(int, int)), - &dialog, SLOT(setRange(int, int))); - QObject::connect(&futureWatcher, SIGNAL(progressValueChanged(int)), &dialog, - SLOT(setValue(int))); + QObject::connect(&futureWatcher, &QFutureWatcherBase::finished, &dialog, + &QProgressDialog::reset); + QObject::connect(&dialog, &QProgressDialog::canceled, &futureWatcher, + &QFutureWatcherBase::cancel); + QObject::connect(&futureWatcher, &QFutureWatcherBase::progressRangeChanged, + &dialog, &QProgressDialog::setRange); + QObject::connect(&futureWatcher, &QFutureWatcherBase::progressValueChanged, + &dialog, &QProgressDialog::setValue); QFuture> future = QtConcurrent::mapped(inputList, QTAIMLocateNuclearCriticalPoint); @@ -414,11 +416,9 @@ void QTAIMCriticalPointLocator::locateNuclearCriticalPoints() QFile file; file.remove(tempFileName); - for (const auto & n : results) { + for (const auto& n : results) { if (n.at(0).toBool()) { - QVector3D result(n.at(1).toReal(), - n.at(2).toReal(), - n.at(3).toReal()); + QVector3D result(n.at(1).toReal(), n.at(2).toReal(), n.at(3).toReal()); m_nuclearCriticalPoints.append(result); } @@ -490,12 +490,14 @@ void QTAIMCriticalPointLocator::locateBondCriticalPoints() dialog.setLabelText(QString("Bond Critical Points Search")); QFutureWatcher futureWatcher; - QObject::connect(&futureWatcher, SIGNAL(finished()), &dialog, SLOT(reset())); - QObject::connect(&dialog, SIGNAL(canceled()), &futureWatcher, SLOT(cancel())); - QObject::connect(&futureWatcher, SIGNAL(progressRangeChanged(int, int)), - &dialog, SLOT(setRange(int, int))); - QObject::connect(&futureWatcher, SIGNAL(progressValueChanged(int)), &dialog, - SLOT(setValue(int))); + QObject::connect(&futureWatcher, &QFutureWatcherBase::finished, &dialog, + &QProgressDialog::reset); + QObject::connect(&dialog, &QProgressDialog::canceled, &futureWatcher, + &QFutureWatcherBase::cancel); + QObject::connect(&futureWatcher, &QFutureWatcherBase::progressRangeChanged, + &dialog, &QProgressDialog::setRange); + QObject::connect(&futureWatcher, &QFutureWatcherBase::progressValueChanged, + &dialog, &QProgressDialog::setValue); QFuture> future = QtConcurrent::mapped(inputList, QTAIMLocateBondCriticalPoint); @@ -637,12 +639,14 @@ void QTAIMCriticalPointLocator::locateElectronDensitySources() dialog.setLabelText(QString("Electron Density Sources Search")); QFutureWatcher futureWatcher; - QObject::connect(&futureWatcher, SIGNAL(finished()), &dialog, SLOT(reset())); - QObject::connect(&dialog, SIGNAL(canceled()), &futureWatcher, SLOT(cancel())); - QObject::connect(&futureWatcher, SIGNAL(progressRangeChanged(int, int)), - &dialog, SLOT(setRange(int, int))); - QObject::connect(&futureWatcher, SIGNAL(progressValueChanged(int)), &dialog, - SLOT(setValue(int))); + QObject::connect(&futureWatcher, &QFutureWatcherBase::finished, &dialog, + &QProgressDialog::reset); + QObject::connect(&dialog, &QProgressDialog::canceled, &futureWatcher, + &QFutureWatcherBase::cancel); + QObject::connect(&futureWatcher, &QFutureWatcherBase::progressRangeChanged, + &dialog, &QProgressDialog::setRange); + QObject::connect(&futureWatcher, &QFutureWatcherBase::progressValueChanged, + &dialog, &QProgressDialog::setValue); QFuture> future = QtConcurrent::mapped(inputList, QTAIMLocateElectronDensitySource); @@ -660,7 +664,7 @@ void QTAIMCriticalPointLocator::locateElectronDensitySources() QFile file; file.remove(tempFileName); - for (const auto & n : results) { + for (const auto& n : results) { if (n.at(0).toBool()) { qreal x = n.at(1).toReal(); qreal y = n.at(2).toReal(); @@ -782,12 +786,14 @@ void QTAIMCriticalPointLocator::locateElectronDensitySinks() dialog.setLabelText(QString("Electron Density Sinks Search")); QFutureWatcher futureWatcher; - QObject::connect(&futureWatcher, SIGNAL(finished()), &dialog, SLOT(reset())); - QObject::connect(&dialog, SIGNAL(canceled()), &futureWatcher, SLOT(cancel())); - QObject::connect(&futureWatcher, SIGNAL(progressRangeChanged(int, int)), - &dialog, SLOT(setRange(int, int))); - QObject::connect(&futureWatcher, SIGNAL(progressValueChanged(int)), &dialog, - SLOT(setValue(int))); + QObject::connect(&futureWatcher, &QFutureWatcherBase::finished, &dialog, + &QProgressDialog::reset); + QObject::connect(&dialog, &QProgressDialog::canceled, &futureWatcher, + &QFutureWatcherBase::cancel); + QObject::connect(&futureWatcher, &QFutureWatcherBase::progressRangeChanged, + &dialog, &QProgressDialog::setRange); + QObject::connect(&futureWatcher, &QFutureWatcherBase::progressValueChanged, + &dialog, &QProgressDialog::setValue); QFuture> future = QtConcurrent::mapped(inputList, QTAIMLocateElectronDensitySink); @@ -805,7 +811,7 @@ void QTAIMCriticalPointLocator::locateElectronDensitySinks() QFile file; file.remove(tempFileName); - for (const auto & n : results) { + for (const auto& n : results) { if (n.at(0).toBool()) { qreal x = n.at(1).toReal(); qreal y = n.at(2).toReal(); @@ -857,4 +863,4 @@ QString QTAIMCriticalPointLocator::temporaryFileName() return tempFileName; } -} // namespace Avogadro +} // namespace Avogadro::QtPlugins diff --git a/avogadro/qtplugins/qtaim/qtaimcubature.cpp b/avogadro/qtplugins/qtaim/qtaimcubature.cpp index 130f9c1852..2309bb2f49 100644 --- a/avogadro/qtplugins/qtaim/qtaimcubature.cpp +++ b/avogadro/qtplugins/qtaim/qtaimcubature.cpp @@ -705,10 +705,14 @@ static int rule15gauss_evalError(rule* r, unsigned int fdim, integrand_v f, const unsigned int n = 8; const double xgk[8] = { /* abscissae of the 15-point kronrod rule */ - 0.991455371120812639206854697526329, 0.949107912342758524526189684047851, - 0.864864423359769072789712788640926, 0.741531185599394439863864773280788, - 0.586087235467691130294144838258730, 0.405845151377397166906606412076961, - 0.207784955007898467600689403773245, 0.000000000000000000000000000000000 + 0.991455371120812639206854697526329, + 0.949107912342758524526189684047851, + 0.864864423359769072789712788640926, + 0.741531185599394439863864773280788, + 0.586087235467691130294144838258730, + 0.405845151377397166906606412076961, + 0.207784955007898467600689403773245, + 0.000000000000000000000000000000000 /* xgk[1], xgk[3], ... abscissae of the 7-point gauss rule. xgk[0], xgk[2], ... to optimally extend the 7-point gauss rule */ }; @@ -1279,7 +1283,7 @@ QList QTAIMEvaluateProperty(QList variantList) ode.setBetaSpheres(betaSpheres); QVector3D endpoint = ode.integrate(QVector3D(x0, y0, z0)); -// QList path=ode.path(); + // QList path=ode.path(); #define HUGE_REAL_NUMBER 1.e20 qreal smallestDistance = HUGE_REAL_NUMBER; @@ -1408,12 +1412,14 @@ void property_v(unsigned int /* ndim */, unsigned int npts, const double* xyz, dialog.setLabelText(QString("Atomic Basin Integration")); QFutureWatcher futureWatcher; - QObject::connect(&futureWatcher, SIGNAL(finished()), &dialog, SLOT(reset())); - QObject::connect(&dialog, SIGNAL(canceled()), &futureWatcher, SLOT(cancel())); - QObject::connect(&futureWatcher, SIGNAL(progressRangeChanged(int, int)), - &dialog, SLOT(setRange(int, int))); - QObject::connect(&futureWatcher, SIGNAL(progressValueChanged(int)), &dialog, - SLOT(setValue(int))); + QObject::connect(&futureWatcher, &QFutureWatcherBase::finished, &dialog, + &QProgressDialog::reset); + QObject::connect(&dialog, &QProgressDialog::canceled, &futureWatcher, + &QFutureWatcherBase::cancel); + QObject::connect(&futureWatcher, &QFutureWatcherBase::progressRangeChanged, + &dialog, &QProgressDialog::setRange); + QObject::connect(&futureWatcher, &QFutureWatcherBase::progressValueChanged, + &dialog, &QProgressDialog::setValue); QFuture> future = QtConcurrent::mapped(inputList, QTAIMEvaluateProperty); @@ -1552,7 +1558,7 @@ QList QTAIMEvaluatePropertyRTP(QList variantList) ode.setBetaSpheres(betaSpheres); QVector3D endpoint = ode.integrate(QVector3D(x0, y0, z0)); -// QList path=ode.path(); + // QList path=ode.path(); #define HUGE_REAL_NUMBER 1.e20 qreal smallestDistance = HUGE_REAL_NUMBER; @@ -1590,7 +1596,7 @@ QList QTAIMEvaluatePropertyRTP(QList variantList) r0 * r0 * sin(t0) * eval.electronDensity(Eigen::Vector3d(x0, y0, z0)) - ); + ); } else { qDebug() << "mode not defined"; qreal zero = 0.0; @@ -1688,12 +1694,14 @@ void property_v_rtp(unsigned int /* ndim */, unsigned int npts, dialog.setLabelText(QString("Atomic Basin Integration")); QFutureWatcher futureWatcher; - QObject::connect(&futureWatcher, SIGNAL(finished()), &dialog, SLOT(reset())); - QObject::connect(&dialog, SIGNAL(canceled()), &futureWatcher, SLOT(cancel())); - QObject::connect(&futureWatcher, SIGNAL(progressRangeChanged(int, int)), - &dialog, SLOT(setRange(int, int))); - QObject::connect(&futureWatcher, SIGNAL(progressValueChanged(int)), &dialog, - SLOT(setValue(int))); + QObject::connect(&futureWatcher, &QFutureWatcherBase::finished, &dialog, + &QProgressDialog::reset); + QObject::connect(&dialog, &QProgressDialog::canceled, &futureWatcher, + &QFutureWatcherBase::cancel); + QObject::connect(&futureWatcher, &QFutureWatcherBase::progressRangeChanged, + &dialog, &QProgressDialog::setRange); + QObject::connect(&futureWatcher, &QFutureWatcherBase::progressValueChanged, + &dialog, &QProgressDialog::setValue); QFuture> future = QtConcurrent::mapped(inputList, QTAIMEvaluatePropertyRTP); @@ -2168,12 +2176,14 @@ void property_v_tp(unsigned int /* ndim */, unsigned int npts, dialog.setLabelText(QString("Atomic Basin Integration")); QFutureWatcher futureWatcher; - QObject::connect(&futureWatcher, SIGNAL(finished()), &dialog, SLOT(reset())); - QObject::connect(&dialog, SIGNAL(canceled()), &futureWatcher, SLOT(cancel())); - QObject::connect(&futureWatcher, SIGNAL(progressRangeChanged(int, int)), - &dialog, SLOT(setRange(int, int))); - QObject::connect(&futureWatcher, SIGNAL(progressValueChanged(int)), &dialog, - SLOT(setValue(int))); + QObject::connect(&futureWatcher, &QFutureWatcherBase::finished, &dialog, + &QProgressDialog::reset); + QObject::connect(&dialog, &QProgressDialog::canceled, &futureWatcher, + &QFutureWatcherBase::cancel); + QObject::connect(&futureWatcher, &QFutureWatcherBase::progressRangeChanged, + &dialog, &QProgressDialog::setRange); + QObject::connect(&futureWatcher, &QFutureWatcherBase::progressValueChanged, + &dialog, &QProgressDialog::setValue); QFuture> future = QtConcurrent::mapped(inputList, QTAIMEvaluatePropertyTP); @@ -2386,4 +2396,4 @@ QString QTAIMCubature::temporaryFileName() return tempFileName; } -} // end namespace Avogadro +} // namespace Avogadro::QtPlugins diff --git a/avogadro/qtplugins/qtaim/qtaimextension.cpp b/avogadro/qtplugins/qtaim/qtaimextension.cpp index 1fb5714a48..aedddbcf55 100644 --- a/avogadro/qtplugins/qtaim/qtaimextension.cpp +++ b/avogadro/qtplugins/qtaim/qtaimextension.cpp @@ -41,21 +41,21 @@ QTAIMExtension::QTAIMExtension(QObject* aParent) action->setText(tr("Molecular Graph…")); m_actions.append(action); action->setData(FirstAction); - connect(action, SIGNAL(triggered()), SLOT(triggered())); + connect(action, &QAction::triggered, this, &QTAIMExtension::triggered); // create an action for our second action action = new QAction(this); action->setText(tr("Molecular Graph with Lone Pairs…")); m_actions.append(action); action->setData(SecondAction); - connect(action, SIGNAL(triggered()), SLOT(triggered())); + connect(action, &QAction::triggered, this, &QTAIMExtension::triggered); // create an action for our third action action = new QAction(this); action->setText(tr("Atomic Charge…")); m_actions.append(action); action->setData(ThirdAction); - connect(action, SIGNAL(triggered()), SLOT(triggered())); + connect(action, &QAction::triggered, this, &QTAIMExtension::triggered); } QList QTAIMExtension::actions() const @@ -260,12 +260,9 @@ void QTAIMExtension::triggered() bondPathSegmentStartIndexVariantList.append(bpCtr); for (auto j : bondPathList.at(bondPair)) { - x = - j.x() * convertBohrToAngstrom; - y = - j.y() * convertBohrToAngstrom; - z = - j.z() * convertBohrToAngstrom; + x = j.x() * convertBohrToAngstrom; + y = j.y() * convertBohrToAngstrom; + z = j.z() * convertBohrToAngstrom; xBondPathsVariantList.append(x); yBondPathsVariantList.append(y); @@ -435,12 +432,9 @@ void QTAIMExtension::triggered() bondPathSegmentStartIndexVariantList.append(bpCtr); for (auto j : bondPathList.at(bondPair)) { - x = - j.x() * convertBohrToAngstrom; - y = - j.y() * convertBohrToAngstrom; - z = - j.z() * convertBohrToAngstrom; + x = j.x() * convertBohrToAngstrom; + y = j.y() * convertBohrToAngstrom; + z = j.z() * convertBohrToAngstrom; xBondPathsVariantList.append(x); yBondPathsVariantList.append(y); @@ -646,12 +640,9 @@ void QTAIMExtension::triggered() bondPathSegmentStartIndexVariantList.append(bpCtr); for (auto j : bondPathList.at(bondPair)) { - x = j.x() * - convertBohrToAngstrom; - y = j.y() * - convertBohrToAngstrom; - z = j.z() * - convertBohrToAngstrom; + x = j.x() * convertBohrToAngstrom; + y = j.y() * convertBohrToAngstrom; + z = j.z() * convertBohrToAngstrom; xBondPathsVariantList.append(x); yBondPathsVariantList.append(y); @@ -727,4 +718,4 @@ void QTAIMExtension::triggered() emit requestActiveDisplayTypes(QStringList() << "QTAIMScenePlugin"); } -} // end namespace Avogadro +} // namespace Avogadro::QtPlugins diff --git a/avogadro/qtplugins/quantuminput/quantuminput.cpp b/avogadro/qtplugins/quantuminput/quantuminput.cpp index 2c15d79a78..f3b5bd17c9 100644 --- a/avogadro/qtplugins/quantuminput/quantuminput.cpp +++ b/avogadro/qtplugins/quantuminput/quantuminput.cpp @@ -131,8 +131,8 @@ void QuantumInput::menuActivated() if (!dlg) { dlg = new InputGeneratorDialog(scriptFileName, theParent); - connect(&dlg->widget(), SIGNAL(openJobOutput(const MoleQueue::JobObject&)), - this, SLOT(openJobOutput(const MoleQueue::JobObject&))); + connect(&dlg->widget(), &MoleQueue::InputGeneratorWidget::openJobOutput, + this, &QuantumInput::openJobOutput); m_dialogs.insert(scriptFileName, dlg); } dlg->setMolecule(m_molecule); @@ -173,7 +173,7 @@ void QuantumInput::addAction(const QString& label, auto* action = new QAction(label, this); action->setData(scriptFilePath); action->setEnabled(true); - connect(action, SIGNAL(triggered()), SLOT(menuActivated())); + connect(action, &QAction::triggered, this, &QuantumInput::menuActivated); m_actions << action; } diff --git a/avogadro/qtplugins/resetview/resetview.cpp b/avogadro/qtplugins/resetview/resetview.cpp index c191959fa9..e3b1d3739d 100644 --- a/avogadro/qtplugins/resetview/resetview.cpp +++ b/avogadro/qtplugins/resetview/resetview.cpp @@ -41,8 +41,9 @@ ResetView::ResetView(QObject* parent_) m_centerAction->setProperty("menu priority", 210); m_viewToAxesAction->setProperty("menu priority", 200); - connect(m_centerAction, SIGNAL(triggered()), SLOT(centerView())); - connect(m_viewToAxesAction, SIGNAL(triggered()), SLOT(alignToAxes())); + connect(m_centerAction, &QAction::triggered, this, &ResetView::centerView); + connect(m_viewToAxesAction, &QAction::triggered, this, + &ResetView::alignToAxes); } ResetView::~ResetView() {} diff --git a/avogadro/qtplugins/scriptcharges/scriptchargemodel.cpp b/avogadro/qtplugins/scriptcharges/scriptchargemodel.cpp index 6802ef8e65..a84a8f68e7 100644 --- a/avogadro/qtplugins/scriptcharges/scriptchargemodel.cpp +++ b/avogadro/qtplugins/scriptcharges/scriptchargemodel.cpp @@ -27,8 +27,9 @@ namespace Avogadro::QtPlugins { ScriptChargeModel::ScriptChargeModel(const QString& scriptFileName_) - : m_interpreter(new QtGui::PythonScript(scriptFileName_)), m_valid(false), - m_partialCharges(false), m_electrostatics(false), m_inputFormat(NotUsed) + : m_interpreter(new QtGui::PythonScript(scriptFileName_)), + m_inputFormat(NotUsed), m_valid(false), m_partialCharges(false), + m_electrostatics(false) { m_elements.reset(); readMetaData(); diff --git a/avogadro/qtplugins/select/select.cpp b/avogadro/qtplugins/select/select.cpp index b93185f001..4dc6ee7233 100644 --- a/avogadro/qtplugins/select/select.cpp +++ b/avogadro/qtplugins/select/select.cpp @@ -31,13 +31,13 @@ Select::Select(QObject* parent_) auto* action = new QAction(tr("Select All"), this); action->setShortcut(QKeySequence("Ctrl+A")); action->setProperty("menu priority", 990); - connect(action, SIGNAL(triggered()), SLOT(selectAll())); + connect(action, &QAction::triggered, this, &Select::selectAll); m_actions.append(action); action = new QAction(tr("Select None"), this); action->setShortcut(QKeySequence("Ctrl+Shift+A")); action->setProperty("menu priority", 980); - connect(action, SIGNAL(triggered()), SLOT(selectNone())); + connect(action, &QAction::triggered, this, &Select::selectNone); m_actions.append(action); action = new QAction(this); @@ -47,7 +47,7 @@ Select::Select(QObject* parent_) action = new QAction(tr("Invert Selection"), this); action->setProperty("menu priority", 890); - connect(action, SIGNAL(triggered()), SLOT(invertSelection())); + connect(action, &QAction::triggered, this, &Select::invertSelection); m_actions.append(action); action = new QAction(tr("Select by Element…"), this); @@ -57,27 +57,27 @@ Select::Select(QObject* parent_) action = new QAction(tr("Select by Atom Index…"), this); action->setProperty("menu priority", 870); - connect(action, SIGNAL(triggered()), SLOT(selectAtomIndex())); + connect(action, &QAction::triggered, this, &Select::selectAtomIndex); m_actions.append(action); action = new QAction(tr("Select by Residue…"), this); action->setProperty("menu priority", 860); - connect(action, SIGNAL(triggered()), SLOT(selectResidue())); + connect(action, &QAction::triggered, this, &Select::selectResidue); m_actions.append(action); action = new QAction(tr("Select Backbone Atoms…"), this); action->setProperty("menu priority", 858); - connect(action, SIGNAL(triggered()), SLOT(selectBackboneAtoms())); + connect(action, &QAction::triggered, this, &Select::selectBackboneAtoms); m_actions.append(action); action = new QAction(tr("Select Sidechain Atoms…"), this); action->setProperty("menu priority", 855); - connect(action, SIGNAL(triggered()), SLOT(selectSidechainAtoms())); + connect(action, &QAction::triggered, this, &Select::selectSidechainAtoms); m_actions.append(action); action = new QAction(tr("Select Water"), this); action->setProperty("menu priority", 850); - connect(action, SIGNAL(triggered()), SLOT(selectWater())); + connect(action, &QAction::triggered, this, &Select::selectWater); m_actions.append(action); action = new QAction(this); @@ -87,12 +87,12 @@ Select::Select(QObject* parent_) action = new QAction(tr("Enlarge Selection"), this); action->setProperty("menu priority", 790); - connect(action, SIGNAL(triggered()), SLOT(enlargeSelection())); + connect(action, &QAction::triggered, this, &Select::enlargeSelection); m_actions.append(action); action = new QAction(tr("Shrink Selection"), this); action->setProperty("menu priority", 780); - connect(action, SIGNAL(triggered()), SLOT(shrinkSelection())); + connect(action, &QAction::triggered, this, &Select::shrinkSelection); m_actions.append(action); action = new QAction(this); @@ -102,7 +102,7 @@ Select::Select(QObject* parent_) action = new QAction(tr("Create New Layer from Selection"), this); action->setProperty("menu priority", 300); - connect(action, SIGNAL(triggered()), SLOT(createLayerFromSelection())); + connect(action, &QAction::triggered, this, &Select::createLayerFromSelection); m_actions.append(action); } diff --git a/avogadro/qtplugins/selectiontool/selectiontool.cpp b/avogadro/qtplugins/selectiontool/selectiontool.cpp index 6e1219d34b..7528b5e0d0 100644 --- a/avogadro/qtplugins/selectiontool/selectiontool.cpp +++ b/avogadro/qtplugins/selectiontool/selectiontool.cpp @@ -55,7 +55,8 @@ SelectionTool::SelectionTool(QObject* parent_) "\tDrag to select a range of atoms\n" "Right Mouse: \tClick outside the molecule to clear selection\n" "Use Ctrl to toggle the selection and shift to add to the selection.\n" - "Double-Click: \tSelect an entire fragment.").arg(shortcut)); + "Double-Click: \tSelect an entire fragment.") + .arg(shortcut)); setIcon(); } @@ -73,10 +74,10 @@ QWidget* SelectionTool::toolWidget() const { if (m_toolWidget == nullptr) { m_toolWidget = new SelectionToolWidget(qobject_cast(parent())); - connect(m_toolWidget, SIGNAL(colorApplied(Vector3ub)), this, - SLOT(applyColor(Vector3ub))); - connect(m_toolWidget, SIGNAL(changeLayer(int)), this, - SLOT(applyLayer(int))); + connect(m_toolWidget, &SelectionToolWidget::colorApplied, this, + &SelectionTool::applyColor); + connect(m_toolWidget, &SelectionToolWidget::changeLayer, this, + &SelectionTool::applyLayer); } return m_toolWidget; } diff --git a/avogadro/qtplugins/selectiontool/selectiontoolwidget.cpp b/avogadro/qtplugins/selectiontool/selectiontoolwidget.cpp index e1f8b1dce3..55ca1d3bae 100644 --- a/avogadro/qtplugins/selectiontool/selectiontoolwidget.cpp +++ b/avogadro/qtplugins/selectiontool/selectiontoolwidget.cpp @@ -15,8 +15,8 @@ SelectionToolWidget::SelectionToolWidget(QWidget* parent) { m_ui->setupUi(this); setDropDown(0, 1); - connect(m_ui->applyColorButton, SIGNAL(clicked()), this, - SLOT(userClickedColor())); + connect(m_ui->applyColorButton, &QAbstractButton::clicked, this, + &SelectionToolWidget::userClickedColor); } SelectionToolWidget::~SelectionToolWidget() diff --git a/avogadro/qtplugins/spacegroup/spacegroup.cpp b/avogadro/qtplugins/spacegroup/spacegroup.cpp index 4d3190ca20..bcb77f9ade 100644 --- a/avogadro/qtplugins/spacegroup/spacegroup.cpp +++ b/avogadro/qtplugins/spacegroup/spacegroup.cpp @@ -48,42 +48,45 @@ SpaceGroup::SpaceGroup(QObject* parent_) m_setToleranceAction(new QAction(this)) { m_perceiveSpaceGroupAction->setText(tr("Perceive Space Group…")); - connect(m_perceiveSpaceGroupAction, SIGNAL(triggered()), - SLOT(perceiveSpaceGroup())); + connect(m_perceiveSpaceGroupAction, &QAction::triggered, this, + &SpaceGroup::perceiveSpaceGroup); m_actions.push_back(m_perceiveSpaceGroupAction); m_perceiveSpaceGroupAction->setProperty("menu priority", 90); m_reduceToPrimitiveAction->setText(tr("Reduce to Primitive")); - connect(m_reduceToPrimitiveAction, SIGNAL(triggered()), - SLOT(reduceToPrimitive())); + connect(m_reduceToPrimitiveAction, &QAction::triggered, this, + &SpaceGroup::reduceToPrimitive); m_actions.push_back(m_reduceToPrimitiveAction); m_reduceToPrimitiveAction->setProperty("menu priority", 80); m_conventionalizeCellAction->setText(tr("Conventionalize Cell")); - connect(m_conventionalizeCellAction, SIGNAL(triggered()), - SLOT(conventionalizeCell())); + connect(m_conventionalizeCellAction, &QAction::triggered, this, + &SpaceGroup::conventionalizeCell); m_actions.push_back(m_conventionalizeCellAction); m_conventionalizeCellAction->setProperty("menu priority", 70); m_symmetrizeAction->setText(tr("Symmetrize")); - connect(m_symmetrizeAction, SIGNAL(triggered()), SLOT(symmetrize())); + connect(m_symmetrizeAction, &QAction::triggered, this, + &SpaceGroup::symmetrize); m_actions.push_back(m_symmetrizeAction); m_symmetrizeAction->setProperty("menu priority", 60); m_fillUnitCellAction->setText(tr("Fill Unit Cell…")); - connect(m_fillUnitCellAction, SIGNAL(triggered()), SLOT(fillUnitCell())); + connect(m_fillUnitCellAction, &QAction::triggered, this, + &SpaceGroup::fillUnitCell); m_actions.push_back(m_fillUnitCellAction); // should fall next to the "Wrap Atoms to Unit Cell" action m_fillUnitCellAction->setProperty("menu priority", 185); m_reduceToAsymmetricUnitAction->setText(tr("Reduce to Asymmetric Unit")); - connect(m_reduceToAsymmetricUnitAction, SIGNAL(triggered()), - SLOT(reduceToAsymmetricUnit())); + connect(m_reduceToAsymmetricUnitAction, &QAction::triggered, this, + &SpaceGroup::reduceToAsymmetricUnit); m_actions.push_back(m_reduceToAsymmetricUnitAction); m_reduceToAsymmetricUnitAction->setProperty("menu priority", 40); m_setToleranceAction->setText(tr("Set Tolerance…")); - connect(m_setToleranceAction, SIGNAL(triggered()), SLOT(setTolerance())); + connect(m_setToleranceAction, &QAction::triggered, this, + &SpaceGroup::setTolerance); m_actions.push_back(m_setToleranceAction); m_setToleranceAction->setProperty("menu priority", 0); @@ -140,7 +143,8 @@ void SpaceGroup::setMolecule(QtGui::Molecule* mol) m_molecule = mol; if (m_molecule) - connect(m_molecule, SIGNAL(changed(uint)), SLOT(moleculeChanged(uint))); + connect(m_molecule, &QtGui::Molecule::changed, this, + &SpaceGroup::moleculeChanged); updateActions(); } @@ -401,11 +405,11 @@ unsigned short SpaceGroup::selectSpaceGroup() view->resizeRowsToContents(); view->setMinimumWidth(view->horizontalHeader()->length() + view->verticalScrollBar()->sizeHint().width()); - connect(view, SIGNAL(activated(QModelIndex)), &dialog, SLOT(accept())); + connect(view, &QAbstractItemView::activated, &dialog, &QDialog::accept); auto* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); - connect(buttons, SIGNAL(accepted()), &dialog, SLOT(accept())); - connect(buttons, SIGNAL(rejected()), &dialog, SLOT(reject())); + connect(buttons, &QDialogButtonBox::accepted, &dialog, &QDialog::accept); + connect(buttons, &QDialogButtonBox::rejected, &dialog, &QDialog::reject); dialog.layout()->addWidget(buttons); if (dialog.exec() != QDialog::Accepted) return 0; diff --git a/avogadro/qtplugins/surfaces/orbitals.cpp b/avogadro/qtplugins/surfaces/orbitals.cpp index 1c446a026d..c52be07465 100644 --- a/avogadro/qtplugins/surfaces/orbitals.cpp +++ b/avogadro/qtplugins/surfaces/orbitals.cpp @@ -28,12 +28,12 @@ const double cubePadding = 5.0; const int smoothingPasses = 1; Orbitals::Orbitals(QObject* p) - : ExtensionPlugin(p), m_molecule(nullptr), m_dialog(nullptr), - m_action(new QAction(this)), m_runningMutex(new QMutex) + : ExtensionPlugin(p), m_action(new QAction(this)), m_molecule(nullptr), + m_dialog(nullptr), m_runningMutex(new QMutex) { m_action->setEnabled(false); m_action->setText(tr("Molecular Orbitals…")); - connect(m_action, SIGNAL(triggered()), SLOT(openDialog())); + connect(m_action, &QAction::triggered, this, &Orbitals::openDialog); } Orbitals::~Orbitals() @@ -88,8 +88,8 @@ void Orbitals::setMolecule(QtGui::Molecule* mol) m_dialog->hide(); } - connect(m_molecule, SIGNAL(changed(unsigned int)), - SLOT(moleculeChanged(unsigned int))); + connect(m_molecule, &QtGui::Molecule::changed, this, + &Orbitals::moleculeChanged); // Stuff we manage that will not be valid any longer m_queue.clear(); @@ -128,12 +128,12 @@ void Orbitals::loadOrbitals() if (!m_dialog) { m_dialog = new OrbitalWidget(qobject_cast(parent()), Qt::Window); - connect(m_dialog, SIGNAL(orbitalSelected(unsigned int)), this, - SLOT(renderOrbital(unsigned int))); - connect(m_dialog, SIGNAL(renderRequested(unsigned int, double)), this, - SLOT(calculateOrbitalFromWidget(unsigned int, double))); - connect(m_dialog, SIGNAL(calculateAll()), this, - SLOT(precalculateOrbitals())); + connect(m_dialog, &OrbitalWidget::orbitalSelected, this, + &Orbitals::renderOrbital); + connect(m_dialog, &OrbitalWidget::renderRequested, this, + &Orbitals::calculateOrbitalFromWidget); + connect(m_dialog, &OrbitalWidget::calculateAll, this, + &Orbitals::precalculateOrbitals); } m_dialog->fillTable(m_basis); @@ -164,12 +164,12 @@ void Orbitals::openDialog() { if (!m_dialog) { m_dialog = new OrbitalWidget(qobject_cast(parent()), Qt::Window); - connect(m_dialog, SIGNAL(orbitalSelected(unsigned int)), this, - SLOT(renderOrbital(unsigned int))); - connect(m_dialog, SIGNAL(renderRequested(unsigned int, double)), this, - SLOT(calculateOrbitalFromWidget(unsigned int, double))); - connect(m_dialog, SIGNAL(calculateAll()), this, - SLOT(precalculateOrbitals())); + connect(m_dialog, &OrbitalWidget::orbitalSelected, this, + &Orbitals::renderOrbital); + connect(m_dialog, &OrbitalWidget::renderRequested, this, + &Orbitals::calculateOrbitalFromWidget); + connect(m_dialog, &OrbitalWidget::calculateAll, this, + &Orbitals::precalculateOrbitals); } m_dialog->show(); @@ -371,13 +371,14 @@ void Orbitals::calculateCube() m_gaussianConcurrent->setMolecule(m_molecule); auto* watcher = &m_gaussianConcurrent->watcher(); - connect(watcher, SIGNAL(finished()), this, SLOT(calculateCubeDone())); + connect(watcher, &QFutureWatcherBase::finished, this, + &Orbitals::calculateCubeDone); m_dialog->initializeProgress(info->orbital, watcher->progressMinimum(), watcher->progressMaximum(), 1, 3); - connect(watcher, SIGNAL(progressValueChanged(int)), this, - SLOT(updateProgress(int))); + connect(watcher, &QFutureWatcherBase::progressValueChanged, this, + &Orbitals::updateProgress); #ifndef NDEBUG qDebug() << info->orbital << " Cube calculation started."; @@ -411,7 +412,8 @@ void Orbitals::calculatePosMesh() if (!m_meshGenerator) { m_meshGenerator = new QtGui::MeshGenerator; } - connect(m_meshGenerator, SIGNAL(finished()), SLOT(calculatePosMeshDone())); + connect(m_meshGenerator, &QThread::finished, this, + &Orbitals::calculatePosMeshDone); m_meshGenerator->initialize(cube, posMesh, m_isoValue, smoothingPasses); m_meshGenerator->start(); } @@ -436,7 +438,8 @@ void Orbitals::calculateNegMesh() // shouldn't happen, but better to be careful m_meshGenerator = new QtGui::MeshGenerator; } - connect(m_meshGenerator, SIGNAL(finished()), SLOT(calculateNegMeshDone())); + connect(m_meshGenerator, &QThread::finished, this, + &Orbitals::calculateNegMeshDone); // true indicates that we want to reverse the surface m_meshGenerator->initialize(cube, negMesh, -m_isoValue, smoothingPasses, true); diff --git a/avogadro/qtplugins/surfaces/orbitalwidget.cpp b/avogadro/qtplugins/surfaces/orbitalwidget.cpp index 754dba28fe..54e86d59ff 100644 --- a/avogadro/qtplugins/surfaces/orbitalwidget.cpp +++ b/avogadro/qtplugins/surfaces/orbitalwidget.cpp @@ -39,15 +39,15 @@ OrbitalWidget::OrbitalWidget(QWidget* parent, Qt::WindowFlags f) ui.table->hideColumn(OrbitalTableModel::C_Symmetry); ui.table->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - connect( - ui.table->selectionModel(), - SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), - this, SLOT(tableClicked(const QItemSelection&))); - connect(ui.push_render, SIGNAL(clicked()), this, SLOT(renderClicked())); + connect(ui.table->selectionModel(), &QItemSelectionModel::selectionChanged, + this, &OrbitalWidget::tableClicked); + connect(ui.push_render, &QAbstractButton::clicked, this, + &OrbitalWidget::renderClicked); // TODO: Implement configure dialog ui.push_configure->setVisible(false); - connect(ui.push_configure, SIGNAL(clicked()), this, SLOT(configureClicked())); + connect(ui.push_configure, &QAbstractButton::clicked, this, + &OrbitalWidget::configureClicked); readSettings(); } diff --git a/avogadro/qtplugins/surfaces/surfacedialog.cpp b/avogadro/qtplugins/surfaces/surfacedialog.cpp index 14228849de..f2904dc99e 100644 --- a/avogadro/qtplugins/surfaces/surfacedialog.cpp +++ b/avogadro/qtplugins/surfaces/surfacedialog.cpp @@ -37,8 +37,10 @@ SurfaceDialog::SurfaceDialog(QWidget* parent_, Qt::WindowFlags f) connect(m_ui->smoothingCombo, SIGNAL(currentIndexChanged(int)), SLOT(smoothingComboChanged(int))); connect(m_ui->stepValue, SIGNAL(valueChanged(int)), SIGNAL(stepChanged(int))); - connect(m_ui->calculateButton, SIGNAL(clicked()), SLOT(calculateClicked())); - connect(m_ui->recordButton, SIGNAL(clicked()), SLOT(record())); + connect(m_ui->calculateButton, &QAbstractButton::clicked, this, + &SurfaceDialog::calculateClicked); + connect(m_ui->recordButton, &QAbstractButton::clicked, this, + &SurfaceDialog::record); } SurfaceDialog::~SurfaceDialog() diff --git a/avogadro/qtplugins/surfaces/surfaces.cpp b/avogadro/qtplugins/surfaces/surfaces.cpp index 716c583f0a..5e299a3037 100644 --- a/avogadro/qtplugins/surfaces/surfaces.cpp +++ b/avogadro/qtplugins/surfaces/surfaces.cpp @@ -82,9 +82,11 @@ Surfaces::Surfaces(QObject* p) : ExtensionPlugin(p), d(new PIMPL()) { auto action = new QAction(this); action->setText(tr("Create Surfaces…")); - connect(action, SIGNAL(triggered()), SLOT(surfacesActivated())); - connect(&m_displayMeshWatcher, SIGNAL(finished()), SLOT(displayMesh())); - connect(&m_performEDTStepWatcher, SIGNAL(finished()), SLOT(performEDTStep())); + connect(action, &QAction::triggered, this, &Surfaces::surfacesActivated); + connect(&m_displayMeshWatcher, &QFutureWatcherBase::finished, this, + &Surfaces::displayMesh); + connect(&m_performEDTStepWatcher, &QFutureWatcherBase::finished, this, + &Surfaces::performEDTStep); m_actions.push_back(action); @@ -240,7 +242,8 @@ void Surfaces::setMolecule(QtGui::Molecule* mol) m_molecule = mol; if (m_molecule != nullptr) { - connect(m_molecule, SIGNAL(changed(uint)), SLOT(moleculeChanged(uint))); + connect(m_molecule, &QtGui::Molecule::changed, this, + &Surfaces::moleculeChanged); } } @@ -268,10 +271,12 @@ void Surfaces::surfacesActivated() { if (!m_dialog) { m_dialog = new SurfaceDialog(qobject_cast(parent())); - connect(m_dialog, SIGNAL(calculateClickedSignal()), - SLOT(calculateSurface())); - connect(m_dialog, SIGNAL(recordClicked()), SLOT(recordMovie())); - connect(m_dialog, SIGNAL(stepChanged(int)), SLOT(stepChanged(int))); + connect(m_dialog, &SurfaceDialog::calculateClickedSignal, this, + &Surfaces::calculateSurface); + connect(m_dialog, &SurfaceDialog::recordClicked, this, + &Surfaces::recordMovie); + connect(m_dialog, &SurfaceDialog::stepChanged, this, + &Surfaces::stepChanged); } if (m_basis) { @@ -622,14 +627,15 @@ void Surfaces::calculateQM(Type type, int index, bool beta, float isoValue, if (connectSlots) { connect(&m_gaussianConcurrent->watcher(), - SIGNAL(progressValueChanged(int)), m_progressDialog, - SLOT(setValue(int))); + &QFutureWatcherBase::progressValueChanged, m_progressDialog, + &QProgressDialog::setValue); connect(&m_gaussianConcurrent->watcher(), - SIGNAL(progressRangeChanged(int, int)), m_progressDialog, - SLOT(setRange(int, int))); - connect(m_gaussianConcurrent, SIGNAL(finished()), SLOT(displayMesh())); - connect(m_progressDialog, SIGNAL(canceled()), - &m_gaussianConcurrent->watcher(), SLOT(cancel())); + &QFutureWatcherBase::progressRangeChanged, m_progressDialog, + &QProgressDialog::setRange); + connect(m_gaussianConcurrent, &QtGui::GaussianSetConcurrent::finished, + this, &Surfaces::displayMesh); + connect(m_progressDialog, &QProgressDialog::canceled, + &m_gaussianConcurrent->watcher(), &QFutureWatcherBase::cancel); } } else { // slaters @@ -639,14 +645,16 @@ void Surfaces::calculateQM(Type type, int index, bool beta, float isoValue, m_progressDialog->setValue(m_slaterConcurrent->watcher().progressValue()); m_progressDialog->show(); - connect(&m_slaterConcurrent->watcher(), SIGNAL(progressValueChanged(int)), - m_progressDialog, SLOT(setValue(int))); connect(&m_slaterConcurrent->watcher(), - SIGNAL(progressRangeChanged(int, int)), m_progressDialog, - SLOT(setRange(int, int))); - connect(m_progressDialog, SIGNAL(canceled()), - &m_slaterConcurrent->watcher(), SLOT(cancel())); - connect(m_slaterConcurrent, SIGNAL(finished()), SLOT(displayMesh())); + &QFutureWatcherBase::progressValueChanged, m_progressDialog, + &QProgressDialog::setValue); + connect(&m_slaterConcurrent->watcher(), + &QFutureWatcherBase::progressRangeChanged, m_progressDialog, + &QProgressDialog::setRange); + connect(m_progressDialog, &QProgressDialog::canceled, + &m_slaterConcurrent->watcher(), &QFutureWatcherBase::cancel); + connect(m_slaterConcurrent, &QtGui::SlaterSetConcurrent::finished, this, + &Surfaces::displayMesh); } } @@ -704,7 +712,8 @@ void Surfaces::displayMesh() m_mesh1 = m_molecule->addMesh(); if (!m_meshGenerator1) { m_meshGenerator1 = new QtGui::MeshGenerator; - connect(m_meshGenerator1, SIGNAL(finished()), SLOT(meshFinished())); + connect(m_meshGenerator1, &QThread::finished, this, + &Surfaces::meshFinished); } m_meshGenerator1->initialize(m_cube, m_mesh1, m_isoValue, m_smoothingPasses); @@ -720,7 +729,8 @@ void Surfaces::displayMesh() m_mesh2 = m_molecule->addMesh(); if (!m_meshGenerator2) { m_meshGenerator2 = new QtGui::MeshGenerator; - connect(m_meshGenerator2, SIGNAL(finished()), SLOT(meshFinished())); + connect(m_meshGenerator2, &QThread::finished, this, + &Surfaces::meshFinished); } m_meshGenerator2->initialize(m_cube, m_mesh2, -m_isoValue, m_smoothingPasses, true); diff --git a/avogadro/qtplugins/svg/svg.cpp b/avogadro/qtplugins/svg/svg.cpp index ee6e9ba359..271d398c9b 100644 --- a/avogadro/qtplugins/svg/svg.cpp +++ b/avogadro/qtplugins/svg/svg.cpp @@ -5,11 +5,11 @@ #include "svg.h" +#include #include #include #include #include -#include #include #include #include @@ -27,9 +27,10 @@ const Vector3ub SVG::DEFAULT_BOND_COLOR = Vector3ub(125, 125, 125); SVG::SVG(QObject* parent_) : Avogadro::QtGui::ExtensionPlugin(parent_), m_molecule(nullptr), - m_scene(nullptr), m_camera(nullptr), m_action(new QAction(tr("&SVG…"), this)) + m_scene(nullptr), m_camera(nullptr), + m_action(new QAction(tr("&SVG…"), this)) { - connect(m_action, SIGNAL(triggered()), SLOT(render())); + connect(m_action, &QAction::triggered, this, &SVG::render); } SVG::~SVG() {} @@ -277,4 +278,4 @@ void SVG::render() painter.end(); } -} // namespace Avogadro +} // namespace Avogadro::QtPlugins diff --git a/avogadro/qtplugins/symmetry/symmetry.cpp b/avogadro/qtplugins/symmetry/symmetry.cpp index 44985f4d85..7b2cd20309 100644 --- a/avogadro/qtplugins/symmetry/symmetry.cpp +++ b/avogadro/qtplugins/symmetry/symmetry.cpp @@ -9,8 +9,8 @@ #include "symmetryutil.h" -//#include -//#include +// #include +// #include #include @@ -30,17 +30,16 @@ using namespace Avogadro::QtPlugins::SymmetryUtil; namespace Avogadro::QtPlugins { Symmetry::Symmetry(QObject* parent_) - : Avogadro::QtGui::ExtensionPlugin(parent_) - , m_molecule(nullptr) - , m_symmetryWidget(nullptr) - , m_viewSymmetryAction(new QAction(this)) + : Avogadro::QtGui::ExtensionPlugin(parent_), m_molecule(nullptr), + m_symmetryWidget(nullptr), m_viewSymmetryAction(new QAction(this)) { m_ctx = msymCreateContext(); m_viewSymmetryAction->setText(tr("Symmetry…")); m_viewSymmetryAction->setProperty("menu priority", -50); - connect(m_viewSymmetryAction, SIGNAL(triggered()), SLOT(viewSymmetry())); + connect(m_viewSymmetryAction, &QAction::triggered, this, + &Symmetry::viewSymmetry); m_actions.push_back(m_viewSymmetryAction); /* @@ -95,7 +94,8 @@ void Symmetry::setMolecule(QtGui::Molecule* mol) m_symmetryWidget->setMolecule(m_molecule); if (m_molecule) - connect(m_molecule, SIGNAL(changed(uint)), SLOT(moleculeChanged(uint))); + connect(m_molecule, &QtGui::Molecule::changed, this, + &Symmetry::moleculeChanged); updateActions(); m_dirty = true; @@ -154,10 +154,10 @@ void Symmetry::viewSymmetry() if (!m_symmetryWidget) { m_symmetryWidget = new SymmetryWidget(qobject_cast(parent())); m_symmetryWidget->setMolecule(m_molecule); - connect(m_symmetryWidget, SIGNAL(detectSymmetry()), SLOT(detectSymmetry())); - connect(m_symmetryWidget, - SIGNAL(symmetrizeMolecule()), - SLOT(symmetrizeMolecule())); + connect(m_symmetryWidget, &SymmetryWidget::detectSymmetry, this, + &Symmetry::detectSymmetry); + connect(m_symmetryWidget, &SymmetryWidget::symmetrizeMolecule, this, + &Symmetry::symmetrizeMolecule); } if (m_dirty) { @@ -376,4 +376,4 @@ void Symmetry::standardOrientation() | Molecule::Atoms | Molecule::UnitCell); }*/ -} // namespace Avogadro +} // namespace Avogadro::QtPlugins diff --git a/avogadro/qtplugins/symmetry/symmetrywidget.cpp b/avogadro/qtplugins/symmetry/symmetrywidget.cpp index 5c368cc630..be26eecbe4 100644 --- a/avogadro/qtplugins/symmetry/symmetrywidget.cpp +++ b/avogadro/qtplugins/symmetry/symmetrywidget.cpp @@ -63,11 +63,12 @@ msym_thresholds_t sloppy_thresholds = { }; SymmetryWidget::SymmetryWidget(QWidget* parent_) - : QWidget(parent_), m_ui(new Ui::SymmetryWidget), m_molecule(nullptr), + : QWidget(parent_), m_ui(new Ui::SymmetryWidget), m_equivalenceTreeModel(new QStandardItemModel(this)), m_operationsTableModel(new OperationsTableModel(this)), - m_subgroupsTreeModel(new QStandardItemModel(this)), m_es(nullptr), - m_sops(nullptr), m_sg(nullptr), m_sopsl(0), m_sgl(0), m_radius(0.0) + m_subgroupsTreeModel(new QStandardItemModel(this)), m_molecule(nullptr), + m_es(nullptr), m_sops(nullptr), m_sg(nullptr), m_sopsl(0), m_sgl(0), + m_radius(0.0) { setWindowFlags(Qt::Dialog); m_ui->setupUi(this); @@ -81,10 +82,10 @@ SymmetryWidget::SymmetryWidget(QWidget* parent_) m_ui->subgroupsTree->setModel(m_subgroupsTreeModel); m_ui->subgroupsTree->setItemDelegateForColumn(0, new RichTextDelegate(this)); - connect(m_ui->detectSymmetryButton, SIGNAL(clicked()), - SIGNAL(detectSymmetry())); - connect(m_ui->symmetrizeMoleculeButton, SIGNAL(clicked()), - SIGNAL(symmetrizeMolecule())); + connect(m_ui->detectSymmetryButton, &QAbstractButton::clicked, this, + &SymmetryWidget::detectSymmetry); + connect(m_ui->symmetrizeMoleculeButton, &QAbstractButton::clicked, this, + &SymmetryWidget::symmetrizeMolecule); connect( m_ui->equivalenceTree->selectionModel(), @@ -97,11 +98,9 @@ SymmetryWidget::SymmetryWidget(QWidget* parent_) SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), SLOT(operationsSelectionChanged(const QItemSelection&, const QItemSelection&))); - connect( - m_ui->subgroupsTree->selectionModel(), - SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), - SLOT( - subgroupsSelectionChanged(const QItemSelection&, const QItemSelection&))); + connect(m_ui->subgroupsTree->selectionModel(), + &QItemSelectionModel::selectionChanged, this, + &SymmetryWidget::subgroupsSelectionChanged); } SymmetryWidget::~SymmetryWidget() @@ -118,7 +117,8 @@ void SymmetryWidget::setMolecule(QtGui::Molecule* molecule) m_molecule = molecule; if (m_molecule) { - connect(m_molecule, SIGNAL(changed(uint)), SLOT(moleculeChanged(uint))); + connect(m_molecule, &QtGui::Molecule::changed, this, + &SymmetryWidget::moleculeChanged); } } } diff --git a/avogadro/qtplugins/templatetool/templatetool.cpp b/avogadro/qtplugins/templatetool/templatetool.cpp index a631d33441..a9c672be57 100644 --- a/avogadro/qtplugins/templatetool/templatetool.cpp +++ b/avogadro/qtplugins/templatetool/templatetool.cpp @@ -196,7 +196,7 @@ QUndoCommand* TemplateTool::keyPressEvent(QKeyEvent* e) // Set a timer to clear the buffer on first keypress: if (m_keyPressBuffer.isEmpty()) - QTimer::singleShot(2000, this, SLOT(clearKeyPressBuffer())); + QTimer::singleShot(2000, this, &TemplateTool::clearKeyPressBuffer); m_keyPressBuffer.append(m_keyPressBuffer.isEmpty() ? e->text().toUpper() : e->text().toLower()); diff --git a/avogadro/qtplugins/templatetool/templatetoolwidget.cpp b/avogadro/qtplugins/templatetool/templatetoolwidget.cpp index a87cdd8418..3c07b88687 100644 --- a/avogadro/qtplugins/templatetool/templatetoolwidget.cpp +++ b/avogadro/qtplugins/templatetool/templatetoolwidget.cpp @@ -47,7 +47,7 @@ enum LigandType TemplateToolWidget::TemplateToolWidget(QWidget* parent_) : QWidget(parent_), m_ui(new Ui::TemplateToolWidget), - m_elementSelector(nullptr), m_fragmentDialog(nullptr), m_currentElement(26) + m_fragmentDialog(nullptr), m_elementSelector(nullptr), m_currentElement(26) { m_ui->setupUi(this); @@ -217,8 +217,8 @@ void TemplateToolWidget::groupChanged(int index) m_fragmentDialog->deleteLater(); m_fragmentDialog = new QtGui::InsertFragmentDialog(this, path); - connect(m_fragmentDialog, SIGNAL(performInsert(const QString&, bool)), this, - SLOT(otherLigandInsert(const QString&, bool))); + connect(m_fragmentDialog, &QtGui::InsertFragmentDialog::performInsert, this, + &TemplateToolWidget::otherLigandInsert); m_fragmentDialog->show(); return; } @@ -268,8 +268,8 @@ void TemplateToolWidget::ligandChanged(int index) m_fragmentDialog->deleteLater(); m_fragmentDialog = new QtGui::InsertFragmentDialog(this, path); - connect(m_fragmentDialog, SIGNAL(performInsert(const QString&, bool)), this, - SLOT(otherLigandInsert(const QString&, bool))); + connect(m_fragmentDialog, &QtGui::InsertFragmentDialog::performInsert, this, + &TemplateToolWidget::otherLigandInsert); m_fragmentDialog->show(); return; } @@ -388,8 +388,8 @@ void TemplateToolWidget::elementChanged(int index) if (itemData.toInt() == ELEMENT_SELECTOR_TAG) { if (!m_elementSelector) { m_elementSelector = new QtGui::PeriodicTableView(this); - connect(m_elementSelector, SIGNAL(elementChanged(int)), this, - SLOT(elementSelectedFromTable(int))); + connect(m_elementSelector, &QtGui::PeriodicTableView::elementChanged, + this, &TemplateToolWidget::elementSelectedFromTable); } m_elementSelector->setElement(m_currentElement); m_elementSelector->show(); diff --git a/avogadro/qtplugins/vibrations/vibrationdialog.cpp b/avogadro/qtplugins/vibrations/vibrationdialog.cpp index 07b7175cae..c613d13e93 100644 --- a/avogadro/qtplugins/vibrations/vibrationdialog.cpp +++ b/avogadro/qtplugins/vibrations/vibrationdialog.cpp @@ -23,10 +23,12 @@ VibrationDialog::VibrationDialog(QWidget* parent_, Qt::WindowFlags f) m_ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows); m_ui->tableView->setSelectionMode(QAbstractItemView::ExtendedSelection); - connect(m_ui->amplitudeSlider, SIGNAL(sliderMoved(int)), - SIGNAL(amplitudeChanged(int))); - connect(m_ui->startButton, SIGNAL(clicked(bool)), SIGNAL(startAnimation())); - connect(m_ui->stopButton, SIGNAL(clicked(bool)), SIGNAL(stopAnimation())); + connect(m_ui->amplitudeSlider, &QAbstractSlider::sliderMoved, this, + &VibrationDialog::amplitudeChanged); + connect(m_ui->startButton, &QAbstractButton::clicked, this, + &VibrationDialog::startAnimation); + connect(m_ui->stopButton, &QAbstractButton::clicked, this, + &VibrationDialog::stopAnimation); } VibrationDialog::~VibrationDialog() @@ -38,16 +40,16 @@ void VibrationDialog::setMolecule(QtGui::Molecule* molecule) { if (m_ui->tableView->selectionModel()) { disconnect(m_ui->tableView->selectionModel(), - SIGNAL(currentRowChanged(QModelIndex, QModelIndex)), this, - SLOT(selectRow(QModelIndex))); + &QItemSelectionModel::currentRowChanged, this, + &VibrationDialog::selectRow); } auto* model = new VibrationModel(this); model->setMolecule(molecule); m_ui->tableView->setModel(model); connect(m_ui->tableView->selectionModel(), - SIGNAL(currentRowChanged(QModelIndex, QModelIndex)), - SLOT(selectRow(QModelIndex))); + &QItemSelectionModel::currentRowChanged, this, + &VibrationDialog::selectRow); Core::Array freqs = molecule->vibrationFrequencies(); for (size_t i = 0; i < freqs.size(); ++i) { diff --git a/avogadro/qtplugins/vibrations/vibrations.cpp b/avogadro/qtplugins/vibrations/vibrations.cpp index 5f351e2244..45003c8b05 100644 --- a/avogadro/qtplugins/vibrations/vibrations.cpp +++ b/avogadro/qtplugins/vibrations/vibrations.cpp @@ -25,7 +25,7 @@ Vibrations::Vibrations(QObject* p) auto* action = new QAction(this); action->setEnabled(false); action->setText(tr("Vibrational Modes…")); - connect(action, SIGNAL(triggered()), SLOT(openDialog())); + connect(action, &QAction::triggered, this, &Vibrations::openDialog); m_actions.push_back(action); } @@ -63,8 +63,8 @@ void Vibrations::setMolecule(QtGui::Molecule* mol) if (isVibrational) openDialog(); - connect(m_molecule, SIGNAL(changed(unsigned int)), - SLOT(moleculeChanged(unsigned int))); + connect(m_molecule, &QtGui::Molecule::changed, this, + &Vibrations::moleculeChanged); } void Vibrations::moleculeChanged(unsigned int changes) @@ -207,7 +207,7 @@ void Vibrations::startVibrationAnimation() if (!m_timer) { m_timer = new QTimer(this); - connect(m_timer, SIGNAL(timeout()), SLOT(advanceFrame())); + connect(m_timer, &QTimer::timeout, this, &Vibrations::advanceFrame); } if (!m_timer->isActive()) { m_timer->start(50); @@ -228,11 +228,14 @@ void Vibrations::openDialog() { if (!m_dialog) { m_dialog = new VibrationDialog(qobject_cast(parent())); - connect(m_dialog, SIGNAL(modeChanged(int)), SLOT(setMode(int))); - connect(m_dialog, SIGNAL(amplitudeChanged(int)), SLOT(setAmplitude(int))); - connect(m_dialog, SIGNAL(startAnimation()), - SLOT(startVibrationAnimation())); - connect(m_dialog, SIGNAL(stopAnimation()), SLOT(stopVibrationAnimation())); + connect(m_dialog, &VibrationDialog::modeChanged, this, + &Vibrations::setMode); + connect(m_dialog, &VibrationDialog::amplitudeChanged, this, + &Vibrations::setAmplitude); + connect(m_dialog, &VibrationDialog::startAnimation, this, + &Vibrations::startVibrationAnimation); + connect(m_dialog, &VibrationDialog::stopAnimation, this, + &Vibrations::stopVibrationAnimation); } if (m_molecule) m_dialog->setMolecule(m_molecule); diff --git a/avogadro/qtplugins/vrml/vrml.cpp b/avogadro/qtplugins/vrml/vrml.cpp index 8d52d60f4c..8f33b05c89 100644 --- a/avogadro/qtplugins/vrml/vrml.cpp +++ b/avogadro/qtplugins/vrml/vrml.cpp @@ -10,11 +10,11 @@ #include #include +#include #include #include #include #include -#include #include #include #include @@ -28,12 +28,10 @@ VRML::VRML(QObject* p) : Avogadro::QtGui::ExtensionPlugin(p), m_molecule(nullptr), m_scene(nullptr), m_camera(nullptr), m_action(new QAction(tr("VRML Render…"), this)) { - connect(m_action, SIGNAL(triggered()), SLOT(render())); + connect(m_action, &QAction::triggered, this, &VRML::render); } -VRML::~VRML() -{ -} +VRML::~VRML() {} QList VRML::actions() const { @@ -82,4 +80,4 @@ void VRML::render() file.close(); } -} // namespace Avogadro +} // namespace Avogadro::QtPlugins diff --git a/avogadro/quantumio/orca.cpp b/avogadro/quantumio/orca.cpp index 72c346f139..5a26526295 100644 --- a/avogadro/quantumio/orca.cpp +++ b/avogadro/quantumio/orca.cpp @@ -484,6 +484,7 @@ void ORCAOutput::processLine(std::istream& in, GaussianSet* basis) } m_currentMode = NotParsing; + break; } case OrbitalEnergies: { if (key.empty()) @@ -681,6 +682,7 @@ void ORCAOutput::processLine(std::istream& in, GaussianSet* basis) break; // hit the blank line } m_currentMode = NotParsing; + break; } case ECD: { if (key.empty()) @@ -709,6 +711,7 @@ void ORCAOutput::processLine(std::istream& in, GaussianSet* basis) break; // hit the blank line } m_currentMode = NotParsing; + break; } case NMR: { if (key.empty()) diff --git a/avogadro/rendering/arrowgeometry.cpp b/avogadro/rendering/arrowgeometry.cpp index b1aac510fb..370f0b8d4f 100644 --- a/avogadro/rendering/arrowgeometry.cpp +++ b/avogadro/rendering/arrowgeometry.cpp @@ -42,7 +42,7 @@ class ArrowGeometry::Private }; ArrowGeometry::ArrowGeometry() - : m_dirty(false), d(new Private), m_color(0, 255, 0) + : m_color(0, 255, 0), m_dirty(false), d(new Private) { } diff --git a/avogadro/rendering/solidpipeline.cpp b/avogadro/rendering/solidpipeline.cpp index 4707c85ec8..ab5d96596d 100644 --- a/avogadro/rendering/solidpipeline.cpp +++ b/avogadro/rendering/solidpipeline.cpp @@ -84,11 +84,11 @@ void initializeFramebuffer(GLuint* outFBO, GLuint* texRGB, GLuint* texDepth) } SolidPipeline::SolidPipeline() - : m_pixelRatio(1.0f), m_aoEnabled(false), m_dofEnabled(false), - m_aoStrength(1.0f), m_fogStrength(1.0f), m_fogPosition(1.0), - m_fogEnabled(true), m_edEnabled(false), m_edStrength(1.0f), m_width(0), - m_height(0), m_dofStrength(1.0f), m_dofPosition(1.0), - m_backgroundColor(0, 0, 0, 0), d(new Private) + : m_pixelRatio(1.0f), m_aoEnabled(false), m_dofStrength(1.0f), + m_dofPosition(1.0), m_dofEnabled(false), m_fogPosition(1.0), + m_backgroundColor(0, 0, 0, 0), m_fogEnabled(true), m_aoStrength(1.0f), + m_fogStrength(1.0f), m_edEnabled(false), m_edStrength(1.0f), m_width(0), + m_height(0), d(new Private) { }