Removed warnings

This commit is contained in:
Jan Käberich 2020-11-19 17:10:47 +01:00
parent c00d00cac2
commit 6d445631f0
10 changed files with 23 additions and 20 deletions

View File

@ -479,19 +479,19 @@ AmplitudeModel::AmplitudeModel(AmplitudeCalDialog *c) :
{ {
} }
int AmplitudeModel::rowCount(const QModelIndex &parent) const int AmplitudeModel::rowCount(const QModelIndex &) const
{ {
return c->getPoints().size(); return c->getPoints().size();
} }
int AmplitudeModel::columnCount(const QModelIndex &parent) const int AmplitudeModel::columnCount(const QModelIndex &) const
{ {
return ColIndexLast; return ColIndexLast;
} }
QVariant AmplitudeModel::data(const QModelIndex &index, int role) const QVariant AmplitudeModel::data(const QModelIndex &index, int role) const
{ {
if(role == Qt::DisplayRole && index.row() < c->getPoints().size()) { if(role == Qt::DisplayRole && static_cast<unsigned int>(index.row()) < c->getPoints().size()) {
auto p = c->getPoints()[index.row()]; auto p = c->getPoints()[index.row()];
switch(index.column()) { switch(index.column()) {
case ColIndexFreq: case ColIndexFreq:
@ -519,7 +519,7 @@ QVariant AmplitudeModel::data(const QModelIndex &index, int role) const
return QVariant(); return QVariant();
} }
bool AmplitudeModel::setData(const QModelIndex &index, const QVariant &value, int role) bool AmplitudeModel::setData(const QModelIndex &index, const QVariant &value, int)
{ {
if((unsigned int) index.row() >= c->getPoints().size()) { if((unsigned int) index.row() >= c->getPoints().size()) {
return false; return false;

View File

@ -20,7 +20,7 @@ static const std::vector<double> E96 = {
double ESeries::ToESeries(double value, ESeries::Series s, ESeries::Type t) double ESeries::ToESeries(double value, ESeries::Series s, ESeries::Type t)
{ {
if(s == Series::Ideal) { if(s == Series::Ideal || value <= 0) {
// nothing to do // nothing to do
return value; return value;
} }
@ -45,7 +45,7 @@ double ESeries::ToESeries(double value, ESeries::Series s, ESeries::Type t)
if(index < series.size()) { if(index < series.size()) {
higher = series[index]; higher = series[index];
} }
double approximation; double approximation = 0;
switch(t) { switch(t) {
case Type::Lower: approximation = lower; break; case Type::Lower: approximation = lower; break;
case Type::Higher: approximation = higher; break; case Type::Higher: approximation = higher; break;

View File

@ -111,7 +111,7 @@ void ImpedanceMatchDialog::calculateMatch()
// convert X and B to inductor and capacitor // convert X and B to inductor and capacitor
bool twoCs = false; bool twoCs = false;
bool twoLs = false; bool twoLs = false;
double L, C, C2, L2; double L = 0, C = 0, C2 = 0, L2 = 0;
if(X >= 0) { if(X >= 0) {
L = X/(2*M_PI*freq); L = X/(2*M_PI*freq);
if(B > 0) { if(B > 0) {

View File

@ -110,8 +110,8 @@ void TraceEditDialog::on_buttonBox_accepted()
auto t = ui->touchstoneImport->getTouchstone(); auto t = ui->touchstoneImport->getTouchstone();
trace.fillFromTouchstone(t, ui->CParameter->currentIndex(), ui->touchstoneImport->getFilename()); trace.fillFromTouchstone(t, ui->CParameter->currentIndex(), ui->touchstoneImport->getFilename());
} else { } else {
Trace::LivedataType type; Trace::LivedataType type = Trace::LivedataType::Overwrite;
Trace::LiveParameter param; Trace::LiveParameter param = Trace::LiveParameter::S11;
switch(ui->CLiveType->currentIndex()) { switch(ui->CLiveType->currentIndex()) {
case 0: type = Trace::LivedataType::Overwrite; break; case 0: type = Trace::LivedataType::Overwrite; break;
case 1: type = Trace::LivedataType::MaxHold; break; case 1: type = Trace::LivedataType::MaxHold; break;

View File

@ -80,14 +80,14 @@ void TraceExportDialog::on_buttonBox_accepted()
} }
t.AddDatapoint(tData); t.AddDatapoint(tData);
} }
Touchstone::Unit unit; Touchstone::Unit unit = Touchstone::Unit::GHz;
switch(ui->cUnit->currentIndex()) { switch(ui->cUnit->currentIndex()) {
case 0: unit = Touchstone::Unit::Hz; break; case 0: unit = Touchstone::Unit::Hz; break;
case 1: unit = Touchstone::Unit::kHz; break; case 1: unit = Touchstone::Unit::kHz; break;
case 2: unit = Touchstone::Unit::MHz; break; case 2: unit = Touchstone::Unit::MHz; break;
case 3: unit = Touchstone::Unit::GHz; break; case 3: unit = Touchstone::Unit::GHz; break;
} }
Touchstone::Format format; Touchstone::Format format = Touchstone::Format::RealImaginary;
switch(ui->cFormat->currentIndex()) { switch(ui->cFormat->currentIndex()) {
case 0: format = Touchstone::Format::DBAngle; break; case 0: format = Touchstone::Format::DBAngle; break;
case 1: format = Touchstone::Format::MagnitudeAngle; break; case 1: format = Touchstone::Format::MagnitudeAngle; break;

View File

@ -268,7 +268,7 @@ TraceMarker *TraceMarkerModel::markerFromIndex(const QModelIndex &index) const
} }
} }
QSize MarkerTraceDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const QSize MarkerTraceDelegate::sizeHint(const QStyleOptionViewItem &, const QModelIndex &) const
{ {
return QSize(0, rowHeight); return QSize(0, rowHeight);
} }
@ -307,12 +307,12 @@ void MarkerTraceDelegate::setModelData(QWidget *editor, QAbstractItemModel *mode
markerModel->setData(index, c->itemData(c->currentIndex())); markerModel->setData(index, c->itemData(c->currentIndex()));
} }
QSize MarkerSettingsDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const QSize MarkerSettingsDelegate::sizeHint(const QStyleOptionViewItem &, const QModelIndex &) const
{ {
return QSize(0, rowHeight); return QSize(0, rowHeight);
} }
QWidget *MarkerSettingsDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const QWidget *MarkerSettingsDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &index) const
{ {
auto marker = static_cast<const TraceMarkerModel*>(index.model())->markerFromIndex(index); auto marker = static_cast<const TraceMarkerModel*>(index.model())->markerFromIndex(index);
marker->editingFrequeny = true; marker->editingFrequeny = true;
@ -331,17 +331,16 @@ QWidget *MarkerSettingsDelegate::createEditor(QWidget *parent, const QStyleOptio
void MarkerSettingsDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const void MarkerSettingsDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{ {
auto markerModel = (TraceMarkerModel*) model; auto markerModel = (TraceMarkerModel*) model;
auto marker = markerModel->markerFromIndex(index);
auto si = (SIUnitEdit*) editor; auto si = (SIUnitEdit*) editor;
markerModel->setData(index, si->value()); markerModel->setData(index, si->value());
} }
QSize MarkerTypeDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const QSize MarkerTypeDelegate::sizeHint(const QStyleOptionViewItem &, const QModelIndex &) const
{ {
return QSize(0, rowHeight); return QSize(0, rowHeight);
} }
QWidget *MarkerTypeDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const QWidget *MarkerTypeDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &index) const
{ {
auto marker = static_cast<const TraceMarkerModel*>(index.model())->markerFromIndex(index); auto marker = static_cast<const TraceMarkerModel*>(index.model())->markerFromIndex(index);
auto editor = marker->getTypeEditor(const_cast<MarkerTypeDelegate*>(this)); auto editor = marker->getTypeEditor(const_cast<MarkerTypeDelegate*>(this));
@ -350,7 +349,7 @@ QWidget *MarkerTypeDelegate::createEditor(QWidget *parent, const QStyleOptionVie
return editor; return editor;
} }
void MarkerTypeDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const void MarkerTypeDelegate::setModelData(QWidget *editor, QAbstractItemModel *, const QModelIndex &index) const
{ {
auto marker = static_cast<const TraceMarkerModel*>(index.model())->markerFromIndex(index); auto marker = static_cast<const TraceMarkerModel*>(index.model())->markerFromIndex(index);
marker->updateTypeFromEditor(editor); marker->updateTypeFromEditor(editor);

View File

@ -3,6 +3,7 @@
#include "traceplot.h" #include "traceplot.h"
#include <QPen> #include <QPen>
#include <QPainterPath>
class TraceSmithChart : public TracePlot class TraceSmithChart : public TracePlot
{ {

View File

@ -449,7 +449,8 @@ void TraceXYPlot::updateXAxis()
auto trace = t.first; auto trace = t.first;
if(enabled && trace->isVisible()) { if(enabled && trace->isVisible()) {
// this trace is currently displayed // this trace is currently displayed
double trace_min, trace_max; double trace_min = std::numeric_limits<double>::max();
double trace_max = std::numeric_limits<double>::lowest();
switch(XAxis.type) { switch(XAxis.type) {
case XAxisType::Frequency: case XAxisType::Frequency:
trace_min = trace->minFreq(); trace_min = trace->minFreq();

View File

@ -14,4 +14,5 @@ int main(int argc, char *argv[]) {
vna.resize(1280, 800); vna.resize(1280, 800);
vna.show(); vna.show();
a.exec(); a.exec();
return 0;
} }

View File

@ -152,7 +152,8 @@ static Protocol::Datapoint DecodeDatapoint(uint8_t *buf) {
} }
static int16_t EncodeDatapoint(Protocol::Datapoint d, uint8_t *buf, static int16_t EncodeDatapoint(Protocol::Datapoint d, uint8_t *buf,
uint16_t bufSize) { uint16_t bufSize) {
// Special case, bypassing the encoder for speed optimizations. (void) bufSize;
// Special case, bypassing the encoder for speed optimizations.
// The datapoint is only ever encoded on the device and the // The datapoint is only ever encoded on the device and the
// Protocol::Datapoint struct is setup without any padding between // Protocol::Datapoint struct is setup without any padding between
// the variables. In this case it is allowed to simply copy its // the variables. In this case it is allowed to simply copy its