Skip to content

Commit

Permalink
refactor: replace deprecated qAsConst with std::as_const() (#1565)
Browse files Browse the repository at this point in the history
  • Loading branch information
NickCao authored Oct 29, 2023
1 parent 2cefcd4 commit 9630cc9
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/libs/registry/docset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ void Docset::loadSymbols(const QString &symbolType) const
// with it.first and it.second respectively pointing to the start and the end
// of the range of nodes having symbolType as key. It effectively represents a
// contiguous view over the nodes with a specified key.
for (auto it = qAsConst(m_symbolStrings).equal_range(symbolType); it.first != it.second; ++it.first) {
for (auto it = std::as_const(m_symbolStrings).equal_range(symbolType); it.first != it.second; ++it.first) {
loadSymbols(symbolType, it.first.value());
}
}
Expand Down Expand Up @@ -519,7 +519,7 @@ void Docset::createIndex()
}

// Drop old indexes
for (const QString &oldIndexName : qAsConst(oldIndexes)) {
for (const QString &oldIndexName : std::as_const(oldIndexes)) {
m_db->execute(indexDropQuery.arg(oldIndexName));
}

Expand Down
2 changes: 1 addition & 1 deletion src/libs/registry/docsetmetadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void DocsetMetadata::save(const QString &path, const QString &version)

if (!m_urls.isEmpty()) {
QJsonArray urls;
for (const QUrl &url : qAsConst(m_urls)) {
for (const QUrl &url : std::as_const(m_urls)) {
urls.append(url.toString());
}

Expand Down
6 changes: 3 additions & 3 deletions src/libs/registry/docsetregistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void DocsetRegistry::setFuzzySearchEnabled(bool enabled)

m_isFuzzySearchEnabled = enabled;

for (Docset *docset : qAsConst(m_docsets)) {
for (Docset *docset : std::as_const(m_docsets)) {
docset->setFuzzySearchEnabled(enabled);
}
}
Expand Down Expand Up @@ -193,7 +193,7 @@ Docset *DocsetRegistry::docset(int index) const

Docset *DocsetRegistry::docsetForUrl(const QUrl &url)
{
for (Docset *docset : qAsConst(m_docsets)) {
for (Docset *docset : std::as_const(m_docsets)) {
if (docset->baseUrl().isParentOf(url))
return docset;
}
Expand Down Expand Up @@ -226,7 +226,7 @@ void DocsetRegistry::_runQuery(const QString &query)

const SearchQuery searchQuery = SearchQuery::fromString(query);
if (searchQuery.hasKeywords()) {
for (Docset *docset : qAsConst(m_docsets)) {
for (Docset *docset : std::as_const(m_docsets)) {
if (searchQuery.hasKeywords(docset->keywords()))
enabledDocsets << docset;
}
Expand Down
2 changes: 1 addition & 1 deletion src/libs/ui/docsetsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ QNetworkReply *DocsetsDialog::download(const QUrl &url)

void DocsetsDialog::cancelDownloads()
{
for (QNetworkReply *reply : qAsConst(m_replies)) {
for (QNetworkReply *reply : std::as_const(m_replies)) {
// Hide progress bar
QListWidgetItem *listItem
= ui->availableDocsetList->item(reply->property(ListItemIndexProperty).toInt());
Expand Down
2 changes: 1 addition & 1 deletion src/libs/ui/qxtglobalshortcut/qxtglobalshortcut_x11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ bool QxtGlobalShortcutPrivate::registerShortcut(quint32 nativeKey, quint32 nativ
}

bool failed = false;
for (xcb_void_cookie_t cookie : qAsConst(xcbCookies)) {
for (xcb_void_cookie_t cookie : std::as_const(xcbCookies)) {
QScopedPointer<xcb_generic_error_t, QScopedPointerPodDeleter> error(xcb_request_check(xcbConnection, cookie));
failed = !error.isNull();
}
Expand Down

0 comments on commit 9630cc9

Please sign in to comment.