From 5e8c230cfb5e55f3e2be26ab558f4b843b8ac1b2 Mon Sep 17 00:00:00 2001 From: Martchus Date: Fri, 4 Sep 2020 00:54:34 +0200 Subject: [PATCH] Support Qt 6 (commit 174154b) --- gui/mainwindow.cpp | 20 +++++++++++++------- gui/mainwindow.h | 4 +++- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 9a7733a..3b2565a 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -294,10 +294,10 @@ void MainWindow::closeEvent(QCloseEvent *event) // save settings m_settings.beginGroup(QStringLiteral("mainwindow")); - m_settings.setValue(QStringLiteral("geometry"), saveGeometry()); - m_settings.setValue(QStringLiteral("state"), saveState()); - m_settings.setValue(QStringLiteral("recententries"), m_recentMgr->save()); - m_settings.setValue(QStringLiteral("accountfilter"), m_ui->accountFilterLineEdit->text()); + m_settings.setValue(QStringLiteral("geometry"), QVariant(saveGeometry())); + m_settings.setValue(QStringLiteral("state"), QVariant(saveState())); + m_settings.setValue(QStringLiteral("recententries"), QVariant(m_recentMgr->save())); + m_settings.setValue(QStringLiteral("accountfilter"), QVariant(m_ui->accountFilterLineEdit->text())); m_settings.setValue(QStringLiteral("alwayscreatebackup"), m_ui->actionAlwaysCreateBackup->isChecked()); QString pwVisibility; if (m_ui->actionShowAlways->isChecked()) { @@ -307,7 +307,7 @@ void MainWindow::closeEvent(QCloseEvent *event) } else { pwVisibility = QStringLiteral("editing"); } - m_settings.setValue(QStringLiteral("pwvisibility"), pwVisibility); + m_settings.setValue(QStringLiteral("pwvisibility"), QVariant(pwVisibility)); m_settings.endGroup(); if (m_qtSettings) { m_qtSettings->save(m_settings); @@ -972,7 +972,7 @@ void MainWindow::addEntry(EntryType type) QMessageBox::warning(this, QApplication::applicationName(), tr("Unable to create new entry.")); return; } - m_entryModel->setData(m_entryModel->index(row, 0, selected), text, Qt::DisplayRole); + m_entryModel->setData(m_entryModel->index(row, 0, selected), QVariant(text), Qt::DisplayRole); setSomethingChanged(true); } @@ -1001,7 +1001,13 @@ void MainWindow::removeEntry() */ void MainWindow::applyFilter(const QString &filterText) { - m_entryFilterModel->setFilterRegExp(filterText); + m_entryFilterModel-> +#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)) + setFilterRegularExpression +#else + setFilterRegExp +#endif + (filterText); if (filterText.isEmpty()) { applyDefaultExpanding(QModelIndex()); } else { diff --git a/gui/mainwindow.h b/gui/mainwindow.h index d587f80..1f62bfd 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -53,7 +53,6 @@ public: public Q_SLOTS: // file management bool openFile(const QString &path); - bool openFile(const QString &path, Io::PasswordFileOpenFlags openFlags); void createFile(const QString &path, const QString &password); void createFile(const QString &path); bool createFile(); @@ -69,6 +68,9 @@ public Q_SLOTS: void showPassowrdGeneratorDialog(); void showUndoView(); +public: + bool openFile(const QString &path, Io::PasswordFileOpenFlags openFlags); // can not be a slot in Qt 6 without further effort, see QTBUG-86424 + protected: bool eventFilter(QObject *obj, QEvent *event) override; void closeEvent(QCloseEvent *event) override;