Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Classes | Signals | Public Member Functions | Protected Member Functions | List of all members
SmithChartWidget Class Reference

Smith chart visualization and interaction widget. Provides impedance/admittance Smith chart drawing, trace management and marker handling, with basic zoom, pan and frequency-range controls. More...

#include <smithchartwidget.h>

Inheritance diagram for SmithChartWidget:
Inheritance graph
[legend]
Collaboration diagram for SmithChartWidget:
Collaboration graph
[legend]

Classes

struct  AxisSettings
 Settings for plot axes and display options. More...
 
struct  Marker
 Data structure for the frequency marker Defines a marker at a specific frequency with its appearance. More...
 
struct  Trace
 Data structure representing a trace on the plot. More...
 

Signals

void impedanceSelected (const std::complex< double > &impedance)
 Emitted when a point on the chart is clicked.
 

Public Member Functions

SmithChartWidget::AxisSettings getSettings () const
 Returns the current axis settings.
 
void setSettings (const AxisSettings &settings)
 Set the current axis settings.
 
 SmithChartWidget (QWidget *parent=nullptr)
 Class constructor.
 
 ~SmithChartWidget () override
 Class destructor.
 
void addTrace (const QString &name, const Trace &trace)
 Add or update a trace on the plot.
 
void removeTrace (const QString &)
 Remove a trace from the plot.
 
void clearTraces ()
 Remove all traces from the plot.
 
void setCharacteristicImpedance (double z)
 Set the characteristic impedance of the diagram.
 
double characteristicImpedance () const
 Get the characteristic impedance of the diagram.
 
QPen getTracePen (const QString &traceName) const
 Get the diagram QPen style of a trace (by name)
 
void setTracePen (const QString &traceName, const QPen &pen)
 Sets the pen for an existing trace (given its name)
 
QMap< QString, QPen > getTracesInfo () const
 Returns a map with trace names and their QPens.
 
bool addMarker (const QString &markerId, double frequency, const QPen &pen=QPen(Qt::red, 2))
 Adds a marker at a given frequency.
 
bool removeMarker (const QString &markerId)
 Remove a trace from the plot, given its name.
 
bool updateMarkerFrequency (const QString &markerId, double newFrequency)
 Update the frequency of an existing marker.
 
void clearMarkers ()
 Remove all markers from the plot.
 
QMap< QString, double > getMarkers () const
 Get all markers and their frequencies.
 

Protected Member Functions

void paintEvent (QPaintEvent *event) override
 Reimplements paintEvent to draw the Smith chart and overlays.
 
void mousePressEvent (QMouseEvent *event) override
 Handles mouse clicks to pick impedances and emit impedanceSelected().
 

Detailed Description

Smith chart visualization and interaction widget. Provides impedance/admittance Smith chart drawing, trace management and marker handling, with basic zoom, pan and frequency-range controls.

Constructor & Destructor Documentation

◆ SmithChartWidget()

SmithChartWidget::SmithChartWidget ( QWidget *  parent = nullptr)

Class constructor.

Parameters
parentParent widget

Member Function Documentation

◆ addMarker()

bool SmithChartWidget::addMarker ( const QString &  markerId,
double  frequency,
const QPen &  pen = QPen(Qt::red, 2) 
)

Adds a marker at a given frequency.

Parameters
markerIdUnique marker identifier.
frequencyMarker frequency (Hz).
penPen used to draw marker and label.
Note
By default, the trace styling is red and its width = 2
Returns
true on success, false if ID exists or no trace covers the frequency.

◆ addTrace()

void SmithChartWidget::addTrace ( const QString &  name,
const Trace trace 
)

Add or update a trace on the plot.

Parameters
nameUnique trace identifier
traceTrace data structure

◆ characteristicImpedance()

double SmithChartWidget::characteristicImpedance ( ) const
inline

Get the characteristic impedance of the diagram.

Returns
z0 Characteristic impedance of the diagram

◆ getMarkers()

QMap< QString, double > SmithChartWidget::getMarkers ( ) const

Get all markers and their frequencies.

Returns
Map of marker IDs to frequencies in Hz

◆ getSettings()

SmithChartWidget::AxisSettings SmithChartWidget::getSettings ( ) const

Returns the current axis settings.

Returns
AxisSettings of the diagram

◆ getTracePen()

QPen SmithChartWidget::getTracePen ( const QString &  traceName) const

Get the diagram QPen style of a trace (by name)

Parameters
traceNameName of the trace
Returns
Trace QPen style object

◆ getTracesInfo()

QMap< QString, QPen > SmithChartWidget::getTracesInfo ( ) const

Returns a map with trace names and their QPens.

Returns
QMap object relating the name of the trace with the QPen style object

◆ impedanceSelected

void SmithChartWidget::impedanceSelected ( const std::complex< double > &  impedance)
signal

Emitted when a point on the chart is clicked.

Parameters
impedanceImpedance corresponding to the clicked position (Ohms).

◆ removeMarker()

bool SmithChartWidget::removeMarker ( const QString &  markerId)

Remove a trace from the plot, given its name.

Parameters
nameTrace identifier

◆ removeTrace()

void SmithChartWidget::removeTrace ( const QString &  traceName)

Remove a trace from the plot.

Parameters
nameTrace identifier

◆ setCharacteristicImpedance()

void SmithChartWidget::setCharacteristicImpedance ( double  z)
inline

Set the characteristic impedance of the diagram.

Parameters
z0Characteristic impedance (e.g. 50 Ohm, 75 Ohm)

◆ setSettings()

void SmithChartWidget::setSettings ( const AxisSettings settings)

Set the current axis settings.

Parameters
settingsNew AxisSettings

◆ setTracePen()

void SmithChartWidget::setTracePen ( const QString &  traceName,
const QPen &  pen 
)

Sets the pen for an existing trace (given its name)

Parameters
traceNameName of the trace.
penNew pen to use.

◆ updateMarkerFrequency()

bool SmithChartWidget::updateMarkerFrequency ( const QString &  markerId,
double  newFrequency 
)

Update the frequency of an existing marker.

Parameters
markerIdMarker identifier
newFrequencyNew frequency in Hz
Returns
true if updated successfully, false if marker not found or frequency invali

The documentation for this class was generated from the following files: