-
Notifications
You must be signed in to change notification settings - Fork 0
/
smithwidget.h
54 lines (39 loc) · 1.13 KB
/
smithwidget.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef SMITHWIDGET_H
#define SMITHWIDGET_H
#include <QObject>
#include <QWidget>
#include <QOpenGLWidget>
#include <QPainter>
#include <QWheelEvent>
#include <complex>
const uint32_t scNbCircle = 6;
class SmithWidget : public QOpenGLWidget
{
Q_OBJECT
public:
SmithWidget(QWidget *parent);
void setSize(uint16_t size);
std::complex<double> *SList;
QPointF *dispList;
uint16_t Sp = 0;
uint16_t size = 0;
qreal scale = 1.0;
QPoint clickpos;
QPoint offset;
double ZDispList[scNbCircle] = {10.0, 25.0, 50.0, 100.0, 200.0, 500.0};
double Z0 = 50;
void addZPoint(std::complex<double> Zt);
void addSPoint(std::complex<double> St);
signals:
void sendCurSZ(const std::complex<double> Z, const std::complex<double> S);
private:
void drawSmith(QPainter *painter);
void calcCircle();
protected:
void paintEvent(QPaintEvent *event) override;
void wheelEvent(QWheelEvent *event) override;
void mousePressEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override;
};
#endif // SMITHWIDGET_H