Add preference option for trace line width

This commit is contained in:
Jan Käberich 2021-12-05 18:26:32 +01:00
parent 45cf2200b8
commit aba0650d25
5 changed files with 23 additions and 4 deletions

View File

@ -186,7 +186,7 @@ void TraceSmithChart::draw(QPainter &p) {
// trace marked invisible
continue;
}
pen = QPen(trace->color(), 1);
pen = QPen(trace->color(), pref.Graphs.lineWidth);
pen.setCosmetic(true);
p.setPen(pen);
int nPoints = trace->size();

View File

@ -457,7 +457,7 @@ void TraceXYPlot::draw(QPainter &p)
if(!t->isVisible()) {
continue;
}
pen = QPen(t->color(), 1);
pen = QPen(t->color(), pref.Graphs.lineWidth);
pen.setCosmetic(true);
if(i == 1) {
pen.setStyle(Qt::DotLine);

View File

@ -143,6 +143,7 @@ PreferencesDialog::PreferencesDialog(Preferences *pref, QWidget *parent) :
p->Graphs.domainChangeBehavior = (GraphDomainChangeBehavior) ui->GraphsDomainChangeBehavior->currentIndex();
p->Graphs.markerBehavior.showDataOnGraphs = ui->GraphsShowMarkerData->isChecked();
p->Graphs.markerBehavior.showAllData = ui->GraphsShowAllMarkerData->isChecked();
p->Graphs.lineWidth = ui->GraphsLineWidth->value();
p->SCPIServer.enabled = ui->SCPIServerEnabled->isChecked();
p->SCPIServer.port = ui->SCPIServerPort->value();
accept();
@ -210,6 +211,8 @@ void PreferencesDialog::setInitialGUIState()
ui->GraphsDomainChangeBehavior->setCurrentIndex((int) p->Graphs.domainChangeBehavior);
ui->GraphsShowMarkerData->setChecked(p->Graphs.markerBehavior.showDataOnGraphs);
ui->GraphsShowAllMarkerData->setChecked(p->Graphs.markerBehavior.showAllData);
ui->GraphsLineWidth->setValue(p->Graphs.lineWidth);
ui->SCPIServerEnabled->setChecked(p->SCPIServer.enabled);
ui->SCPIServerPort->setValue(p->SCPIServer.port);

View File

@ -85,6 +85,7 @@ public:
bool showDataOnGraphs;
bool showAllData;
} markerBehavior;
double lineWidth;
} Graphs;
struct {
bool enabled;
@ -101,7 +102,7 @@ private:
QString name;
QVariant def;
};
const std::array<SettingDescription, 38> descr = {{
const std::array<SettingDescription, 39> descr = {{
{&Startup.ConnectToFirstDevice, "Startup.ConnectToFirstDevice", true},
{&Startup.RememberSweepSettings, "Startup.RememberSweepSettings", false},
{&Startup.DefaultSweep.type, "Startup.DefaultSweep.type", "Frequency"},
@ -138,6 +139,7 @@ private:
{&Graphs.domainChangeBehavior, "Graphs.domainChangeBehavior", GraphDomainChangeBehavior::AdjustGraphs},
{&Graphs.markerBehavior.showDataOnGraphs, "Graphs.markerBehavior.ShowDataOnGraphs", true},
{&Graphs.markerBehavior.showAllData, "Graphs.markerBehavior.ShowAllData", false},
{&Graphs.lineWidth, "Graphs.lineWidth", 1.0},
{&SCPIServer.enabled, "SCPIServer.enabled", true},
{&SCPIServer.port, "SCPIServer.port", 19542},
}};

View File

@ -78,7 +78,7 @@
</size>
</property>
<property name="currentIndex">
<number>1</number>
<number>2</number>
</property>
<widget class="QWidget" name="Startup">
<layout class="QHBoxLayout" name="horizontalLayout_4">
@ -769,6 +769,20 @@
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_27">
<property name="text">
<string>Line Width:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="GraphsLineWidth">
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
</layout>
</widget>
</item>