OpenHantek
SpectrumDock.h
1 // SPDX-License-Identifier: GPL-2.0+
2 
3 #pragma once
4 
5 #include <QDockWidget>
6 #include <QGridLayout>
7 
8 #include "scopesettings.h"
9 
10 class QLabel;
11 class QCheckBox;
12 class QComboBox;
13 
14 class SiSpinBox;
15 
19 class SpectrumDock : public QDockWidget {
20  Q_OBJECT
21 
22  public:
27  SpectrumDock(DsoSettingsScope *scope, QWidget *parent, Qt::WindowFlags flags = 0);
28 
33  int setMagnitude(ChannelID channel, double magnitude);
34 
39  unsigned setUsed(ChannelID channel, bool used);
40 
41  protected:
42  void closeEvent(QCloseEvent *event);
43 
44  QGridLayout *dockLayout;
45  QWidget *dockWidget;
46 
47  struct ChannelBlock {
48  QCheckBox * usedCheckBox;
49  QComboBox * magnitudeComboBox;
50  };
51 
52  std::vector<ChannelBlock> channelBlocks;
53 
55 
56  std::vector<double> magnitudeSteps;
57  QStringList magnitudeStrings;
58 
59  signals:
60  void magnitudeChanged(ChannelID channel, double magnitude);
61  void usedChanged(ChannelID channel, bool used);
62 };
void usedChanged(ChannelID channel, bool used)
A spectrum has been enabled/disabled.
void magnitudeChanged(ChannelID channel, double magnitude)
A magnitude has been selected.
Definition: SpectrumDock.h:47
unsigned setUsed(ChannelID channel, bool used)
Enables/disables a channel.
Definition: SpectrumDock.cpp:94
QWidget * dockWidget
The main widget for the dock window.
Definition: SpectrumDock.h:45
SpectrumDock(DsoSettingsScope *scope, QWidget *parent, Qt::WindowFlags flags=0)
Initializes the spectrum view docking window.
Definition: SpectrumDock.cpp:26
QCheckBox * usedCheckBox
Enable/disable a specific channel.
Definition: SpectrumDock.h:48
QComboBox * magnitudeComboBox
Select the vertical magnitude for the spectrums.
Definition: SpectrumDock.h:49
std::vector< double > magnitudeSteps
The selectable magnitude steps in dB/div.
Definition: SpectrumDock.h:56
QGridLayout * dockLayout
The main layout for the dock window.
Definition: SpectrumDock.h:44
int setMagnitude(ChannelID channel, double magnitude)
Sets the magnitude for a channel.
Definition: SpectrumDock.cpp:83
A spin box with SI prefix support. This spin box supports the SI prefixes (k/M/G/T) after its value a...
Definition: sispinbox.h:14
DsoSettingsScope * scope
The settings provided by the parent class.
Definition: SpectrumDock.h:54
Holds the settings for the oscilloscope.
Definition: scopesettings.h:77
Dock window for the spectrum view. It contains the magnitude for all channels and allows to enable/di...
Definition: SpectrumDock.h:19
QStringList magnitudeStrings
String representations for the magnitude steps.
Definition: SpectrumDock.h:57
void closeEvent(QCloseEvent *event)
Don&#39;t close the dock, just hide it.
Definition: SpectrumDock.cpp:77