Skip to content

Commit bff83d1

Browse files
authored
Merge pull request #57 from ChrisHal/improvements
DlgGraphSetting: add checkbox to select dragging of all Y axes
2 parents c3c0ef3 + 37e4852 commit bff83d1

5 files changed

+77
-52
lines changed

QtPMbrowser/DlgGraphSettings.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,14 @@ void DlgGraphSettings::selectBkTraceColor()
7171
}
7272

7373
void DlgGraphSettings::setValues(bool autoscale, double xmin, double xmax, double ymin, double ymax,
74-
int numtraces, bool grid_horz, bool grid_vert,
74+
int numtraces, bool grid_horz, bool grid_vert, bool shift_all_y_scales,
7575
QColor color_grid, QColor color_trace, QColor color_bktrace)
7676
{
7777
QLocale loc{};
7878
ui.checkBoxEnableAutoscale->setChecked(autoscale);
7979
ui.checkBoxHorzGrid->setChecked(grid_horz);
8080
ui.checkBoxVertGrid->setChecked(grid_vert);
81+
ui.checkBoxShiftAllYScales->setChecked(shift_all_y_scales);
8182
ui.lineEditXMin->setText(loc.toString(xmin));
8283
ui.lineEditXMax->setText(loc.toString(xmax));
8384
ui.lineEditYMin->setText(loc.toString(ymin));
@@ -92,13 +93,14 @@ void DlgGraphSettings::setValues(bool autoscale, double xmin, double xmax, doubl
9293
}
9394

9495
void DlgGraphSettings::getValues(bool& autoscale, double& xmin, double& xmax, double& ymin, double& ymax,
95-
int& numtraces, bool& grid_horz, bool& grid_vert,
96+
int& numtraces, bool& grid_horz, bool& grid_vert, bool& shift_all_y_scales,
9697
QColor& color_grid, QColor& color_trace, QColor& color_bktrace)
9798
{
9899
QLocale loc{};
99100
autoscale = ui.checkBoxEnableAutoscale->isChecked();
100101
grid_horz = ui.checkBoxHorzGrid->isChecked();
101102
grid_vert = ui.checkBoxVertGrid->isChecked();
103+
shift_all_y_scales = ui.checkBoxShiftAllYScales->isChecked();
102104
xmin = loc.toDouble(ui.lineEditXMin->text());
103105
xmax = loc.toDouble(ui.lineEditXMax->text());
104106
ymin = loc.toDouble(ui.lineEditYMin->text());

QtPMbrowser/DlgGraphSettings.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ private slots:
3737
~DlgGraphSettings();
3838
void setValues(bool autoscale, double xmin, double xmax,
3939
double ymin, double ymax, int numtraces, bool grid_horz, bool gird_vert,
40+
bool shift_all_y_scales,
4041
QColor color_grid, QColor color_trace, QColor color_bktrace);
4142
void getValues(bool& autoscale, double& xmin, double& xmax,
4243
double& ymin, double& ymax, int& numtraces,
43-
bool& grid_horz, bool& gird_vert,
44+
bool& grid_horz, bool& gird_vert, bool& shift_all_y_scales,
4445
QColor& color_grid, QColor& color_trace, QColor& color_bktrace);
4546

4647
private:

QtPMbrowser/DlgGraphSettings.ui

+65-45
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,55 @@
77
<x>0</x>
88
<y>0</y>
99
<width>359</width>
10-
<height>442</height>
10+
<height>447</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
1414
<string>Graph Settings &amp; Axis Ranges</string>
1515
</property>
1616
<layout class="QGridLayout" name="gridLayout_2">
17-
<item row="4" column="0" colspan="2">
17+
<item row="1" column="0">
18+
<widget class="QCheckBox" name="checkBoxHorzGrid">
19+
<property name="text">
20+
<string>show horizontal grid lines</string>
21+
</property>
22+
</widget>
23+
</item>
24+
<item row="2" column="0">
25+
<widget class="QCheckBox" name="checkBoxVertGrid">
26+
<property name="text">
27+
<string>show vertical grid lines</string>
28+
</property>
29+
</widget>
30+
</item>
31+
<item row="0" column="0" colspan="2">
32+
<widget class="QCheckBox" name="checkBoxEnableAutoscale">
33+
<property name="text">
34+
<string>autoscale when new trace is selected</string>
35+
</property>
36+
</widget>
37+
</item>
38+
<item row="6" column="1">
39+
<widget class="QLineEdit" name="lineEditNumTraces"/>
40+
</item>
41+
<item row="6" column="0">
42+
<widget class="QLabel" name="label_5">
43+
<property name="text">
44+
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of traces to hold&lt;br/&gt;in persistance buffer (max. 99)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
45+
</property>
46+
</widget>
47+
</item>
48+
<item row="8" column="0" colspan="2">
49+
<widget class="QDialogButtonBox" name="buttonBox">
50+
<property name="orientation">
51+
<enum>Qt::Orientation::Horizontal</enum>
52+
</property>
53+
<property name="standardButtons">
54+
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok</set>
55+
</property>
56+
</widget>
57+
</item>
58+
<item row="5" column="0" colspan="2">
1859
<widget class="QGroupBox" name="groupBox">
1960
<property name="title">
2061
<string>Axis Ranges</string>
@@ -31,7 +72,7 @@
3172
<string>bottom/x</string>
3273
</property>
3374
<property name="alignment">
34-
<set>Qt::AlignCenter</set>
75+
<set>Qt::AlignmentFlag::AlignCenter</set>
3576
</property>
3677
</widget>
3778
</item>
@@ -48,7 +89,7 @@
4889
<string>min.</string>
4990
</property>
5091
<property name="alignment">
51-
<set>Qt::AlignCenter</set>
92+
<set>Qt::AlignmentFlag::AlignCenter</set>
5293
</property>
5394
</widget>
5495
</item>
@@ -58,7 +99,7 @@
5899
<string>left/y</string>
59100
</property>
60101
<property name="alignment">
61-
<set>Qt::AlignCenter</set>
102+
<set>Qt::AlignmentFlag::AlignCenter</set>
62103
</property>
63104
</widget>
64105
</item>
@@ -68,7 +109,7 @@
68109
<string>max.</string>
69110
</property>
70111
<property name="alignment">
71-
<set>Qt::AlignCenter</set>
112+
<set>Qt::AlignmentFlag::AlignCenter</set>
72113
</property>
73114
</widget>
74115
</item>
@@ -84,7 +125,7 @@
84125
<string>axis name</string>
85126
</property>
86127
<property name="alignment">
87-
<set>Qt::AlignCenter</set>
128+
<set>Qt::AlignmentFlag::AlignCenter</set>
88129
</property>
89130
</widget>
90131
</item>
@@ -93,48 +134,14 @@
93134
</layout>
94135
</widget>
95136
</item>
96-
<item row="5" column="0">
97-
<widget class="QLabel" name="label_5">
98-
<property name="text">
99-
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of traces to hold&lt;br/&gt;in persistance buffer (max. 99)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
100-
</property>
101-
</widget>
102-
</item>
103-
<item row="0" column="0" colspan="2">
104-
<widget class="QCheckBox" name="checkBoxEnableAutoscale">
137+
<item row="3" column="0">
138+
<widget class="QCheckBox" name="checkBoxShiftAllYScales">
105139
<property name="text">
106-
<string>autoscale when new trace is selected</string>
140+
<string>dragging affects all Y scales</string>
107141
</property>
108142
</widget>
109143
</item>
110-
<item row="1" column="0">
111-
<widget class="QCheckBox" name="checkBoxHorzGrid">
112-
<property name="text">
113-
<string>show horizontal grid lines</string>
114-
</property>
115-
</widget>
116-
</item>
117-
<item row="2" column="0">
118-
<widget class="QCheckBox" name="checkBoxVertGrid">
119-
<property name="text">
120-
<string>show vertical grid lines</string>
121-
</property>
122-
</widget>
123-
</item>
124-
<item row="5" column="1">
125-
<widget class="QLineEdit" name="lineEditNumTraces"/>
126-
</item>
127-
<item row="6" column="0" colspan="2">
128-
<widget class="QDialogButtonBox" name="buttonBox">
129-
<property name="orientation">
130-
<enum>Qt::Horizontal</enum>
131-
</property>
132-
<property name="standardButtons">
133-
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
134-
</property>
135-
</widget>
136-
</item>
137-
<item row="3" column="0" colspan="2">
144+
<item row="4" column="0" colspan="2">
138145
<widget class="QGroupBox" name="groupBoxColors">
139146
<property name="title">
140147
<string>Select Line Colors</string>
@@ -185,6 +192,19 @@
185192
</layout>
186193
</widget>
187194
</item>
195+
<item row="7" column="0" colspan="2">
196+
<spacer name="verticalSpacer">
197+
<property name="orientation">
198+
<enum>Qt::Orientation::Vertical</enum>
199+
</property>
200+
<property name="sizeHint" stdset="0">
201+
<size>
202+
<width>20</width>
203+
<height>40</height>
204+
</size>
205+
</property>
206+
</spacer>
207+
</item>
188208
</layout>
189209
</widget>
190210
<tabstops>

QtPMbrowser/renderarea.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ RenderArea::RenderArea(QWidget* parent) :
9797
//chkOverlay.setStyle(btnstyle);
9898
chkOverlay.setToolTip("overlay traces");
9999

100+
currentYscale = &yScales["A"];
101+
100102
}
101103

102104
RenderArea::~RenderArea()
@@ -654,11 +656,11 @@ void RenderArea::showSettingsDialog()
654656
{
655657
DlgGraphSettings dlg(this);
656658
dlg.setValues(do_autoscale_on_load, x_min, x_max, currentYscale->y_min, currentYscale->y_max, numtraces,
657-
show_grid_horz, show_grid_vert, color_grid, color_trace, color_bktrace);
659+
show_grid_horz, show_grid_vert, shift_all_y_scales, color_grid, color_trace, color_bktrace);
658660
if (dlg.exec()) {
659661
settings_modified = true;
660662
dlg.getValues(do_autoscale_on_load, x_min, x_max, currentYscale->y_min, currentYscale->y_max, numtraces,
661-
show_grid_horz, show_grid_vert, color_grid, color_trace, color_bktrace);
663+
show_grid_horz, show_grid_vert, shift_all_y_scales, color_grid, color_trace, color_bktrace);
662664
// if numtraces has been reduced we want to get rid of excess traces
663665
while (tracebuffer.size() > numtraces) {
664666
delete tracebuffer.dequeue();

QtPMbrowser/renderarea.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ class RenderArea : public QWidget
7272
bool isXYmode() { return xTrace.isValid(); };
7373

7474
bool YtraceHasX() { return (yTrace.isValid() && yTrace.has_x_trace()); };
75-
bool isSettingsModified() { return settings_modified; };
76-
bool isAutoscaleEnabled() { return do_autoscale_on_load; };
75+
bool isSettingsModified() const { return settings_modified; };
76+
bool isAutoscaleEnabled() const { return do_autoscale_on_load; };
7777
void saveSettings();
7878
void loadSettings();
7979

0 commit comments

Comments
 (0)