MCPcopy Create free account
hub / github.com/Audio4Linux/JDSP4Linux / onLegendClick

Method onLegendClick

src/subprojects/AutoEqIntegration/AeqPreviewPlot.cpp:232–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

230}
231
232void AeqPreviewPlot::onLegendClick(QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event)
233{
234 Q_UNUSED(legend)
235 Q_UNUSED(event)
236
237 if (item)
238 {
239 bool dark = AppConfig::instance().get<bool>(AppConfig::AeqPlotDarkMode);
240
241 QCPPlottableLegendItem *plItem = qobject_cast<QCPPlottableLegendItem*>(item);
242 bool visible = plItem->plottable()->visible();
243 plItem->plottable()->setVisible(!visible);
244
245 if(dark)
246 {
247 plItem->setTextColor(!visible ? QColor(Qt::white) : QColor(Qt::darkGray));
248 }
249 else
250 {
251 plItem->setTextColor(!visible ? QColor(Qt::black) : QColor(Qt::gray));
252 }
253 replot();
254 }
255}
256
257void AeqPreviewPlot::onLegendDoubleClick(QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event)
258{

Callers

nothing calls this directly

Calls 4

QColorClass · 0.85
plottableMethod · 0.80
setTextColorMethod · 0.80
setVisibleMethod · 0.45

Tested by

no test coverage detected