Fix Clang warnings

This commit is contained in:
Mat Sutcliffe
2020-11-03 22:52:38 +00:00
parent 49611b7f44
commit f461f60635
11 changed files with 33 additions and 33 deletions

View File

@@ -420,7 +420,7 @@ namespace BlackGui
{
ui->cb_OtherVersions->clear();
const QMap<QString, CApplicationInfo> otherVersions = CApplicationInfoList::currentApplicationDataDirectoryMapWithoutCurrentVersion();
for (const auto &pair : makePairsRange(otherVersions))
for (const auto pair : makePairsRange(otherVersions))
{
const CApplicationInfo &info(pair.second);
if (info.isNull())

View File

@@ -694,8 +694,8 @@ namespace BlackGui
QPoint globalPos = this->mapToGlobal(point);
QScopedPointer<QMenu> contextMenu(new QMenu(this));
contextMenu->addAction("Max.data area", this, &CDbMappingComponent::resizeForSelect, QKeySequence(Qt::CTRL + Qt::Key_M, Qt::Key_D));
contextMenu->addAction("Max.mapping area", this, &CDbMappingComponent::resizeForMapping, QKeySequence(Qt::CTRL + Qt::Key_M, Qt::Key_M));
contextMenu->addAction("Max.data area", this, &CDbMappingComponent::resizeForSelect, QKeySequence(static_cast<Qt::Key>(Qt::CTRL) + Qt::Key_M, Qt::Key_D));
contextMenu->addAction("Max.mapping area", this, &CDbMappingComponent::resizeForMapping, QKeySequence(static_cast<Qt::Key>(Qt::CTRL) + Qt::Key_M, Qt::Key_M));
QAction *selectedItem = contextMenu.data()->exec(globalPos);
Q_UNUSED(selectedItem)
}

View File

@@ -75,56 +75,56 @@ namespace BlackGui
{
QAction *a = new QAction(this);
a->setObjectName("overview");
a->setShortcut(QKeySequence(Qt::ALT + Qt::Key_S, Qt::Key_O));
a->setShortcut(QKeySequence(static_cast<Qt::Key>(Qt::ALT) + Qt::Key_S, Qt::Key_O));
connect(a, &QAction::triggered, this, &CSettingsComponent::onActionTriggered);
this->addAction(a);
ui->lbl_Hint->setText("Hint: See tooltips for shortcuts, \"ALT+S, O\" for overview.");
a = new QAction(this);
a->setObjectName("audio");
a->setShortcut(QKeySequence(Qt::ALT + Qt::Key_S, Qt::Key_A));
a->setShortcut(QKeySequence(static_cast<Qt::Key>(Qt::ALT) + Qt::Key_S, Qt::Key_A));
ui->pb_Audio->setToolTip(a->shortcut().toString());
connect(a, &QAction::triggered, this, &CSettingsComponent::onActionTriggered);
this->addAction(a);
a = new QAction(this);
a->setObjectName("data");
a->setShortcut(QKeySequence(Qt::ALT + Qt::Key_S, Qt::Key_D));
a->setShortcut(QKeySequence(static_cast<Qt::Key>(Qt::ALT) + Qt::Key_S, Qt::Key_D));
ui->pb_DataLoadAndCaches->setToolTip(a->shortcut().toString());
connect(a, &QAction::triggered, this, &CSettingsComponent::onActionTriggered);
this->addAction(a);
a = new QAction(this);
a->setObjectName("gui");
a->setShortcut(QKeySequence(Qt::ALT + Qt::Key_S, Qt::Key_G));
a->setShortcut(QKeySequence(static_cast<Qt::Key>(Qt::ALT) + Qt::Key_S, Qt::Key_G));
ui->pb_Gui->setToolTip(a->shortcut().toString());
connect(a, &QAction::triggered, this, &CSettingsComponent::onActionTriggered);
this->addAction(a);
a = new QAction(this);
a->setObjectName("hotkeys");
a->setShortcut(QKeySequence(Qt::ALT + Qt::Key_S, Qt::Key_H));
a->setShortcut(QKeySequence(static_cast<Qt::Key>(Qt::ALT) + Qt::Key_S, Qt::Key_H));
ui->pb_Hotkeys->setToolTip(a->shortcut().toString());
connect(a, &QAction::triggered, this, &CSettingsComponent::onActionTriggered);
this->addAction(a);
a = new QAction(this);
a->setObjectName("network");
a->setShortcut(QKeySequence(Qt::ALT + Qt::Key_S, Qt::Key_N));
a->setShortcut(QKeySequence(static_cast<Qt::Key>(Qt::ALT) + Qt::Key_S, Qt::Key_N));
ui->pb_Network->setToolTip(a->shortcut().toString());
connect(a, &QAction::triggered, this, &CSettingsComponent::onActionTriggered);
this->addAction(a);
a = new QAction(this);
a->setObjectName("simulator");
a->setShortcut(QKeySequence(Qt::ALT + Qt::Key_S, Qt::Key_S));
a->setShortcut(QKeySequence(static_cast<Qt::Key>(Qt::ALT) + Qt::Key_S, Qt::Key_S));
ui->pb_Simulator->setToolTip(a->shortcut().toString());
connect(a, &QAction::triggered, this, &CSettingsComponent::onActionTriggered);
this->addAction(a);
a = new QAction(this);
a->setObjectName("matching");
a->setShortcut(QKeySequence(Qt::ALT + Qt::Key_S, Qt::Key_M));
a->setShortcut(QKeySequence(static_cast<Qt::Key>(Qt::ALT) + Qt::Key_S, Qt::Key_M));
ui->pb_Matching->setToolTip(a->shortcut().toString());
connect(a, &QAction::triggered, this, &CSettingsComponent::onActionTriggered);
this->addAction(a);

View File

@@ -26,7 +26,7 @@ namespace BlackGui
{
CDropSite::CDropSite(QWidget *parent) : QLabel(parent)
{
this->setFrameStyle(QFrame::Sunken | QFrame::StyledPanel);
this->setFrameStyle(static_cast<int>(QFrame::Sunken) | QFrame::StyledPanel);
this->setAlignment(Qt::AlignCenter);
this->setAcceptDrops(true);
this->setTextFormat(Qt::RichText);

View File

@@ -17,50 +17,50 @@ namespace BlackGui
{
const QKeySequence &CShortcut::keyStash()
{
static const QKeySequence k(Qt::ALT + Qt::Key_S);
static const QKeySequence k(static_cast<Qt::Key>(Qt::ALT) + Qt::Key_S);
return k;
}
const QKeySequence &CShortcut::keyAddToModelSet()
{
static const QKeySequence k(Qt::ALT + Qt::Key_A);
static const QKeySequence k(static_cast<Qt::Key>(Qt::ALT) + Qt::Key_A);
return k;
}
const QKeySequence &CShortcut::keyClearSelection()
{
static const QKeySequence k(Qt::CTRL + Qt::Key_Space);
static const QKeySequence k(static_cast<Qt::Key>(Qt::CTRL) + Qt::Key_Space);
return k;
}
const QKeySequence &CShortcut::keySelectAll()
{
static const QKeySequence k(Qt::CTRL + Qt::Key_A);
static const QKeySequence k(static_cast<Qt::Key>(Qt::CTRL) + Qt::Key_A);
return k;
}
const QKeySequence &BlackGui::CShortcut::keyDisplayFilter()
{
static const QKeySequence k(Qt::CTRL + Qt::Key_F);
static const QKeySequence k(static_cast<Qt::Key>(Qt::CTRL) + Qt::Key_F);
return k;
}
const QKeySequence &CShortcut::keyResizeView()
{
static const QKeySequence k(Qt::CTRL + Qt::Key_R);
static const QKeySequence k(static_cast<Qt::Key>(Qt::CTRL) + Qt::Key_R);
return k;
}
const QKeySequence &CShortcut::keySave()
{
static const QKeySequence k(Qt::CTRL + Qt::Key_S);
static const QKeySequence k(static_cast<Qt::Key>(Qt::CTRL) + Qt::Key_S);
return k;
}
const QKeySequence &CShortcut::keySaveViews()
{
// remark CTRL+S not working in views
static const QKeySequence k(Qt::SHIFT + Qt::Key_S);
static const QKeySequence k(static_cast<Qt::Key>(Qt::SHIFT) + Qt::Key_S);
return k;
}
@@ -78,25 +78,25 @@ namespace BlackGui
const QKeySequence &CShortcut::keyCopy()
{
static const QKeySequence k(Qt::CTRL + Qt::Key_C);
static const QKeySequence k(static_cast<Qt::Key>(Qt::CTRL) + Qt::Key_C);
return k;
}
const QKeySequence &CShortcut::keyFontPlus()
{
static const QKeySequence k(Qt::CTRL + Qt::Key_Plus);
static const QKeySequence k(static_cast<Qt::Key>(Qt::CTRL) + Qt::Key_Plus);
return k;
}
const QKeySequence &CShortcut::keyFontMinus()
{
static const QKeySequence k(Qt::CTRL + Qt::Key_Minus);
static const QKeySequence k(static_cast<Qt::Key>(Qt::CTRL) + Qt::Key_Minus);
return k;
}
const QKeySequence &CShortcut::keyFontReset()
{
static const QKeySequence k(Qt::CTRL + Qt::Key_0);
static const QKeySequence k(static_cast<Qt::Key>(Qt::CTRL) + Qt::Key_0);
return k;
}

View File

@@ -166,7 +166,7 @@ namespace BlackMisc
CUpdateInfo result;
result.m_distributions = { alphaDistribution, betaDistribution };
for (const QJsonValue &release : QJsonDocument::fromJson(jsonData).array())
for (const QJsonValue release : QJsonDocument::fromJson(jsonData).array())
{
QString version = release[QLatin1String("tag_name")].toString();
if (version.isEmpty() || version[0] != 'v') { continue; }
@@ -176,7 +176,7 @@ namespace BlackMisc
bool existing = !release[QLatin1String("draft")].toBool();
bool alpha = release[QLatin1String("prerelease")].toBool();
for (const QJsonValue &asset : release[QLatin1String("assets")].toArray())
for (const QJsonValue asset : release[QLatin1String("assets")].toArray())
{
QString name = asset[QLatin1String("name")].toString();
QString filename = QStringLiteral("v%1/%2").arg(version, name);

View File

@@ -64,7 +64,7 @@ namespace BlackMisc
{
if (client != this) { channels.unite(client->m_subscriptions.keys().toSet()); }
}
for (const auto channel : channels)
for (const auto &channel : channels)
{
requestPeerSubscriptions(channel);
}

View File

@@ -222,7 +222,7 @@ namespace BlackMisc
{
QString result;
// QChar c (NOT QChar &c), see https://discordapp.com/channels/539048679160676382/539925070550794240/686321311076581440
for (const QChar c : s)
for (const QChar &c : s)
{
if (c.decompositionTag() == QChar::NoDecomposition)
{
@@ -230,7 +230,7 @@ namespace BlackMisc
}
else
{
for (const QChar dc : c.decomposition())
for (const QChar &dc : c.decomposition())
{
if (!dc.isMark()) { result.push_back(dc); }
}

View File

@@ -173,7 +173,7 @@ namespace BlackMisc
//! Properties by index
enum ColumnIndex
{
IndexOffsetMs = CPropertyIndexRef::GlobalIndexITimestampBased + ITimestampBased::IndexMSecsSinceEpoch + 1,
IndexOffsetMs = static_cast<int>(CPropertyIndexRef::GlobalIndexITimestampBased) + ITimestampBased::IndexMSecsSinceEpoch + 1,
IndexAdjustedMsWithOffset,
IndexOffsetWithUnit // keep this as last item
};

View File

@@ -90,7 +90,7 @@ CSwiftLauncher::CSwiftLauncher(QWidget *parent) :
connect(ui->pb_FSXConfigDirs, &QPushButton::released, this, &CSwiftLauncher::showSimulatorConfigDirs, Qt::QueuedConnection);
connect(ui->pb_P3DConfigDirs, &QPushButton::released, this, &CSwiftLauncher::showSimulatorConfigDirs, Qt::QueuedConnection);
const QShortcut *logPageShortCut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_L), this, SLOT(showLogPage()));
const QShortcut *logPageShortCut = new QShortcut(QKeySequence(static_cast<Qt::Key>(Qt::CTRL) + Qt::Key_L), this, SLOT(showLogPage()));
Q_UNUSED(logPageShortCut)
// periodically check

View File

@@ -846,7 +846,7 @@ namespace XSwiftBus
void CTraffic::doPlaneUpdates()
{
m_updates.clear();
for (const auto pair : m_planesById)
for (const auto &pair : m_planesById)
{
Plane *plane = pair.second;
interpolatePosition(plane);
@@ -909,7 +909,7 @@ namespace XSwiftBus
XPLMCameraPosition_t camPos {};
XPLMReadCameraPosition(&camPos);
for (const auto pair : m_traffic->m_planesById)
for (const auto &pair : m_traffic->m_planesById)
{
char *text = const_cast<char *>(pair.second->label);
const XPMPPlanePosition_t &planePos = pair.second->positions[3];