diff --git a/src/autotype/AutoType.cpp b/src/autotype/AutoType.cpp index 44a0c6f10..c39a13201 100644 --- a/src/autotype/AutoType.cpp +++ b/src/autotype/AutoType.cpp @@ -225,7 +225,7 @@ void AutoType::createTestInstance() QStringList AutoType::windowTitles() { if (!m_plugin) { - return QStringList(); + return {}; } return m_plugin->windowTitles(); diff --git a/src/autotype/AutoTypeAction.h b/src/autotype/AutoTypeAction.h index 082d0aea7..f68917f8f 100644 --- a/src/autotype/AutoTypeAction.h +++ b/src/autotype/AutoTypeAction.h @@ -38,17 +38,17 @@ public: static Result Ok() { - return Result(true, false, QString()); + return {true, false, QString()}; } static Result Retry(const QString& error) { - return Result(false, true, error); + return {false, true, error}; } static Result Failed(const QString& error) { - return Result(false, false, error); + return {false, false, error}; } bool isOk() const diff --git a/src/autotype/test/AutoTypeTest.cpp b/src/autotype/test/AutoTypeTest.cpp index 69c71a53c..641b9502a 100644 --- a/src/autotype/test/AutoTypeTest.cpp +++ b/src/autotype/test/AutoTypeTest.cpp @@ -29,7 +29,7 @@ QString AutoTypePlatformTest::keyToString(Qt::Key key) QStringList AutoTypePlatformTest::windowTitles() { - return QStringList(); + return {}; } WId AutoTypePlatformTest::activeWindow() diff --git a/src/autotype/xcb/AutoTypeXCB.cpp b/src/autotype/xcb/AutoTypeXCB.cpp index f2b967656..047ef3a95 100644 --- a/src/autotype/xcb/AutoTypeXCB.cpp +++ b/src/autotype/xcb/AutoTypeXCB.cpp @@ -184,17 +184,17 @@ QString AutoTypePlatformX11::windowTitle(Window window, bool useBlacklist) if (useBlacklist && !title.isEmpty()) { if (window == m_rootWindow) { - return QString(); + return {}; } QString className = windowClassName(window); if (m_classBlacklist.contains(className)) { - return QString(); + return {}; } QList keepassxWindows = widgetsToX11Windows(QApplication::topLevelWidgets()); if (keepassxWindows.contains(window)) { - return QString(); + return {}; } } diff --git a/src/cli/Generate.cpp b/src/cli/Generate.cpp index 980e9fa14..1f6ceff5d 100644 --- a/src/cli/Generate.cpp +++ b/src/cli/Generate.cpp @@ -93,7 +93,7 @@ QSharedPointer Generate::createGenerator(QSharedPointersetLength(PasswordGenerator::DefaultLength); } else if (passwordLength.toInt() <= 0) { err << QObject::tr("Invalid password length %1").arg(passwordLength) << endl; - return QSharedPointer(nullptr); + return {}; } else { passwordGenerator->setLength(passwordLength.toInt()); } @@ -139,7 +139,7 @@ QSharedPointer Generate::createGenerator(QSharedPointerisValid()) { err << QObject::tr("Invalid password generator after applying all options") << endl; - return QSharedPointer(nullptr); + return {}; } return passwordGenerator; diff --git a/src/cli/Utils.cpp b/src/cli/Utils.cpp index 2393ba6e6..bca837db8 100644 --- a/src/cli/Utils.cpp +++ b/src/cli/Utils.cpp @@ -384,7 +384,7 @@ namespace Utils if (fieldName == TagsFieldName) { return entry->tags(); } - return QString(""); + return ""; } QStringList findAttributes(const EntryAttributes& attributes, const QString& name) diff --git a/src/core/Base32.cpp b/src/core/Base32.cpp index 05841121a..d0a148eec 100644 --- a/src/core/Base32.cpp +++ b/src/core/Base32.cpp @@ -50,7 +50,7 @@ QVariant Base32::decode(const QByteArray& encodedData) } if (encodedData.size() % 8 != 0) { - return QVariant(); + return {}; } int nPads = 0; @@ -119,7 +119,7 @@ QVariant Base32::decode(const QByteArray& encodedData) continue; } else { // illegal character - return QVariant(); + return {}; } } } @@ -145,7 +145,7 @@ QVariant Base32::decode(const QByteArray& encodedData) QByteArray Base32::encode(const QByteArray& data) { if (data.size() < 1) { - return QByteArray(); + return {}; } const int nBits = data.size() * 8; diff --git a/src/core/Clock.cpp b/src/core/Clock.cpp index 5704d4bff..c0cea7952 100644 --- a/src/core/Clock.cpp +++ b/src/core/Clock.cpp @@ -50,12 +50,12 @@ QDateTime Clock::serialized(const QDateTime& dateTime) QDateTime Clock::datetimeUtc(int year, int month, int day, int hour, int min, int second) { - return QDateTime(QDate(year, month, day), QTime(hour, min, second), Qt::UTC); + return {QDate(year, month, day), QTime(hour, min, second), Qt::UTC}; } QDateTime Clock::datetime(int year, int month, int day, int hour, int min, int second) { - return QDateTime(QDate(year, month, day), QTime(hour, min, second), Qt::LocalTime); + return {QDate(year, month, day), QTime(hour, min, second), Qt::LocalTime}; } QDateTime Clock::datetimeUtc(qint64 msecSinceEpoch) diff --git a/src/core/Entry.cpp b/src/core/Entry.cpp index ad7ecce2b..e8c2ec8fe 100644 --- a/src/core/Entry.cpp +++ b/src/core/Entry.cpp @@ -1212,7 +1212,7 @@ QString Entry::referenceFieldValue(EntryReferenceType referenceType) const default: break; } - return QString(); + return {}; } void Entry::moveUp() @@ -1329,7 +1329,7 @@ QString Entry::resolvePlaceholder(const QString& placeholder) const QString Entry::resolveUrlPlaceholder(const QString& str, Entry::PlaceholderType placeholderType) const { if (str.isEmpty()) { - return QString(); + return {}; } const QUrl qurl(str); @@ -1360,7 +1360,7 @@ QString Entry::resolveUrlPlaceholder(const QString& str, Entry::PlaceholderType } } - return QString(); + return {}; } Entry::PlaceholderType Entry::placeholderType(const QString& placeholder) const @@ -1432,7 +1432,7 @@ QString Entry::resolveUrl(const QString& url) const } // No URL in this command - return QString(""); + return {}; } if (!newUrl.isEmpty() && !newUrl.contains("://")) { diff --git a/src/core/Group.cpp b/src/core/Group.cpp index 273ada2cb..f9aa9d142 100644 --- a/src/core/Group.cpp +++ b/src/core/Group.cpp @@ -166,7 +166,7 @@ QString Group::effectiveAutoTypeSequence() const const Group* group = this; do { if (group->autoTypeEnabled() == Group::Disable) { - return QString(); + return {}; } sequence = group->defaultAutoTypeSequence(); diff --git a/src/core/PassphraseGenerator.cpp b/src/core/PassphraseGenerator.cpp index ef1d867e2..79227817e 100644 --- a/src/core/PassphraseGenerator.cpp +++ b/src/core/PassphraseGenerator.cpp @@ -116,7 +116,7 @@ QString PassphraseGenerator::generatePassphrase() const // In case there was an error loading the wordlist if (m_wordlist.length() == 0) { - return QString(); + return {}; } QStringList words; diff --git a/src/core/TimeDelta.cpp b/src/core/TimeDelta.cpp index 0037396f6..94cea03c8 100644 --- a/src/core/TimeDelta.cpp +++ b/src/core/TimeDelta.cpp @@ -29,22 +29,22 @@ QDateTime operator+(const QDateTime& dateTime, const TimeDelta& delta) TimeDelta TimeDelta::fromHours(int hours) { - return TimeDelta(hours, 0, 0, 0); + return {hours, 0, 0, 0}; } TimeDelta TimeDelta::fromDays(int days) { - return TimeDelta(0, days, 0, 0); + return {0, days, 0, 0}; } TimeDelta TimeDelta::fromMonths(int months) { - return TimeDelta(0, 0, months, 0); + return {0, 0, months, 0}; } TimeDelta TimeDelta::fromYears(int years) { - return TimeDelta(0, 0, 0, years); + return {0, 0, 0, years}; } TimeDelta::TimeDelta() diff --git a/src/crypto/CryptoHash.cpp b/src/crypto/CryptoHash.cpp index 5177bb86f..a1dc6595e 100644 --- a/src/crypto/CryptoHash.cpp +++ b/src/crypto/CryptoHash.cpp @@ -106,7 +106,7 @@ QByteArray CryptoHash::result() const } else if (d->hashFunction) { result = d->hashFunction->final(); } - return QByteArray(reinterpret_cast(result.data()), result.size()); + return {reinterpret_cast(result.data()), int(result.size())}; } QByteArray CryptoHash::hash(const QByteArray& data, Algorithm algo) diff --git a/src/format/KdbxXmlReader.cpp b/src/format/KdbxXmlReader.cpp index e66e12174..eb7fa4158 100644 --- a/src/format/KdbxXmlReader.cpp +++ b/src/format/KdbxXmlReader.cpp @@ -183,7 +183,7 @@ QString KdbxXmlReader::errorString() const .arg(m_xml.lineNumber()) .arg(m_xml.columnNumber()); } - return QString(); + return {}; } bool KdbxXmlReader::isTrueValue(const QStringRef& value) @@ -1117,13 +1117,13 @@ QUuid KdbxXmlReader::readUuid() { QByteArray uuidBin = readBinary(); if (uuidBin.isEmpty()) { - return QUuid(); + return {}; } if (uuidBin.length() != UUID_LENGTH) { if (m_strictMode) { raiseError(tr("Invalid uuid value")); } - return QUuid(); + return {}; } return QUuid::fromRfc4122(uuidBin); } diff --git a/src/format/KeePass1Reader.cpp b/src/format/KeePass1Reader.cpp index 993939a44..144e1b473 100644 --- a/src/format/KeePass1Reader.cpp +++ b/src/format/KeePass1Reader.cpp @@ -391,7 +391,7 @@ QByteArray KeePass1Reader::key(const QByteArray& password, const QByteArray& key if (!result) { raiseError(tr("Key transformation failed")); - return QByteArray(); + return {}; } CryptoHash hash(CryptoHash::Sha256); @@ -927,7 +927,7 @@ QDateTime KeePass1Reader::dateFromPackedStruct(const QByteArray& data) // check for the special "never" datetime if (dateTime == QDateTime(QDate(2999, 12, 28), QTime(23, 59, 59), Qt::UTC)) { - return QDateTime(); + return {}; } else { return dateTime; } @@ -943,13 +943,13 @@ bool KeePass1Reader::isMetaStream(const Entry* entry) QByteArray KeePass1Reader::readKeyfile(QIODevice* device) { if (device->size() == 0) { - return QByteArray(); + return {}; } if (device->size() == 32) { QByteArray data = device->read(32); if (data.size() != 32) { - return QByteArray(); + return {}; } return data; @@ -959,7 +959,7 @@ QByteArray KeePass1Reader::readKeyfile(QIODevice* device) QByteArray data = device->read(64); if (data.size() != 64) { - return QByteArray(); + return {}; } if (Tools::isHex(data)) { @@ -974,7 +974,7 @@ QByteArray KeePass1Reader::readKeyfile(QIODevice* device) do { if (!Tools::readFromDevice(device, buffer)) { - return QByteArray(); + return {}; } cryptoHash.addData(buffer); } while (!buffer.isEmpty()); diff --git a/src/format/KeePass2RandomStream.cpp b/src/format/KeePass2RandomStream.cpp index 509e32513..da6df20ad 100644 --- a/src/format/KeePass2RandomStream.cpp +++ b/src/format/KeePass2RandomStream.cpp @@ -50,7 +50,7 @@ QByteArray KeePass2RandomStream::randomBytes(int size, bool* ok) if (m_buffer.size() == m_offset) { if (!loadBlock()) { *ok = false; - return QByteArray(); + return {}; } } @@ -71,7 +71,7 @@ QByteArray KeePass2RandomStream::process(const QByteArray& data, bool* ok) QByteArray randomData = randomBytes(data.size(), &randomBytesOk); if (!randomBytesOk) { *ok = false; - return QByteArray(); + return {}; } QByteArray result; diff --git a/src/format/KeePass2Writer.cpp b/src/format/KeePass2Writer.cpp index 4cf0d4ad6..76e8cacc3 100644 --- a/src/format/KeePass2Writer.cpp +++ b/src/format/KeePass2Writer.cpp @@ -184,7 +184,7 @@ void KeePass2Writer::raiseError(const QString& errorMessage) */ QSharedPointer KeePass2Writer::writer() const { - return QSharedPointer(); + return {}; } /** diff --git a/src/format/OpVaultReader.cpp b/src/format/OpVaultReader.cpp index 201354bce..bf9c93894 100644 --- a/src/format/OpVaultReader.cpp +++ b/src/format/OpVaultReader.cpp @@ -301,11 +301,11 @@ QJsonObject OpVaultReader::readAndAssertJsonFile(QFile& file, const QString& str auto absFilePath = fileInfo.absoluteFilePath(); if (!fileInfo.exists()) { qCritical() << QString("File \"%1\" must exist").arg(absFilePath); - return QJsonObject(); + return {}; } if (!fileInfo.isReadable()) { qCritical() << QString("File \"%1\" must be readable").arg(absFilePath); - return QJsonObject(); + return {}; } if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { @@ -331,7 +331,7 @@ QJsonObject OpVaultReader::readAndAssertJsonFile(QFile& file, const QString& str QJsonDocument jDoc = QJsonDocument::fromJson(filePayload, error); if (!jDoc.isObject()) { qCritical() << "Expected " << filePayload << "to be a JSON Object"; - return QJsonObject(); + return {}; } return jDoc.object(); } diff --git a/src/gui/CategoryListWidget.cpp b/src/gui/CategoryListWidget.cpp index 8da7431b5..7322c03cd 100644 --- a/src/gui/CategoryListWidget.cpp +++ b/src/gui/CategoryListWidget.cpp @@ -64,8 +64,8 @@ QSize CategoryListWidget::sizeHint() const QSize CategoryListWidget::minimumSizeHint() const { - return QSize(m_itemDelegate->minWidth() + m_ui->categoryList->frameWidth() * 2, - m_ui->categoryList->sizeHintForRow(0) * 2); + return {m_itemDelegate->minWidth() + m_ui->categoryList->frameWidth() * 2, + m_ui->categoryList->sizeHintForRow(0) * 2}; } int CategoryListWidget::addCategory(const QString& labelText, const QIcon& icon) diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp index 76191fd2b..882a87f49 100644 --- a/src/gui/DatabaseWidget.cpp +++ b/src/gui/DatabaseWidget.cpp @@ -1837,7 +1837,7 @@ QStringList DatabaseWidget::customEntryAttributes() const { Entry* entry = m_entryView->currentEntry(); if (!entry) { - return QStringList(); + return {}; } return entry->attributes()->customKeys(); diff --git a/src/gui/IconModels.cpp b/src/gui/IconModels.cpp index ab435aedc..1d1eefb42 100644 --- a/src/gui/IconModels.cpp +++ b/src/gui/IconModels.cpp @@ -38,7 +38,7 @@ int DefaultIconModel::rowCount(const QModelIndex& parent) const QVariant DefaultIconModel::data(const QModelIndex& index, int role) const { if (!index.isValid()) { - return QVariant(); + return {}; } Q_ASSERT(index.row() < databaseIcons()->count()); @@ -47,7 +47,7 @@ QVariant DefaultIconModel::data(const QModelIndex& index, int role) const return databaseIcons()->icon(index.row(), IconSize::Medium); } - return QVariant(); + return {}; } CustomIconModel::CustomIconModel(QObject* parent) @@ -78,7 +78,7 @@ int CustomIconModel::rowCount(const QModelIndex& parent) const QVariant CustomIconModel::data(const QModelIndex& index, int role) const { if (!index.isValid()) { - return QVariant(); + return {}; } if (role == Qt::DecorationRole) { @@ -86,7 +86,7 @@ QVariant CustomIconModel::data(const QModelIndex& index, int role) const return m_icons.value(uuid); } - return QVariant(); + return {}; } QUuid CustomIconModel::uuidFromIndex(const QModelIndex& index) const diff --git a/src/gui/Icons.cpp b/src/gui/Icons.cpp index b16c40f80..791c09bb5 100644 --- a/src/gui/Icons.cpp +++ b/src/gui/Icons.cpp @@ -55,9 +55,9 @@ Icons::Icons() QString Icons::applicationIconName() { #ifdef KEEPASSXC_DIST_FLATPAK - return QString("org.keepassxc.KeePassXC"); + return "org.keepassxc.KeePassXC"; #else - return QString("keepassxc"); + return "keepassxc"; #endif } diff --git a/src/gui/csvImport/CsvParserModel.cpp b/src/gui/csvImport/CsvParserModel.cpp index 77abb5931..f13363c3e 100644 --- a/src/gui/csvImport/CsvParserModel.cpp +++ b/src/gui/csvImport/CsvParserModel.cpp @@ -119,12 +119,12 @@ int CsvParserModel::columnCount(const QModelIndex& parent) const QVariant CsvParserModel::data(const QModelIndex& index, int role) const { if ((index.column() >= m_columnHeader.size()) || (index.row() + m_skipped >= rowCount()) || !index.isValid()) { - return QVariant(); + return {}; } if (role == Qt::DisplayRole) { return m_table.at(index.row() + m_skipped).at(m_columnMap[index.column()]); } - return QVariant(); + return {}; } QVariant CsvParserModel::headerData(int section, Qt::Orientation orientation, int role) const @@ -132,15 +132,15 @@ QVariant CsvParserModel::headerData(int section, Qt::Orientation orientation, in if (role == Qt::DisplayRole) { if (orientation == Qt::Horizontal) { if ((section < 0) || (section >= m_columnHeader.size())) { - return QVariant(); + return {}; } return m_columnHeader.at(section); } else if (orientation == Qt::Vertical) { if (section + m_skipped >= rowCount()) { - return QVariant(); + return {}; } return QString::number(section + 1); } } - return QVariant(); + return {}; } diff --git a/src/gui/entry/AutoTypeAssociationsModel.cpp b/src/gui/entry/AutoTypeAssociationsModel.cpp index 6e7b08bc0..03eedae25 100644 --- a/src/gui/entry/AutoTypeAssociationsModel.cpp +++ b/src/gui/entry/AutoTypeAssociationsModel.cpp @@ -79,14 +79,14 @@ QVariant AutoTypeAssociationsModel::headerData(int section, Qt::Orientation orie return tr("Sequence"); } } else { - return QVariant(); + return {}; } } QVariant AutoTypeAssociationsModel::data(const QModelIndex& index, int role) const { if (!index.isValid()) { - return QVariant(); + return {}; } if (role == Qt::DisplayRole) { @@ -108,7 +108,7 @@ QVariant AutoTypeAssociationsModel::data(const QModelIndex& index, int role) con return sequence; } } else { - return QVariant(); + return {}; } } diff --git a/src/gui/entry/EntryAttachmentsModel.cpp b/src/gui/entry/EntryAttachmentsModel.cpp index c5d0ff073..d66e912ab 100644 --- a/src/gui/entry/EntryAttachmentsModel.cpp +++ b/src/gui/entry/EntryAttachmentsModel.cpp @@ -79,7 +79,7 @@ QVariant EntryAttachmentsModel::headerData(int section, Qt::Orientation orientat QVariant EntryAttachmentsModel::data(const QModelIndex& index, int role) const { if (!index.isValid()) { - return QVariant(); + return {}; } if (role == Qt::DisplayRole || role == Qt::EditRole) { @@ -96,7 +96,7 @@ QVariant EntryAttachmentsModel::data(const QModelIndex& index, int role) const } } - return QVariant(); + return {}; } bool EntryAttachmentsModel::setData(const QModelIndex& index, const QVariant& value, int role) @@ -124,7 +124,7 @@ Qt::ItemFlags EntryAttachmentsModel::flags(const QModelIndex& index) const QString EntryAttachmentsModel::keyByIndex(const QModelIndex& index) const { if (!index.isValid()) { - return QString(); + return {}; } return m_entryAttachments->keys().at(index.row()); diff --git a/src/gui/entry/EntryAttributesModel.cpp b/src/gui/entry/EntryAttributesModel.cpp index 90ef21bb3..9ce9ed251 100644 --- a/src/gui/entry/EntryAttributesModel.cpp +++ b/src/gui/entry/EntryAttributesModel.cpp @@ -80,14 +80,14 @@ QVariant EntryAttributesModel::headerData(int section, Qt::Orientation orientati if ((orientation == Qt::Horizontal) && (role == Qt::DisplayRole) && (section == 0)) { return tr("Name"); } else { - return QVariant(); + return {}; } } QVariant EntryAttributesModel::data(const QModelIndex& index, int role) const { if (!index.isValid() || (role != Qt::DisplayRole && role != Qt::EditRole)) { - return QVariant(); + return {}; } return m_attributes.at(index.row()); @@ -124,7 +124,7 @@ QModelIndex EntryAttributesModel::indexByKey(const QString& key) const int row = m_attributes.indexOf(key); if (row == -1) { - return QModelIndex(); + return {}; } else { return index(row, 0); } @@ -133,7 +133,7 @@ QModelIndex EntryAttributesModel::indexByKey(const QString& key) const QString EntryAttributesModel::keyByIndex(const QModelIndex& index) const { if (!index.isValid()) { - return QString(); + return {}; } else { return m_attributes.at(index.row()); } diff --git a/src/gui/entry/EntryModel.cpp b/src/gui/entry/EntryModel.cpp index 97d671e58..b25b002ef 100644 --- a/src/gui/entry/EntryModel.cpp +++ b/src/gui/entry/EntryModel.cpp @@ -120,7 +120,7 @@ int EntryModel::columnCount(const QModelIndex& parent) const QVariant EntryModel::data(const QModelIndex& index, int role) const { if (!index.isValid()) { - return QVariant(); + return {}; } Entry* entry = entryFromIndex(index); @@ -336,7 +336,7 @@ QVariant EntryModel::data(const QModelIndex& index, int role) const } } - return QVariant(); + return {}; } QVariant EntryModel::headerData(int section, Qt::Orientation orientation, int role) const diff --git a/src/gui/group/GroupModel.cpp b/src/gui/group/GroupModel.cpp index 3b5fbe60b..18b926dc2 100644 --- a/src/gui/group/GroupModel.cpp +++ b/src/gui/group/GroupModel.cpp @@ -74,7 +74,7 @@ int GroupModel::columnCount(const QModelIndex& parent) const QModelIndex GroupModel::index(int row, int column, const QModelIndex& parent) const { if (!hasIndex(row, column, parent)) { - return QModelIndex(); + return {}; } Group* group; @@ -91,7 +91,7 @@ QModelIndex GroupModel::index(int row, int column, const QModelIndex& parent) co QModelIndex GroupModel::parent(const QModelIndex& index) const { if (!index.isValid()) { - return QModelIndex(); + return {}; } return parent(groupFromIndex(index)); @@ -103,7 +103,7 @@ QModelIndex GroupModel::parent(Group* group) const if (!parentGroup) { // index is already the root group - return QModelIndex(); + return {}; } else { const Group* grandParentGroup = parentGroup->parentGroup(); if (!grandParentGroup) { @@ -118,7 +118,7 @@ QModelIndex GroupModel::parent(Group* group) const QVariant GroupModel::data(const QModelIndex& index, int role) const { if (!index.isValid()) { - return QVariant(); + return {}; } Group* group = groupFromIndex(index); @@ -145,7 +145,7 @@ QVariant GroupModel::data(const QModelIndex& index, int role) const } return tooltip; } else { - return QVariant(); + return {}; } } @@ -155,7 +155,7 @@ QVariant GroupModel::headerData(int section, Qt::Orientation orientation, int ro Q_UNUSED(orientation); Q_UNUSED(role); - return QVariant(); + return {}; } QModelIndex GroupModel::index(Group* group) const diff --git a/src/gui/styles/base/BaseStyle.cpp b/src/gui/styles/base/BaseStyle.cpp index 4c9aabb77..39663dc07 100644 --- a/src/gui/styles/base/BaseStyle.cpp +++ b/src/gui/styles/base/BaseStyle.cpp @@ -3979,14 +3979,14 @@ QSize BaseStyle::sizeFromContents(ContentsType type, if (!btn->icon.isNull() || !btn->text.isEmpty()) margins = proxy()->pixelMetric(isRadio ? PM_RadioButtonLabelSpacing : PM_CheckBoxLabelSpacing, option, widget); - return QSize(size.width() + w + margins, qMax(size.height(), h)); + return {size.width() + w + margins, qMax(size.height(), h)}; } case CT_MenuBarItem: { int fontHeight = option ? option->fontMetrics.height() : size.height(); auto w = static_cast(fontHeight * Ph::MenuBar_HorizontalPaddingFontRatio); auto h = static_cast(fontHeight * Ph::MenuBar_VerticalPaddingFontRatio); int line = Ph::dpiScaled(1); - return QSize(size.width() + w * 2, size.height() + h * 2 + line); + return {size.width() + w * 2, size.height() + h * 2 + line}; } case CT_MenuItem: { auto menuItem = qstyleoption_cast(option); @@ -4113,7 +4113,7 @@ QSize BaseStyle::sizeFromContents(ContentsType type, xadd += 2; yadd += 2; } - return QSize(size.width() + xadd, size.height() + yadd); + return {size.width() + xadd, size.height() + yadd}; } case CT_ItemViewItem: { auto vopt = qstyleoption_cast(option); @@ -4335,7 +4335,7 @@ QRect BaseStyle::subControlRect(ComplexControl control, break; case SC_SpinBoxDown: if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) - return QRect(); + return {}; rect = QRect(x, center, buttonWidth, spinbox->rect.bottom() - center - fw + 1); break; @@ -4429,13 +4429,13 @@ QRect BaseStyle::subControlRect(ComplexControl control, case CC_ComboBox: { auto cb = qstyleoption_cast(option); if (!cb) - return QRect(); + return {}; int frame = cb->frame ? proxy()->pixelMetric(PM_ComboBoxFrameWidth, cb, widget) : 0; QRect r = option->rect; r.adjust(frame, frame, -frame, -frame); int dim = qMin(r.width(), r.height()); if (dim < 1) - return QRect(); + return {}; switch (subControl) { case SC_ComboBoxFrame: return cb->rect; diff --git a/src/keys/ChallengeResponseKey.cpp b/src/keys/ChallengeResponseKey.cpp index 6502e3714..eb52b7d09 100644 --- a/src/keys/ChallengeResponseKey.cpp +++ b/src/keys/ChallengeResponseKey.cpp @@ -30,7 +30,7 @@ ChallengeResponseKey::ChallengeResponseKey(YubiKeySlot keySlot) QByteArray ChallengeResponseKey::rawKey() const { - return QByteArray(m_key.data(), m_key.size()); + return {m_key.data(), static_cast(m_key.size())}; } void ChallengeResponseKey::setRawKey(const QByteArray&) diff --git a/src/keys/FileKey.cpp b/src/keys/FileKey.cpp index b50ffb30a..167b0462d 100644 --- a/src/keys/FileKey.cpp +++ b/src/keys/FileKey.cpp @@ -161,7 +161,7 @@ bool FileKey::load(const QString& fileName, QString* errorMsg) */ QByteArray FileKey::rawKey() const { - return QByteArray(m_key.data(), m_key.size()); + return {m_key.data(), int(m_key.size())}; } void FileKey::setRawKey(const QByteArray& data) diff --git a/src/keys/PasswordKey.cpp b/src/keys/PasswordKey.cpp index 60006dc30..7e0670647 100644 --- a/src/keys/PasswordKey.cpp +++ b/src/keys/PasswordKey.cpp @@ -44,7 +44,7 @@ QByteArray PasswordKey::rawKey() const if (!m_isInitialized) { return {}; } - return QByteArray(m_key.data(), m_key.size()); + return {m_key.data(), int(m_key.size())}; } void PasswordKey::setRawKey(const QByteArray& data) diff --git a/src/totp/totp.cpp b/src/totp/totp.cpp index 82d9bb832..85919c55d 100644 --- a/src/totp/totp.cpp +++ b/src/totp/totp.cpp @@ -49,11 +49,11 @@ static QString getNameForHashType(const Totp::Algorithm hashType) { switch (hashType) { case Totp::Algorithm::Sha512: - return QString("SHA512"); + return "SHA512"; case Totp::Algorithm::Sha256: - return QString("SHA256"); + return "SHA256"; default: - return QString("SHA1"); + return "SHA1"; } } diff --git a/tests/TestKeePass1Reader.cpp b/tests/TestKeePass1Reader.cpp index 08ff8b986..18b35b5c7 100644 --- a/tests/TestKeePass1Reader.cpp +++ b/tests/TestKeePass1Reader.cpp @@ -244,7 +244,7 @@ QDateTime TestKeePass1Reader::genDT(int year, int month, int day, int hour, int { QDate date(year, month, day); QTime time(hour, min, 0); - return QDateTime(date, time, Qt::UTC); + return {date, time, Qt::UTC}; } void TestKeePass1Reader::reopenDatabase(QSharedPointer db,