mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 10:15:38 +08:00
Return a default-constructed QString instead of implicitly converting an empty string literal.
This commit is contained in:
@@ -226,7 +226,7 @@ namespace BlackGui
|
||||
|
||||
QString CDbLiverySelectorComponent::stripExtraInfo(const QString &liveryCode) const
|
||||
{
|
||||
if (liveryCode.isEmpty()) { return ""; }
|
||||
if (liveryCode.isEmpty()) { return {}; }
|
||||
const QString l(liveryCode.trimmed().toUpper());
|
||||
int is = l.indexOf(' ');
|
||||
int ib = l.indexOf('(');
|
||||
|
||||
@@ -166,13 +166,13 @@ namespace BlackGui
|
||||
|
||||
QString CDbOwnModelsComponent::getInfoString() const
|
||||
{
|
||||
if (!m_modelLoader) { return ""; }
|
||||
if (!m_modelLoader) { return {}; }
|
||||
return m_modelLoader->getInfoString();
|
||||
}
|
||||
|
||||
QString CDbOwnModelsComponent::getInfoStringFsFamily() const
|
||||
{
|
||||
if (!m_modelLoader) { return ""; }
|
||||
if (!m_modelLoader) { return {}; }
|
||||
return m_modelLoader->getInfoStringFsFamily();
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace BlackGui
|
||||
|
||||
QString CDBusServerAddressSelector::getP2PAddress() const
|
||||
{
|
||||
if (!this->isP2P()) { return ""; }
|
||||
if (!this->isP2P()) { return {}; }
|
||||
return CDBusServer::p2pAddress(
|
||||
ui->cb_DBusServerAddress->currentText() + ":" +
|
||||
ui->le_DBusServerPort->text()
|
||||
|
||||
@@ -370,7 +370,7 @@ namespace BlackGui
|
||||
if (v.isEmpty() || v.endsWith(defaultIcao(), Qt::CaseInsensitive))
|
||||
{
|
||||
messages.push_back(CStatusMessage(this).validationError("Missing '%1'") << ui->lbl_DestinationAirport->text());
|
||||
flightPlan.setDestinationAirportIcao(QString(""));
|
||||
flightPlan.setDestinationAirportIcao(QString());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -411,7 +411,7 @@ namespace BlackGui
|
||||
{
|
||||
messages.push_back(CStatusMessage(this).validationInfo("Missing %1") << ui->lbl_AlternateAirport->text());
|
||||
}
|
||||
flightPlan.setAlternateAirportIcao(QString(""));
|
||||
flightPlan.setAlternateAirportIcao(QString());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -532,7 +532,7 @@ namespace BlackGui
|
||||
QString CTextMessageComponent::textMessageToCommand(const QString &enteredLine)
|
||||
{
|
||||
// only if visible
|
||||
if (enteredLine.isEmpty()) { return ""; }
|
||||
if (enteredLine.isEmpty()) { return {}; }
|
||||
|
||||
const int index = ui->tw_TextMessages->currentIndex();
|
||||
QString cmd(".msg ");
|
||||
|
||||
@@ -378,7 +378,7 @@ namespace BlackGui
|
||||
QString CGuiApplication::beautifyHelpMessage(const QString &helpText)
|
||||
{
|
||||
// just formatting Qt help message into HTML table
|
||||
if (helpText.isEmpty()) { return ""; }
|
||||
if (helpText.isEmpty()) { return {}; }
|
||||
const QStringList lines(helpText.split('\n'));
|
||||
QString html;
|
||||
bool tableMode = false;
|
||||
|
||||
@@ -123,11 +123,11 @@ namespace BlackGui
|
||||
{
|
||||
if (m_path.contains('/'))
|
||||
{
|
||||
if (m_path.endsWith('/')) { return ""; }
|
||||
if (m_path.endsWith('/')) { return {}; }
|
||||
const int i = m_path.lastIndexOf('/');
|
||||
return m_path.mid(i + 1);
|
||||
}
|
||||
return "";
|
||||
return {};
|
||||
}
|
||||
|
||||
void CMenuActions::splitSubMenus(const QString &key, QList<CMenuAction> &actions, QList<CMenuAction> &menus) const
|
||||
@@ -546,7 +546,7 @@ namespace BlackGui
|
||||
|
||||
QString CMenuActions::parentPath(const QString ¤tPath)
|
||||
{
|
||||
if (!currentPath.contains('/')) { return ""; }
|
||||
if (!currentPath.contains('/')) { return {}; }
|
||||
const int i = currentPath.lastIndexOf('/');
|
||||
return currentPath.left(i);
|
||||
}
|
||||
@@ -554,7 +554,7 @@ namespace BlackGui
|
||||
QString CMenuActions::keyRoot(const QString &key)
|
||||
{
|
||||
const int i = key.lastIndexOf('.');
|
||||
if (i < 0) { return ""; }
|
||||
if (i < 0) { return {}; }
|
||||
return key.left(i);
|
||||
}
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ namespace BlackGui
|
||||
|
||||
CVariant CPixmapFormatter::tooltipRole(const CVariant &dataCVariant) const
|
||||
{
|
||||
if (dataCVariant.isNull()) return "";
|
||||
if (dataCVariant.isNull()) return {};
|
||||
if (dataCVariant.canConvert<BlackMisc::CIcon>())
|
||||
{
|
||||
BlackMisc::CIcon icon = dataCVariant.value<BlackMisc::CIcon>();
|
||||
@@ -190,7 +190,7 @@ namespace BlackGui
|
||||
|
||||
CVariant CDateTimeFormatter::displayRole(const CVariant &dateTime) const
|
||||
{
|
||||
if (dateTime.isNull()) return "";
|
||||
if (dateTime.isNull()) return {};
|
||||
if (static_cast<QMetaType::Type>(dateTime.type()) == QMetaType::QDateTime)
|
||||
{
|
||||
const QDateTime dt = dateTime.value<QDateTime>();
|
||||
@@ -214,7 +214,7 @@ namespace BlackGui
|
||||
else
|
||||
{
|
||||
Q_ASSERT_X(false, "formatQVariant", "No QDate, QTime or QDateTime");
|
||||
return "";
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace BlackGui
|
||||
|
||||
QString CTextMessageTextEdit::toHtml(const CTextMessageList &messages, bool withFrom, bool withTo)
|
||||
{
|
||||
if (messages.isEmpty()) { return ""; }
|
||||
if (messages.isEmpty()) { return {}; }
|
||||
QString html("<table>");
|
||||
for (const CTextMessage &msg : messages)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user