Skip to content

Commit fb347c3

Browse files
committed
add scroll bars to graph area
1 parent e667843 commit fb347c3

File tree

5 files changed

+28
-16
lines changed

5 files changed

+28
-16
lines changed

Software/PC_Application/LibreVNA-GUI/SpectrumAnalyzer/spectrumanalyzer.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,12 @@
4646

4747
SpectrumAnalyzer::SpectrumAnalyzer(AppWindow *window, QString name)
4848
: Mode(window, name, "SA"),
49-
central(new TileWidget(traceModel, window)),
49+
central(new QScrollArea),
50+
tiles(new TileWidget(traceModel, window)),
5051
firstPointTime(0)
5152
{
53+
central->setWidget(tiles);
54+
central->setWidgetResizable(true);
5255
changingSettings = false;
5356
averages = 1;
5457
singleSweep = false;
@@ -385,7 +388,7 @@ nlohmann::json SpectrumAnalyzer::toJSON()
385388
j["sweep"] = sweep;
386389

387390
j["traces"] = traceModel.toJSON();
388-
j["tiles"] = central->toJSON();
391+
j["tiles"] = tiles->toJSON();
389392
j["markers"] = markerModel->toJSON();
390393
return j;
391394
}
@@ -399,7 +402,7 @@ void SpectrumAnalyzer::fromJSON(nlohmann::json j)
399402
traceModel.fromJSON(j["traces"]);
400403
}
401404
if(j.contains("tiles")) {
402-
central->fromJSON(j["tiles"]);
405+
tiles->fromJSON(j["tiles"]);
403406
}
404407
if(j.contains("markers")) {
405408
markerModel->fromJSON(j["markers"]);
@@ -1059,7 +1062,7 @@ void SpectrumAnalyzer::SetupSCPI()
10591062
return average.getLevel() == averages ? "TRUE" : "FALSE";
10601063
}));
10611064
scpi_acq->add(new SCPICommand("LIMit", nullptr, [=](QStringList) -> QString {
1062-
return central->allLimitsPassing() ? "PASS" : "FAIL";
1065+
return tiles->allLimitsPassing() ? "PASS" : "FAIL";
10631066
}));
10641067
scpi_acq->add(new SCPICommand("SIGid", [=](QStringList params) -> QString {
10651068
if (params.size() != 1) {
@@ -1257,13 +1260,13 @@ void SpectrumAnalyzer::StoreSweepSettings()
12571260

12581261
void SpectrumAnalyzer::createDefaultTracesAndGraphs(int ports)
12591262
{
1260-
central->clear();
1263+
tiles->clear();
12611264
auto traceXY = new TraceXYPlot(traceModel);
12621265
traceXY->setYAxis(0, YAxis::Type::Magnitude, false, false, -120,0,10);
12631266
traceXY->setYAxis(1, YAxis::Type::Disabled, false, true, 0,0,1);
12641267
traceXY->updateSpan(settings.freqStart, settings.freqStop);
12651268

1266-
central->setPlot(traceXY);
1269+
tiles->setPlot(traceXY);
12671270

12681271
QColor defaultColors[] = {Qt::yellow, Qt::blue, Qt::red, Qt::green, Qt::gray, Qt::cyan, Qt::magenta, Qt::white};
12691272

Software/PC_Application/LibreVNA-GUI/SpectrumAnalyzer/spectrumanalyzer.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <QWidget>
1313
#include <QComboBox>
1414
#include <QCheckBox>
15+
#include <QScrollArea>
1516

1617
class SpectrumAnalyzer : public Mode
1718
{
@@ -99,7 +100,8 @@ private slots:
99100
MarkerModel *markerModel;
100101
Averaging average;
101102

102-
TileWidget *central;
103+
QScrollArea *central;
104+
TileWidget *tiles;
103105
QCheckBox *cbSignalID;
104106
QComboBox *cbWindowType, *cbDetector;
105107
QComboBox *cbTrackGenPort;

Software/PC_Application/LibreVNA-GUI/VNA/vna.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,17 @@
5252
#include <QErrorMessage>
5353
#include <QDebug>
5454
#include <QStyle>
55+
#include <QScrollArea>
5556

5657
VNA::VNA(AppWindow *window, QString name)
5758
: Mode(window, name, "VNA"),
5859
deembedding(traceModel),
5960
deembedding_active(false),
60-
central(new TileWidget(traceModel))
61+
central(new QScrollArea),
62+
tiles(new TileWidget(traceModel))
6163
{
64+
central->setWidget(tiles);
65+
central->setWidgetResizable(true);
6266
averages = 1;
6367
singleSweep = false;
6468
calMeasuring = false;
@@ -734,7 +738,7 @@ nlohmann::json VNA::toJSON()
734738
j["sweep"] = sweep;
735739

736740
j["traces"] = traceModel.toJSON();
737-
j["tiles"] = central->toJSON();
741+
j["tiles"] = tiles->toJSON();
738742
j["markers"] = markerModel->toJSON();
739743
j["de-embedding"] = deembedding.toJSON();
740744
j["de-embedding_enabled"] = deembedding_active;
@@ -750,7 +754,7 @@ void VNA::fromJSON(nlohmann::json j)
750754
traceModel.fromJSON(j["traces"]);
751755
}
752756
if(j.contains("tiles")) {
753-
central->fromJSON(j["tiles"]);
757+
tiles->fromJSON(j["tiles"]);
754758
}
755759
if(j.contains("markers")) {
756760
markerModel->fromJSON(j["markers"]);
@@ -1359,7 +1363,7 @@ void VNA::SetupSCPI()
13591363
return average.getLevel() == averages ? SCPI::getResultName(SCPI::Result::True) : SCPI::getResultName(SCPI::Result::False);
13601364
}));
13611365
scpi_acq->add(new SCPICommand("LIMit", nullptr, [=](QStringList) -> QString {
1362-
return central->allLimitsPassing() ? "PASS" : "FAIL";
1366+
return tiles->allLimitsPassing() ? "PASS" : "FAIL";
13631367
}));
13641368
scpi_acq->add(new SCPICommand("SINGLE", [=](QStringList params) -> QString {
13651369
bool single;
@@ -1531,8 +1535,8 @@ void VNA::createDefaultTracesAndGraphs(int ports)
15311535
}
15321536
}
15331537
// Add created graphs to tiles
1534-
central->clear();
1535-
TileWidget *tile = central;
1538+
tiles->clear();
1539+
TileWidget *tile = tiles;
15361540
for(int i=0;i<ports;i++) {
15371541
TileWidget *row;
15381542
if(i != ports - 1) {
@@ -1557,7 +1561,7 @@ void VNA::createDefaultTracesAndGraphs(int ports)
15571561
}
15581562
if(ports >= 3) {
15591563
// default split at the middle does not result in all plots being the same size, adjust
1560-
tile = central;
1564+
tile = tiles;
15611565
for(int i=0;i<ports;i++) {
15621566
TileWidget *rowTile;
15631567
if(i < ports - 1) {

Software/PC_Application/LibreVNA-GUI/VNA/vna.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include <QObject>
1414
#include <QWidget>
15+
#include <QScrollArea>
1516
#include <functional>
1617

1718
class VNA : public Mode
@@ -168,7 +169,8 @@ private slots:
168169
QLabel *lAverages;
169170
QLabel *calLabel;
170171

171-
TileWidget *central;
172+
TileWidget *tiles;
173+
QScrollArea *central;
172174

173175
signals:
174176
void deviceInitialized();

Software/PC_Application/LibreVNA-GUI/appwindow.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "appwindow.h"
1+
#include "appwindow.h"
22

33
#include "unit.h"
44
#include "CustomWidgets/toggleswitch.h"
@@ -58,6 +58,7 @@
5858
#include <iomanip>
5959
#include <QDateTime>
6060
#include <QCommandLineParser>
61+
#include <QScrollArea>
6162

6263
using namespace std;
6364

0 commit comments

Comments
 (0)