Deprecation Cleanup (#119)

* squash unused warning

* Check QtVersion and use correct calls for (re)moved methods

* QSqlQuery = is deprecated replaced with std::move

Co-authored-by: Chris Rizzitello <crizzitello@ics.com>
main
crizzitello 2022-04-08 11:39:55 -04:00 committed by GitHub
parent 129e84e319
commit 4e3ce893d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 8 deletions

View File

@ -24,9 +24,13 @@ void TagWidget::setReadOnly(bool readonly) {
} }
void TagWidget::mouseReleaseEvent(QMouseEvent* evt) { void TagWidget::mouseReleaseEvent(QMouseEvent* evt) {
#if(QT_VERSION_MAJOR > 5)
const int x = evt->position().x();
const int y = evt->position().y();
#else
const int x = evt->x(); const int x = evt->x();
const int y = evt->y(); const int y = evt->y();
#endif
if (removeArea.contains(x, y)) { if (removeArea.contains(x, y)) {
emit removePressed(); emit removePressed();
} }

View File

@ -439,7 +439,7 @@ QSqlQuery DatabaseConnection::executeQuery(const QSqlDatabase& db, const QString
if (!result.success) { if (!result.success) {
throw result.err; throw result.err;
} }
return result.query; return std::move(result.query);
} }
QueryResult DatabaseConnection::executeQueryNoThrow(const QSqlDatabase& db, const QString &stmt, QueryResult DatabaseConnection::executeQueryNoThrow(const QSqlDatabase& db, const QString &stmt,
@ -448,14 +448,14 @@ QueryResult DatabaseConnection::executeQueryNoThrow(const QSqlDatabase& db, cons
bool prepared = query.prepare(stmt); bool prepared = query.prepare(stmt);
if (!prepared) { if (!prepared) {
return QueryResult(query); return QueryResult(std::move(query));
} }
for (const auto &arg : args) { for (const auto &arg : args) {
query.addBindValue(arg); query.addBindValue(arg);
} }
query.exec(); query.exec();
return QueryResult(query); return QueryResult(std::move(query));
} }
// doInsert is a version of executeQuery that returns the last inserted id, rather than the // doInsert is a version of executeQuery that returns the last inserted id, rather than the

View File

@ -15,8 +15,8 @@ class QueryResult {
public: public:
QueryResult(){} QueryResult(){}
QueryResult(QSqlQuery query) { QueryResult(QSqlQuery query) {
this->query = query;
this->err = query.lastError(); this->err = query.lastError();
this->query = std::move(query);
this->success = err.type() == QSqlError::NoError; this->success = err.type() == QSqlError::NoError;
} }

View File

@ -172,7 +172,7 @@ void PortingDialog::onSubmitPressed() {
connect(executedManifest, &porting::SystemManifest::onStatusUpdate, portStatusLabel, &QLabel::setText); connect(executedManifest, &porting::SystemManifest::onStatusUpdate, portStatusLabel, &QLabel::setText);
connect(this, &PortingDialog::onWorkComplete, this, &PortingDialog::onPortComplete); connect(this, &PortingDialog::onWorkComplete, this, &PortingDialog::onPortComplete);
QtConcurrent::run(portAction); std::ignore = QtConcurrent::run(portAction);
} }
void PortingDialog::onPortComplete(bool success) { void PortingDialog::onPortComplete(bool success) {

View File

@ -26,7 +26,9 @@ int main(int argc, char* argv[]) {
Q_INIT_RESOURCE(res_icons); Q_INIT_RESOURCE(res_icons);
Q_INIT_RESOURCE(res_migrations); Q_INIT_RESOURCE(res_migrations);
#if (QT_VERSION_MAJOR < 6)
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif
QCoreApplication::setApplicationName("ashirt"); QCoreApplication::setApplicationName("ashirt");
#ifdef Q_OS_WIN #ifdef Q_OS_WIN