mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-27 11:05:44 +08:00
Use std::as_const (C++17 feature)
This commit is contained in:
@@ -66,7 +66,7 @@ namespace BlackGui
|
||||
int row = 0;
|
||||
int col = 0;
|
||||
int added = 0;
|
||||
for (const CAtcStation &station : as_const(stations))
|
||||
for (const CAtcStation &station : std::as_const(stations))
|
||||
{
|
||||
if (m_ignoreNonAtc)
|
||||
{
|
||||
|
||||
@@ -159,7 +159,7 @@ namespace BlackGui
|
||||
|
||||
QStringList select = comp.missingInTarget.values();
|
||||
select.append(comp.newerInSource.values());
|
||||
for (const QString &file : as_const(comp.missingInTarget))
|
||||
for (const QString &file : std::as_const(comp.missingInTarget))
|
||||
{
|
||||
const QModelIndex index = sourceModel->index(file);
|
||||
if (!index.isValid()) continue;
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace BlackGui
|
||||
connect(ui->pb_Update, &QPushButton::clicked, this, &CWeatherComponent::updateWeatherInformationForced);
|
||||
|
||||
m_weatherScenarios = CWeatherGrid::getAllScenarios();
|
||||
for (const auto &scenario : as_const(m_weatherScenarios))
|
||||
for (const auto &scenario : std::as_const(m_weatherScenarios))
|
||||
{
|
||||
ui->cb_weatherScenario->addItem(scenario.getName(), QVariant::fromValue(scenario));
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace BlackGui
|
||||
{
|
||||
ui->setupUi(this);
|
||||
m_allCheckBoxes = this->findChildren<QCheckBox *>(QString(), Qt::FindDirectChildrenOnly);
|
||||
for (QCheckBox *cb : as_const(m_allCheckBoxes))
|
||||
for (QCheckBox *cb : std::as_const(m_allCheckBoxes))
|
||||
{
|
||||
connect(cb, &QCheckBox::stateChanged, this, &CInterpolationSetupForm::onCheckboxChanged);
|
||||
}
|
||||
|
||||
@@ -340,7 +340,7 @@ namespace BlackGui
|
||||
|
||||
void CInfoArea::adjustSizeForAllDockWidgets()
|
||||
{
|
||||
for (CDockWidgetInfoArea *dw : as_const(m_dockWidgetInfoAreas))
|
||||
for (CDockWidgetInfoArea *dw : std::as_const(m_dockWidgetInfoAreas))
|
||||
{
|
||||
dw->adjustSize();
|
||||
}
|
||||
@@ -348,7 +348,7 @@ namespace BlackGui
|
||||
|
||||
void CInfoArea::floatAllWidgets()
|
||||
{
|
||||
for (CDockWidgetInfoArea *dw : as_const(m_dockWidgetInfoAreas))
|
||||
for (CDockWidgetInfoArea *dw : std::as_const(m_dockWidgetInfoAreas))
|
||||
{
|
||||
if (dw->isFloating()) { continue; }
|
||||
dw->toggleFloating();
|
||||
@@ -357,7 +357,7 @@ namespace BlackGui
|
||||
|
||||
void CInfoArea::resetAllFloatingWidgetSettings()
|
||||
{
|
||||
for (CDockWidgetInfoArea *dw : as_const(m_dockWidgetInfoAreas))
|
||||
for (CDockWidgetInfoArea *dw : std::as_const(m_dockWidgetInfoAreas))
|
||||
{
|
||||
if (!dw || !dw->isFloating()) { continue; }
|
||||
dw->resetSettings();
|
||||
@@ -366,7 +366,7 @@ namespace BlackGui
|
||||
|
||||
void CInfoArea::resetAllWidgetSettings()
|
||||
{
|
||||
for (CDockWidgetInfoArea *dw : as_const(m_dockWidgetInfoAreas))
|
||||
for (CDockWidgetInfoArea *dw : std::as_const(m_dockWidgetInfoAreas))
|
||||
{
|
||||
if (!dw || !dw->isFloating()) { continue; }
|
||||
dw->resetSettings();
|
||||
@@ -375,7 +375,7 @@ namespace BlackGui
|
||||
|
||||
void CInfoArea::allFloatingOnTop()
|
||||
{
|
||||
for (CDockWidgetInfoArea *dw : as_const(m_dockWidgetInfoAreas))
|
||||
for (CDockWidgetInfoArea *dw : std::as_const(m_dockWidgetInfoAreas))
|
||||
{
|
||||
const bool f = dw->isFloating();
|
||||
CGuiUtility::stayOnTop(f, dw);
|
||||
@@ -511,11 +511,11 @@ namespace BlackGui
|
||||
|
||||
void CInfoArea::displayStatusMessage(const CStatusMessage &statusMessage)
|
||||
{
|
||||
for (CDockWidgetInfoArea *dw : as_const(m_dockWidgetInfoAreas))
|
||||
for (CDockWidgetInfoArea *dw : std::as_const(m_dockWidgetInfoAreas))
|
||||
{
|
||||
dw->displayStatusMessage(statusMessage);
|
||||
}
|
||||
for (CInfoArea *ia : as_const(m_childInfoAreas))
|
||||
for (CInfoArea *ia : std::as_const(m_childInfoAreas))
|
||||
{
|
||||
ia->displayStatusMessage(statusMessage);
|
||||
}
|
||||
@@ -523,11 +523,11 @@ namespace BlackGui
|
||||
|
||||
void CInfoArea::displayStatusMessages(const CStatusMessageList &statusMessages)
|
||||
{
|
||||
for (CDockWidgetInfoArea *dw : as_const(m_dockWidgetInfoAreas))
|
||||
for (CDockWidgetInfoArea *dw : std::as_const(m_dockWidgetInfoAreas))
|
||||
{
|
||||
dw->displayStatusMessages(statusMessages);
|
||||
}
|
||||
for (CInfoArea *ia : as_const(m_childInfoAreas))
|
||||
for (CInfoArea *ia : std::as_const(m_childInfoAreas))
|
||||
{
|
||||
ia->displayStatusMessages(statusMessages);
|
||||
}
|
||||
@@ -535,7 +535,7 @@ namespace BlackGui
|
||||
|
||||
void CInfoArea::setDockArea(Qt::DockWidgetArea area)
|
||||
{
|
||||
for (CDockWidgetInfoArea *dw : as_const(m_dockWidgetInfoAreas))
|
||||
for (CDockWidgetInfoArea *dw : std::as_const(m_dockWidgetInfoAreas))
|
||||
{
|
||||
Qt::DockWidgetAreas newAreas = static_cast<Qt::DockWidgetAreas>(area);
|
||||
Qt::DockWidgetAreas oldAreas = dw->allowedAreas();
|
||||
@@ -678,7 +678,7 @@ namespace BlackGui
|
||||
|
||||
void CInfoArea::connectTopLevelChanged()
|
||||
{
|
||||
for (CDockWidgetInfoArea *dw : as_const(m_dockWidgetInfoAreas))
|
||||
for (CDockWidgetInfoArea *dw : std::as_const(m_dockWidgetInfoAreas))
|
||||
{
|
||||
connect(dw, &CDockWidgetInfoArea::widgetTopLevelChanged, this, &CInfoArea::onWidgetTopLevelChanged, Qt::QueuedConnection);
|
||||
}
|
||||
@@ -815,7 +815,7 @@ namespace BlackGui
|
||||
|
||||
void CInfoArea::setFeaturesForDockableWidgets(QDockWidget::DockWidgetFeatures features)
|
||||
{
|
||||
for (CDockWidgetInfoArea *dw : as_const(m_dockWidgetInfoAreas))
|
||||
for (CDockWidgetInfoArea *dw : std::as_const(m_dockWidgetInfoAreas))
|
||||
{
|
||||
dw->setFeatures(features);
|
||||
}
|
||||
@@ -898,7 +898,7 @@ namespace BlackGui
|
||||
{
|
||||
if (show == m_showTabTexts) { return; }
|
||||
m_showTabTexts = show;
|
||||
for (CDockWidgetInfoArea *dw : as_const(m_dockWidgetInfoAreas))
|
||||
for (CDockWidgetInfoArea *dw : std::as_const(m_dockWidgetInfoAreas))
|
||||
{
|
||||
dw->showTitleWhenDocked(show);
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace BlackGui
|
||||
const QMap<QString, BlackMisc::CIcons::IconIndex> availableActionsAndIcons = sApp->getInputManager()->allAvailableActionsAndIcons();
|
||||
QStringList keys = availableActionsAndIcons.keys();
|
||||
keys.sort();
|
||||
for (const QString &actionPath : as_const(keys))
|
||||
for (const QString &actionPath : std::as_const(keys))
|
||||
{
|
||||
QString currentPath;
|
||||
const QStringList tokens = actionPath.split("/", Qt::SkipEmptyParts);
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace BlackGui
|
||||
QStandardItemModel::clear();
|
||||
|
||||
int visibleColumns = 0;
|
||||
for (const QString &suffix : as_const(m_suffixes))
|
||||
for (const QString &suffix : std::as_const(m_suffixes))
|
||||
{
|
||||
// ownership of QStandardItem is taken by model
|
||||
QStandardItem *typeFolderFirstColumn = new QStandardItem(CCallsign::atcSuffixToIcon(suffix).toQIcon(), suffix);
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace BlackGui
|
||||
QList<double> series;
|
||||
CDistributorList distributorList(distributors.keys());
|
||||
distributorList.sortByKey();
|
||||
for (const CDistributor &distributor : as_const(distributorList))
|
||||
for (const CDistributor &distributor : std::as_const(distributorList))
|
||||
{
|
||||
const int c = distributors[distributor];
|
||||
if (c < 1) { continue; }
|
||||
@@ -93,7 +93,7 @@ namespace BlackGui
|
||||
CAircraftIcaoCodeList icaoList(icaos.keys());
|
||||
icaoList.sortByDesignatorAndRank();
|
||||
|
||||
for (const CAircraftIcaoCode &icao : as_const(icaoList))
|
||||
for (const CAircraftIcaoCode &icao : std::as_const(icaoList))
|
||||
{
|
||||
const int c = icaos[icao];
|
||||
if (c < 1) { continue; }
|
||||
|
||||
Reference in New Issue
Block a user