Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
voltage_divider.h
Go to the documentation of this file.
1
7
8#ifndef VOLTAGE_DIVIDER_H
9#define VOLTAGE_DIVIDER_H
10
11#include <QDialog>
12#include <QVector>
14#include "Misc/general.h"
15
17class QLabel;
18class QPushButton;
19class QComboBox;
20class QGroupBox;
21class QTableWidget;
22class QLineEdit;
23
33class VoltageDividerDialog : public QDialog {
34 Q_OBJECT
35public:
38 explicit VoltageDividerDialog(QWidget *parent = nullptr);
39
40private slots:
42 void computeResults();
43
45 void addUpperResistor();
46
48 void removeUpperResistor();
49
51 void addLowerResistor();
52
54 void removeLowerResistor();
55
57 void on_inputChanged();
58
60 void showDocumentation() {
61 QString path = QString("/Calculators/VoltageDivider/index.html");
62 showHTMLDocs(path);
63 }
64
65private:
66 // ========== Input Widgets ==========
67
69 CustomDoubleSpinBox *spinVdc;
70
72 CustomDoubleSpinBox *spinPmax;
73
75 QTableWidget *tableUpper;
76
78 QTableWidget *tableLower;
79
80 // ========== Output Display ==========
81
83 QLabel *labelVout;
84
86 QTableWidget *resultsTable;
87
88 // ========== Helper Functions ==========
89
93 double parseResistance(const QString &valueStr) const;
94
98 QString formatResistance(double value) const;
99
103 QString formatCurrent(double value) const;
104
108 QString formatPower(double value) const;
109
112 QVector<double> getUpperResistors() const;
113
116 QVector<double> getLowerResistors() const;
117
121 double calculateParallelResistance(const QVector<double> &resistors) const;
122
124 void updateResultsTable();
125};
126
127#endif // VOLTAGE_DIVIDER_H
Custom QDoubleSpinBox. It includes a context menu (right-click) for setting the minimum,...
A QDoubleSpinBox subclass that provides a context menu for configuring range and step.
Definition CustomDoubleSpinBox.h:28
Dialog for designing voltage dividers with multiple parallel resistors.
Definition voltage_divider.h:33
Utility functions needed across the whole project.
void showHTMLDocs(QString path)
Show HTML documentation in the web browser.
Definition showHTMLDocs.cpp:17