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:
@@ -1046,7 +1046,7 @@ void ModelEditor::initToolbars()
|
||||
QList<qmt::Toolbar> toolbars = stereotypeController->toolbars();
|
||||
std::stable_sort(toolbars.begin(), toolbars.end(),
|
||||
[=](const qmt::Toolbar &lhs, const qmt::Toolbar &rhs) { return lhs.priority() > rhs.priority(); });
|
||||
for (const qmt::Toolbar &toolbar : qAsConst(toolbars)) {
|
||||
for (const qmt::Toolbar &toolbar : std::as_const(toolbars)) {
|
||||
QWidget *toolBar = toolBars.value(toolbar.id());
|
||||
QLayout *toolBarLayout = nullptr;
|
||||
if (!toolBar) {
|
||||
@@ -1171,7 +1171,7 @@ void ModelEditor::initToolbars()
|
||||
|
||||
// add stretch to all layouts and calculate width of tool bar
|
||||
int maxWidth = 48;
|
||||
for (QWidget *toolBar : qAsConst(toolBars)) {
|
||||
for (QWidget *toolBar : std::as_const(toolBars)) {
|
||||
QMT_ASSERT(toolBar, continue);
|
||||
auto layout = qobject_cast<QBoxLayout *>(toolBar->layout());
|
||||
QMT_ASSERT(layout, continue);
|
||||
|
||||
Reference in New Issue
Block a user