forked from qt-creator/qt-creator
Port from qAsConst() to std::as_const()
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace. Task-number: QTBUG-99313 Change-Id: I88edd91395849574436299b8badda21bb93bea39 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -121,7 +121,7 @@ bool Macro::save(const QString &fileName, QWidget *parent)
|
||||
QDataStream stream(saver.file());
|
||||
stream << d->version;
|
||||
stream << d->description;
|
||||
for (const MacroEvent &event : qAsConst(d->events)) {
|
||||
for (const MacroEvent &event : std::as_const(d->events)) {
|
||||
event.save(stream);
|
||||
}
|
||||
saver.setResult(&stream);
|
||||
|
||||
@@ -178,7 +178,7 @@ bool MacroManagerPrivate::executeMacro(Macro *macro)
|
||||
for (const MacroEvent ¯oEvent : macroEvents) {
|
||||
if (error)
|
||||
break;
|
||||
for (IMacroHandler *handler : qAsConst(handlers)) {
|
||||
for (IMacroHandler *handler : std::as_const(handlers)) {
|
||||
if (handler->canExecuteEvent(macroEvent)) {
|
||||
if (!handler->executeEvent(macroEvent))
|
||||
error = true;
|
||||
@@ -256,7 +256,7 @@ void MacroManager::startMacro()
|
||||
Core::ActionManager::command(Constants::END_MACRO)->action()->setEnabled(true);
|
||||
Core::ActionManager::command(Constants::EXECUTE_LAST_MACRO)->action()->setEnabled(false);
|
||||
Core::ActionManager::command(Constants::SAVE_LAST_MACRO)->action()->setEnabled(false);
|
||||
for (IMacroHandler *handler : qAsConst(d->handlers))
|
||||
for (IMacroHandler *handler : std::as_const(d->handlers))
|
||||
handler->startRecording(d->currentMacro);
|
||||
|
||||
const QString endShortcut = Core::ActionManager::command(Constants::END_MACRO)
|
||||
@@ -281,7 +281,7 @@ void MacroManager::endMacro()
|
||||
Core::ActionManager::command(Constants::END_MACRO)->action()->setEnabled(false);
|
||||
Core::ActionManager::command(Constants::EXECUTE_LAST_MACRO)->action()->setEnabled(true);
|
||||
Core::ActionManager::command(Constants::SAVE_LAST_MACRO)->action()->setEnabled(true);
|
||||
for (IMacroHandler *handler : qAsConst(d->handlers))
|
||||
for (IMacroHandler *handler : std::as_const(d->handlers))
|
||||
handler->endRecordingMacro(d->currentMacro);
|
||||
|
||||
d->isRecording = false;
|
||||
|
||||
@@ -135,7 +135,7 @@ void MacroOptionsWidget::remove()
|
||||
void MacroOptionsWidget::apply()
|
||||
{
|
||||
// Remove macro
|
||||
for (const QString &name : qAsConst(m_macroToRemove)) {
|
||||
for (const QString &name : std::as_const(m_macroToRemove)) {
|
||||
MacroManager::instance()->deleteMacro(name);
|
||||
m_macroToChange.remove(name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user