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 // trace marked invisible
continue; continue;
} }
pen = QPen(trace->color(), 1); pen = QPen(trace->color(), pref.Graphs.lineWidth);
pen.setCosmetic(true); pen.setCosmetic(true);
p.setPen(pen); p.setPen(pen);
int nPoints = trace->size(); int nPoints = trace->size();

View File

@ -457,7 +457,7 @@ void TraceXYPlot::draw(QPainter &p)
if(!t->isVisible()) { if(!t->isVisible()) {
continue; continue;
} }
pen = QPen(t->color(), 1); pen = QPen(t->color(), pref.Graphs.lineWidth);
pen.setCosmetic(true); pen.setCosmetic(true);
if(i == 1) { if(i == 1) {
pen.setStyle(Qt::DotLine); 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.domainChangeBehavior = (GraphDomainChangeBehavior) ui->GraphsDomainChangeBehavior->currentIndex();
p->Graphs.markerBehavior.showDataOnGraphs = ui->GraphsShowMarkerData->isChecked(); p->Graphs.markerBehavior.showDataOnGraphs = ui->GraphsShowMarkerData->isChecked();
p->Graphs.markerBehavior.showAllData = ui->GraphsShowAllMarkerData->isChecked(); p->Graphs.markerBehavior.showAllData = ui->GraphsShowAllMarkerData->isChecked();
p->Graphs.lineWidth = ui->GraphsLineWidth->value();
p->SCPIServer.enabled = ui->SCPIServerEnabled->isChecked(); p->SCPIServer.enabled = ui->SCPIServerEnabled->isChecked();
p->SCPIServer.port = ui->SCPIServerPort->value(); p->SCPIServer.port = ui->SCPIServerPort->value();
accept(); accept();
@ -210,6 +211,8 @@ void PreferencesDialog::setInitialGUIState()
ui->GraphsDomainChangeBehavior->setCurrentIndex((int) p->Graphs.domainChangeBehavior); ui->GraphsDomainChangeBehavior->setCurrentIndex((int) p->Graphs.domainChangeBehavior);
ui->GraphsShowMarkerData->setChecked(p->Graphs.markerBehavior.showDataOnGraphs); ui->GraphsShowMarkerData->setChecked(p->Graphs.markerBehavior.showDataOnGraphs);
ui->GraphsShowAllMarkerData->setChecked(p->Graphs.markerBehavior.showAllData); ui->GraphsShowAllMarkerData->setChecked(p->Graphs.markerBehavior.showAllData);
ui->GraphsLineWidth->setValue(p->Graphs.lineWidth);
ui->SCPIServerEnabled->setChecked(p->SCPIServer.enabled); ui->SCPIServerEnabled->setChecked(p->SCPIServer.enabled);
ui->SCPIServerPort->setValue(p->SCPIServer.port); ui->SCPIServerPort->setValue(p->SCPIServer.port);

View File

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

View File

@ -78,7 +78,7 @@
</size> </size>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>2</number>
</property> </property>
<widget class="QWidget" name="Startup"> <widget class="QWidget" name="Startup">
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_4">
@ -769,6 +769,20 @@
</layout> </layout>
</widget> </widget>
</item> </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> </layout>
</widget> </widget>
</item> </item>