MCPcopy Create free account
hub / github.com/analogdevicesinc/scopy / updateLineStyle

Method updateLineStyle

gui/src/widgets/plotlegend.cpp:133–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133void PlotLegend::updateLineStyle(PlotChannel *ch)
134{
135 if(!m_colorLines.contains(ch)) {
136 return;
137 }
138
139 QWidget *colorLine = m_colorLines.value(ch);
140 QColor penColor = ch->curve()->pen().color();
141 QString color = QString("rgba(%1, %2, %3, %4)")
142 .arg(penColor.red())
143 .arg(penColor.green())
144 .arg(penColor.blue())
145 .arg(penColor.alpha());
146 int thickness = ch->thickness();
147 int style = ch->style();
148
149 QString borderStyle;
150 switch(style) {
151 case PlotChannel::PCS_DOTS:
152 borderStyle =
153 QString("background-color: transparent; border: %1px dotted %2;").arg(thickness).arg(color);
154 break;
155 case PlotChannel::PCS_STICKS:
156 case PlotChannel::PCS_STEPS:
157 borderStyle =
158 QString("background-color: transparent; border: %1px dashed %2;").arg(thickness).arg(color);
159 break;
160 case PlotChannel::PCS_LINES:
161 case PlotChannel::PCS_SMOOTH:
162 default:
163 borderStyle = QString("background-color: %1;").arg(color);
164 break;
165 }
166
167 colorLine->setFixedHeight(thickness);
168 colorLine->setStyleSheet(borderStyle);
169}
170
171#include "moc_plotlegend.cpp"

Callers

nothing calls this directly

Calls 8

thicknessMethod · 0.80
styleMethod · 0.80
QStringClass · 0.50
containsMethod · 0.45
valueMethod · 0.45
colorMethod · 0.45
penMethod · 0.45
curveMethod · 0.45

Tested by

no test coverage detected