From 75a5dfef2461c4280ede8b8a7010d7b417b72c23 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Mon, 12 Aug 2019 14:54:16 +0200 Subject: [PATCH] Warnings removed --- companion/src/firmwares/rawsource.cpp | 4 ++-- companion/src/firmwares/sensordata.cpp | 8 ++++---- companion/src/mainwindow.cpp | 18 +++++++++--------- .../src/simulation/radiooutputswidget.cpp | 4 ++++ 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/companion/src/firmwares/rawsource.cpp b/companion/src/firmwares/rawsource.cpp index 507518150..b2d13e401 100644 --- a/companion/src/firmwares/rawsource.cpp +++ b/companion/src/firmwares/rawsource.cpp @@ -128,13 +128,13 @@ RawSourceRange RawSource::getRange(const ModelData * model, const GeneralSetting case TELEMETRY_SOURCE_T2_MAX: result.min = -30; result.max = 225; - result.unit = trUtf8("°C"); + result.unit = tr("°C"); break; case TELEMETRY_SOURCE_HDG: result.step = 2; result.max = 360; result.offset = 256; - result.unit = trUtf8("°"); + result.unit = tr("°"); break; case TELEMETRY_SOURCE_RPM: case TELEMETRY_SOURCE_RPM_MAX: diff --git a/companion/src/firmwares/sensordata.cpp b/companion/src/firmwares/sensordata.cpp index cf294a390..56c2653fe 100644 --- a/companion/src/firmwares/sensordata.cpp +++ b/companion/src/firmwares/sensordata.cpp @@ -52,9 +52,9 @@ QString SensorData::unitString() const case UNIT_FEET: return tr("f"); case UNIT_CELSIUS: - return trUtf8("°C"); + return tr("°C"); case UNIT_FAHRENHEIT: - return trUtf8("°F"); + return tr("°F"); case UNIT_PERCENT: return tr("%"); case UNIT_MAH: @@ -70,9 +70,9 @@ QString SensorData::unitString() const case UNIT_G: return tr("g"); case UNIT_DEGREE: - return trUtf8("°"); + return tr("°"); case UNIT_RADIANS: - return trUtf8("Rad"); + return tr("Rad"); case UNIT_HOURS: return tr("hours"); case UNIT_MINUTES: diff --git a/companion/src/mainwindow.cpp b/companion/src/mainwindow.cpp index 4e1dd7fbf..e795594cb 100644 --- a/companion/src/mainwindow.cpp +++ b/companion/src/mainwindow.cpp @@ -323,13 +323,13 @@ QString MainWindow::seekCodeString(const QByteArray & qba, const QString & label { int posLabel = qba.indexOf(label); if (posLabel < 0) - return QString::null; + return QString(); int start = qba.indexOf("\"", posLabel + label.length()); if (start < 0) - return QString::null; + return QString(); int end = qba.indexOf("\"", start + 1); if (end < 0) - return QString::null; + return QString(); return qba.mid(start + 1, end - start - 1); } @@ -529,10 +529,10 @@ void MainWindow::checkForFirmwareUpdateFinished(QNetworkReply * reply) QAbstractButton *rnButton = nullptr; msgBox.setText(tr("Firmware %1 does not seem to have ever been downloaded.\nVersion %2 is available.\nDo you want to download it now?\n\nWe recommend you view the release notes using the button below to learn about any changes that may be important to you.") .arg(Firmware::getCurrentVariant()->getId()).arg(fullVersionString)); - QAbstractButton *YesButton = msgBox.addButton(trUtf8("Yes"), QMessageBox::YesRole); - msgBox.addButton(trUtf8("No"), QMessageBox::NoRole); + QAbstractButton *YesButton = msgBox.addButton(tr("Yes"), QMessageBox::YesRole); + msgBox.addButton(tr("No"), QMessageBox::NoRole); if (!rn.isEmpty()) { - rnButton = msgBox.addButton(trUtf8("Release Notes"), QMessageBox::ActionRole); + rnButton = msgBox.addButton(tr("Release Notes"), QMessageBox::ActionRole); } msgBox.setIcon(QMessageBox::Question); msgBox.resize(0, 0); @@ -558,10 +558,10 @@ void MainWindow::checkForFirmwareUpdateFinished(QNetworkReply * reply) QAbstractButton *rnButton = nullptr; msgBox.setText(tr("A new version of %1 firmware is available:\n - current is %2\n - newer is %3\n\nDo you want to download it now?\n\nWe recommend you view the release notes using the button below to learn about any changes that may be important to you.") .arg(Firmware::getCurrentVariant()->getId()).arg(currentVersionString).arg(fullVersionString)); - QAbstractButton *YesButton = msgBox.addButton(trUtf8("Yes"), QMessageBox::YesRole); - msgBox.addButton(trUtf8("No"), QMessageBox::NoRole); + QAbstractButton *YesButton = msgBox.addButton(tr("Yes"), QMessageBox::YesRole); + msgBox.addButton(tr("No"), QMessageBox::NoRole); if (!rn.isEmpty()) { - rnButton = msgBox.addButton(trUtf8("Release Notes"), QMessageBox::ActionRole); + rnButton = msgBox.addButton(tr("Release Notes"), QMessageBox::ActionRole); } msgBox.setIcon(QMessageBox::Question); msgBox.resize(0,0); diff --git a/companion/src/simulation/radiooutputswidget.cpp b/companion/src/simulation/radiooutputswidget.cpp index 18cdbec81..d1c1434f5 100644 --- a/companion/src/simulation/radiooutputswidget.cpp +++ b/companion/src/simulation/radiooutputswidget.cpp @@ -290,7 +290,11 @@ QWidget * RadioOutputsWidget::createLogicalSwitch(QWidget * parent, int switchNo QFont font = swtch->font(); font.setBold(true); swtch->setFont(font); +#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0) swtch->setMinimumWidth(swtch->fontMetrics().width("99") + 10); +#else + swtch->setMinimumWidth(swtch->fontMetrics().horizontalAdvance("99") + 10); +#endif font.setBold(false); swtch->setFont(font); swtch->setText(QString("%1").arg(switchNo+1, 2, 10, QChar('0')));