diff --git a/plugins/channelrx/demoddsc/dscdemodgui.cpp b/plugins/channelrx/demoddsc/dscdemodgui.cpp index 52ea530509..2fd2c25a5b 100644 --- a/plugins/channelrx/demoddsc/dscdemodgui.cpp +++ b/plugins/channelrx/demoddsc/dscdemodgui.cpp @@ -568,7 +568,7 @@ DSCDemodGUI::DSCDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban ui->deltaFrequency->setValueRange(false, 7, -9999999, 9999999); ui->channelPowerMeter->setColorTheme(LevelMeterSignalDB::ColorGreenAndBlue); - ui->messages->setItemDelegateForColumn(MESSAGE_COL_RSSI, new DecimalDelegate(1)); + ui->messages->setItemDelegateForColumn(MESSAGE_COL_RSSI, new DecimalDelegate(1, ui->messages)); m_scopeVis = m_dscDemod->getScopeSink(); m_scopeVis->setGLScope(ui->glScope); diff --git a/plugins/channelrx/demodnavtex/navtexdemodgui.cpp b/plugins/channelrx/demodnavtex/navtexdemodgui.cpp index 2c71eb4679..dbf3d71272 100644 --- a/plugins/channelrx/demodnavtex/navtexdemodgui.cpp +++ b/plugins/channelrx/demodnavtex/navtexdemodgui.cpp @@ -525,8 +525,8 @@ NavtexDemodGUI::NavtexDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, B ui->deltaFrequency->setValueRange(false, 7, -9999999, 9999999); ui->channelPowerMeter->setColorTheme(LevelMeterSignalDB::ColorGreenAndBlue); - ui->messages->setItemDelegateForColumn(MESSAGE_COL_ERROR_PERCENT, new DecimalDelegate(1)); - ui->messages->setItemDelegateForColumn(MESSAGE_COL_RSSI, new DecimalDelegate(1)); + ui->messages->setItemDelegateForColumn(MESSAGE_COL_ERROR_PERCENT, new DecimalDelegate(1, ui->messages)); + ui->messages->setItemDelegateForColumn(MESSAGE_COL_RSSI, new DecimalDelegate(1, ui->messages)); m_scopeVis = m_navtexDemod->getScopeSink(); m_scopeVis->setGLScope(ui->glScope); diff --git a/plugins/channelrx/demodradiosonde/radiosondedemodgui.cpp b/plugins/channelrx/demodradiosonde/radiosondedemodgui.cpp index 84d6f48398..178f50213c 100644 --- a/plugins/channelrx/demodradiosonde/radiosondedemodgui.cpp +++ b/plugins/channelrx/demodradiosonde/radiosondedemodgui.cpp @@ -647,16 +647,16 @@ RadiosondeDemodGUI::RadiosondeDemodGUI(PluginAPI* pluginAPI, DeviceUISet *device TableTapAndHold *tableTapAndHold = new TableTapAndHold(ui->frames); connect(tableTapAndHold, &TableTapAndHold::tapAndHold, this, &RadiosondeDemodGUI::customContextMenuRequested); - ui->frames->setItemDelegateForColumn(FRAME_COL_DATE, new DateTimeDelegate("yyyy/MM/dd")); - ui->frames->setItemDelegateForColumn(FRAME_COL_TIME, new TimeDelegate()); - ui->frames->setItemDelegateForColumn(FRAME_COL_LATITUDE, new DecimalDelegate(5)); - ui->frames->setItemDelegateForColumn(FRAME_COL_LONGITUDE, new DecimalDelegate(5)); - ui->frames->setItemDelegateForColumn(FRAME_COL_ALTITUDE, new DecimalDelegate(1)); - ui->frames->setItemDelegateForColumn(FRAME_COL_SPEED, new DecimalDelegate(1)); - ui->frames->setItemDelegateForColumn(FRAME_COL_VERTICAL_RATE, new DecimalDelegate(1)); - ui->frames->setItemDelegateForColumn(FRAME_COL_HEADING, new DecimalDelegate(1)); - ui->frames->setItemDelegateForColumn(FRAME_COL_GPS_TIME, new DateTimeDelegate("yyyy/MM/dd hh:mm:ss")); - ui->frames->setItemDelegateForColumn(FRAME_COL_FREQUENCY, new DecimalDelegate(3)); + ui->frames->setItemDelegateForColumn(FRAME_COL_DATE, new DateTimeDelegate("yyyy/MM/dd", ui->frames)); + ui->frames->setItemDelegateForColumn(FRAME_COL_TIME, new TimeDelegate("hh:mm:ss", ui->frames)); + ui->frames->setItemDelegateForColumn(FRAME_COL_LATITUDE, new DecimalDelegate(5, ui->frames)); + ui->frames->setItemDelegateForColumn(FRAME_COL_LONGITUDE, new DecimalDelegate(5, ui->frames)); + ui->frames->setItemDelegateForColumn(FRAME_COL_ALTITUDE, new DecimalDelegate(1, ui->frames)); + ui->frames->setItemDelegateForColumn(FRAME_COL_SPEED, new DecimalDelegate(1, ui->frames)); + ui->frames->setItemDelegateForColumn(FRAME_COL_VERTICAL_RATE, new DecimalDelegate(1, ui->frames)); + ui->frames->setItemDelegateForColumn(FRAME_COL_HEADING, new DecimalDelegate(1, ui->frames)); + ui->frames->setItemDelegateForColumn(FRAME_COL_GPS_TIME, new DateTimeDelegate("yyyy/MM/dd hh:mm:ss", ui->frames)); + ui->frames->setItemDelegateForColumn(FRAME_COL_FREQUENCY, new DecimalDelegate(3, ui->frames)); ui->scopeContainer->setVisible(false); diff --git a/plugins/channelrx/freqscanner/freqscannergui.cpp b/plugins/channelrx/freqscanner/freqscannergui.cpp index 2e725c598e..9660542c2d 100644 --- a/plugins/channelrx/freqscanner/freqscannergui.cpp +++ b/plugins/channelrx/freqscanner/freqscannergui.cpp @@ -496,11 +496,11 @@ FreqScannerGUI::FreqScannerGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, B applyAllSettings(); m_resizer.enableChildMouseTracking(); - ui->table->setItemDelegateForColumn(COL_FREQUENCY, new FrequencyDelegate("Auto", 3)); - ui->table->setItemDelegateForColumn(COL_POWER, new DecimalDelegate(1)); - ui->table->setItemDelegateForColumn(COL_CHANNEL_BW, new Int64Delegate(0, 10000000)); - ui->table->setItemDelegateForColumn(COL_TH, new DecimalDelegate(1, -120.0, 0.0)); - ui->table->setItemDelegateForColumn(COL_SQ, new DecimalDelegate(1, -120.0, 0.0)); + ui->table->setItemDelegateForColumn(COL_FREQUENCY, new FrequencyDelegate("Auto", 3, true, ui->table)); + ui->table->setItemDelegateForColumn(COL_POWER, new DecimalDelegate(1, ui->table)); + ui->table->setItemDelegateForColumn(COL_CHANNEL_BW, new Int64Delegate(0, 10000000, ui->table)); + ui->table->setItemDelegateForColumn(COL_TH, new DecimalDelegate(1, -120.0, 0.0, ui->table)); + ui->table->setItemDelegateForColumn(COL_SQ, new DecimalDelegate(1, -120.0, 0.0, ui->table)); connect(m_deviceUISet->m_spectrum->getSpectrumView(), &GLSpectrumView::updateAnnotations, this, &FreqScannerGUI::updateAnnotations); } diff --git a/plugins/channelrx/noisefigure/noisefiguregui.cpp b/plugins/channelrx/noisefigure/noisefiguregui.cpp index 9c0ba3f1dc..b371b3061e 100644 --- a/plugins/channelrx/noisefigure/noisefiguregui.cpp +++ b/plugins/channelrx/noisefigure/noisefiguregui.cpp @@ -657,11 +657,11 @@ NoiseFigureGUI::NoiseFigureGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, B ui->results->setContextMenuPolicy(Qt::CustomContextMenu); connect(ui->results, SIGNAL(customContextMenuRequested(QPoint)), SLOT(customContextMenuRequested(QPoint))); - ui->results->setItemDelegateForColumn(RESULTS_COL_NF, new DecimalDelegate(2)); - ui->results->setItemDelegateForColumn(RESULTS_COL_TEMP, new DecimalDelegate(0)); - ui->results->setItemDelegateForColumn(RESULTS_COL_Y, new DecimalDelegate(2)); - ui->results->setItemDelegateForColumn(RESULTS_COL_ENR, new DecimalDelegate(2)); - ui->results->setItemDelegateForColumn(RESULTS_COL_FLOOR, new DecimalDelegate(1)); + ui->results->setItemDelegateForColumn(RESULTS_COL_NF, new DecimalDelegate(2, ui->results)); + ui->results->setItemDelegateForColumn(RESULTS_COL_TEMP, new DecimalDelegate(0, ui->results)); + ui->results->setItemDelegateForColumn(RESULTS_COL_Y, new DecimalDelegate(2, ui->results)); + ui->results->setItemDelegateForColumn(RESULTS_COL_ENR, new DecimalDelegate(2, ui->results)); + ui->results->setItemDelegateForColumn(RESULTS_COL_FLOOR, new DecimalDelegate(1, ui->results)); ui->startStop->setStyleSheet(QString("QToolButton{ background-color: blue; } QToolButton:checked{ background-color: green; }")); diff --git a/plugins/channelrx/radioastronomy/radioastronomygui.cpp b/plugins/channelrx/radioastronomy/radioastronomygui.cpp index 370da38cc8..d26eddbd46 100644 --- a/plugins/channelrx/radioastronomy/radioastronomygui.cpp +++ b/plugins/channelrx/radioastronomy/radioastronomygui.cpp @@ -66,6 +66,9 @@ class TimeDeltaDelegate : public QStyledItemDelegate { public: + TimeDeltaDelegate(QObject *parent = nullptr) : + QStyledItemDelegate(parent) {} + virtual QString displayText(const QVariant &value, const QLocale &locale) const override { (void) locale; @@ -97,6 +100,9 @@ class TimeDeltaDelegate : public QStyledItemDelegate { class HMSDelegate : public QStyledItemDelegate { public: + HMSDelegate(QObject *parent = nullptr) : + QStyledItemDelegate(parent) {} + virtual QString displayText(const QVariant &value, const QLocale &locale) const override { (void) locale; @@ -109,6 +115,9 @@ class HMSDelegate : public QStyledItemDelegate { class DMSDelegate : public QStyledItemDelegate { public: + DMSDelegate(QObject *parent = nullptr) : + QStyledItemDelegate(parent) {} + virtual QString displayText(const QVariant &value, const QLocale &locale) const override { (void) locale; @@ -2123,42 +2132,42 @@ RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUI ui->powerTable->setContextMenuPolicy(Qt::CustomContextMenu); connect(ui->powerTable, SIGNAL(customContextMenuRequested(QPoint)), SLOT(customContextMenuRequested(QPoint))); - ui->powerTable->setItemDelegateForColumn(POWER_COL_TIME, new TimeDelegate()); - //ui->powerTable->setItemDelegateForColumn(POWER_COL_POWER, new DecimalDelegate(6)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_POWER_DB, new DecimalDelegate(1)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_POWER_DBM, new DecimalDelegate(1)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_TSYS, new DecimalDelegate(0)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_TSYS0, new DecimalDelegate(0)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_TSOURCE, new DecimalDelegate(0)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_TB, new DecimalDelegate(0)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_TSKY, new DecimalDelegate(0)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_FLUX, new DecimalDelegate(2)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_SIGMA_T, new DecimalDelegate(2)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_SIGMA_S, new DecimalDelegate(1)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_RA, new HMSDelegate()); - ui->powerTable->setItemDelegateForColumn(POWER_COL_DEC, new DMSDelegate()); - ui->powerTable->setItemDelegateForColumn(POWER_COL_GAL_LAT, new DecimalDelegate(0)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_GAL_LON, new DecimalDelegate(0)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_AZ, new DecimalDelegate(0)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_EL, new DecimalDelegate(0)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_VBCRS, new DecimalDelegate(1)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_VLSR, new DecimalDelegate(1)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_AIR_TEMP, new DecimalDelegate(1)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_ROT_AZ, new DecimalDelegate(0)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_ROT_EL, new DecimalDelegate(0)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_ROT_AZ_OFF, new DecimalDelegate(0)); - ui->powerTable->setItemDelegateForColumn(POWER_COL_ROT_EL_OFF, new DecimalDelegate(0)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_TIME, new TimeDelegate("hh:mm:ss", ui->powerTable)); + //ui->powerTable->setItemDelegateForColumn(POWER_COL_POWER, new DecimalDelegate(6, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_POWER_DB, new DecimalDelegate(1, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_POWER_DBM, new DecimalDelegate(1, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_TSYS, new DecimalDelegate(0, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_TSYS0, new DecimalDelegate(0, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_TSOURCE, new DecimalDelegate(0, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_TB, new DecimalDelegate(0, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_TSKY, new DecimalDelegate(0, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_FLUX, new DecimalDelegate(2, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_SIGMA_T, new DecimalDelegate(2, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_SIGMA_S, new DecimalDelegate(1, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_RA, new HMSDelegate(ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_DEC, new DMSDelegate(ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_GAL_LAT, new DecimalDelegate(0, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_GAL_LON, new DecimalDelegate(0, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_AZ, new DecimalDelegate(0, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_EL, new DecimalDelegate(0, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_VBCRS, new DecimalDelegate(1, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_VLSR, new DecimalDelegate(1, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_AIR_TEMP, new DecimalDelegate(1, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_ROT_AZ, new DecimalDelegate(0, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_ROT_EL, new DecimalDelegate(0, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_ROT_AZ_OFF, new DecimalDelegate(0, ui->powerTable)); + ui->powerTable->setItemDelegateForColumn(POWER_COL_ROT_EL_OFF, new DecimalDelegate(0, ui->powerTable)); resizeSpectrumMarkerTable(); - ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_FREQ, new DecimalDelegate(6)); - ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_VALUE, new DecimalDelegate(1)); - ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_DELTA_X, new DecimalDelegate(6)); - ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_DELTA_Y, new DecimalDelegate(1)); - ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_VR, new DecimalDelegate(2)); - ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_R, new DecimalDelegate(1)); - ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_D, new DecimalDelegate(1)); - ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_R_MIN, new DecimalDelegate(1)); - ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_V, new DecimalDelegate(1)); + ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_FREQ, new DecimalDelegate(6, ui->spectrumMarkerTable)); + ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_VALUE, new DecimalDelegate(1, ui->spectrumMarkerTable)); + ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_DELTA_X, new DecimalDelegate(6, ui->spectrumMarkerTable)); + ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_DELTA_Y, new DecimalDelegate(1, ui->spectrumMarkerTable)); + ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_VR, new DecimalDelegate(2, ui->spectrumMarkerTable)); + ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_R, new DecimalDelegate(1, ui->spectrumMarkerTable)); + ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_D, new DecimalDelegate(1, ui->spectrumMarkerTable)); + ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_R_MIN, new DecimalDelegate(1, ui->spectrumMarkerTable)); + ui->spectrumMarkerTable->setItemDelegateForColumn(SPECTRUM_MARKER_COL_V, new DecimalDelegate(1, ui->spectrumMarkerTable)); // Create blank marker table ui->spectrumMarkerTable->setRowCount(SPECTRUM_MARKER_ROWS); // 1 peak and two markers @@ -2187,10 +2196,10 @@ RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUI connect(ui->spectrumMarkerTable, &QTableWidget::itemChanged, this, &RadioAstronomyGUI::spectrumMarkerTableItemChanged); resizePowerMarkerTable(); - ui->powerMarkerTable->setItemDelegateForColumn(POWER_MARKER_COL_TIME, new TimeDelegate()); - ui->powerMarkerTable->setItemDelegateForColumn(POWER_MARKER_COL_VALUE, new DecimalDelegate(1)); - ui->powerMarkerTable->setItemDelegateForColumn(POWER_MARKER_COL_DELTA_X, new TimeDeltaDelegate()); - ui->powerMarkerTable->setItemDelegateForColumn(POWER_MARKER_COL_DELTA_Y, new DecimalDelegate(1)); + ui->powerMarkerTable->setItemDelegateForColumn(POWER_MARKER_COL_TIME, new TimeDelegate("hh:mm:ss", ui->powerMarkerTable)); + ui->powerMarkerTable->setItemDelegateForColumn(POWER_MARKER_COL_VALUE, new DecimalDelegate(1, ui->powerMarkerTable)); + ui->powerMarkerTable->setItemDelegateForColumn(POWER_MARKER_COL_DELTA_X, new TimeDeltaDelegate(ui->powerMarkerTable)); + ui->powerMarkerTable->setItemDelegateForColumn(POWER_MARKER_COL_DELTA_Y, new DecimalDelegate(1, ui->powerMarkerTable)); // Create blank marker table ui->powerMarkerTable->setRowCount(POWER_MARKER_ROWS); // 1 peak and two markers diff --git a/sdrbase/channel/channelwebapiutils.cpp b/sdrbase/channel/channelwebapiutils.cpp index 496bc3eb6b..4fb10f71a5 100644 --- a/sdrbase/channel/channelwebapiutils.cpp +++ b/sdrbase/channel/channelwebapiutils.cpp @@ -338,7 +338,9 @@ bool ChannelWebAPIUtils::getCenterFrequency(unsigned int deviceIndex, double &fr if (getDeviceSettings(deviceIndex, deviceSettingsResponse, deviceSet)) { QJsonObject *jsonObj = deviceSettingsResponse.asJsonObject(); - return WebAPIUtils::getSubObjectDouble(*jsonObj, "centerFrequency", frequencyInHz); + bool result = WebAPIUtils::getSubObjectDouble(*jsonObj, "centerFrequency", frequencyInHz); + delete jsonObj; + return result; } else { diff --git a/sdrgui/gui/spectrummeasurements.cpp b/sdrgui/gui/spectrummeasurements.cpp index 2ff356718f..3ee45f2d67 100644 --- a/sdrgui/gui/spectrummeasurements.cpp +++ b/sdrgui/gui/spectrummeasurements.cpp @@ -300,8 +300,8 @@ void SpectrumMeasurements::createPeakTable(int peaks) m_peakTable->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); m_peakTable->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents); - m_peakTable->setItemDelegateForColumn(COL_FREQUENCY, new UnitsDelegate()); - m_peakTable->setItemDelegateForColumn(COL_POWER, new UnitsDelegate()); + m_peakTable->setItemDelegateForColumn(COL_FREQUENCY, new UnitsDelegate(m_peakTable)); + m_peakTable->setItemDelegateForColumn(COL_POWER, new UnitsDelegate(m_peakTable)); // Cell context menu m_peakTable->setContextMenuPolicy(Qt::CustomContextMenu);