apply some code analyzer recommendations

This commit is contained in:
2024-11-20 20:02:09 +03:00
parent 1becca7519
commit 04b40d367c
9 changed files with 25 additions and 33 deletions

View File

@@ -5,23 +5,15 @@
// GraphicType
GraphicType::GraphicType(QString name_, QColor color, Qt::PenStyle style, double width, bool visible_) {
GraphicType::GraphicType(QString name_, QColor color, Qt::PenStyle style, double width, bool visible_): name(name_), visible(visible_) {
pen.setColor(color);
pen.setStyle(style);
lines = true;
points = false;
fill = false;
fill_color = Qt::yellow;
if (qRound(width) == width)
pen.setWidth(qRound(width));
else
pen.setWidthF(width);
pen.setWidth(1);
pen.setCosmetic(true);
max_x = 0.;
name = name_;
visible = visible_;
pointWidth = 2.;
}

View File

@@ -49,16 +49,16 @@ struct QAD_GRAPHIC_EXPORT GraphicType {
QVector<QPolygonF> _lod;
QVector<QPolygonF> _lod_pause;
QPen pen;
QColor fill_color;
bool lines;
bool points;
bool fill;
double pointWidth;
double max_x;
double max_x_pause;
QCheckBox * pb = nullptr;
QColor fill_color = Qt::yellow;
bool lines = true;
bool points = false;
bool fill = false;
double pointWidth = 2.;
double max_x = 0.;
double max_x_pause = 0.;
QCheckBox * pb = nullptr;
QIcon icon;
bool visible;
bool visible = true;
QRectF cvrect;
int last_lod = 0;
};

View File

@@ -20,7 +20,7 @@ ConnectionEdit::ConnectionEdit(QWidget * parent): QDialog(parent) {
conn = 0;
PICodeInfo::EnumInfo * ei = PICODEINFO::enums().value("PIIODevice::DeviceMode");
if (ei) {
piForeachC(PICodeInfo::EnumeratorInfo & e, ei->members)
for (const auto & e: ei->members)
#if PIP_VERSION >= PIP_MAKE_VERSION(2, 39, 0)
ui->comboMode->addItem(PI2QString(e.name.toString() + " (" + PIString::fromNumber(e.value) + ")"),
QVariant::fromValue<int>(e.value));
@@ -31,7 +31,7 @@ ConnectionEdit::ConnectionEdit(QWidget * parent): QDialog(parent) {
ui->comboMode->setCurrentIndex(ui->comboMode->count() - 1);
ei = PICODEINFO::enums().value("PIIODevice::DeviceOption");
if (ei) {
piForeachC(PICodeInfo::EnumeratorInfo & e, ei->members) {
for (const auto & e: ei->members) {
QCheckBox * cb = new QCheckBox();
#if PIP_VERSION >= PIP_MAKE_VERSION(2, 39, 0)
cb->setText(PI2QString(e.name.toString() + " (" + PIString::fromNumber(e.value) + ")"));
@@ -44,7 +44,7 @@ ConnectionEdit::ConnectionEdit(QWidget * parent): QDialog(parent) {
}
ei = PICODEINFO::enums().value("PIPacketExtractor::SplitMode");
if (ei) {
piForeachC(PICodeInfo::EnumeratorInfo & e, ei->members)
for (const auto & e: ei->members)
#if PIP_VERSION >= PIP_MAKE_VERSION(2, 39, 0)
ui->comboSplit->addItem(PI2QString(e.name.toString() + " (" + PIString::fromNumber(e.value) + ")"),
QVariant::fromValue<int>(e.value));

View File

@@ -85,7 +85,7 @@ void FilterItem::rename() {
QString ms;
PICodeInfo::EnumInfo * ei = PICODEINFO::enums().value("PIPacketExtractor::SplitMode", 0);
if (ei) {
piForeachC(PICodeInfo::EnumeratorInfo & i, ei->members)
for (const auto & i: ei->members)
if (i.value == mode()) {
#if PIP_VERSION >= PIP_MAKE_VERSION(2, 39, 0)
ms = PI2QString(i.name.toString());

View File

@@ -13,7 +13,7 @@ IODeviceEditDialog::IODeviceEditDialog(QWidget * parent): QDialog(parent) {
ui->setupUi(this);
PICodeInfo::EnumInfo * ei = PICODEINFO::enums().value("PIIODevice::DeviceMode");
if (ei) {
piForeachC(PICodeInfo::EnumeratorInfo & e, ei->members)
for (const auto & e: ei->members)
#if PIP_VERSION >= PIP_MAKE_VERSION(2, 39, 0)
ui->comboMode->addItem(PI2QString(e.name.toString() + " (" + PIString::fromNumber(e.value) + ")"),
QVariant::fromValue<int>(e.value));
@@ -24,7 +24,7 @@ IODeviceEditDialog::IODeviceEditDialog(QWidget * parent): QDialog(parent) {
ui->comboMode->setCurrentIndex(ui->comboMode->count() - 1);
ei = PICODEINFO::enums().value("PIIODevice::DeviceOption");
if (ei) {
piForeachC(PICodeInfo::EnumeratorInfo & e, ei->members) {
for (const auto & e: ei->members) {
QCheckBox * cb = new QCheckBox();
#if PIP_VERSION >= PIP_MAKE_VERSION(2, 39, 0)
cb->setText(PI2QString(e.name.toString() + " (" + PIString::fromNumber(e.value) + ")"));
@@ -36,7 +36,7 @@ IODeviceEditDialog::IODeviceEditDialog(QWidget * parent): QDialog(parent) {
}
}
PIStringList pl = PIIODevice::availablePrefixes();
piForeachC(PIString & p, pl) {
for (const auto & p: pl) {
ui->comboType->addItem(PI2QString(p));
}
}