Fix QSS() implementation & try to avoid crash on a crappy laptop running OpenSUSE

This commit is contained in:
Alex Spataru 2024-10-14 15:36:16 -05:00
parent a5d0593b21
commit c6e7cd2e80
4 changed files with 20 additions and 6 deletions

View File

@ -61,8 +61,14 @@
template<typename... Colors>
inline QString QSS(const QString &style, const Colors &...colors)
{
QStringList colorNames = {colors.name()...};
return QString(style).arg(colorNames.join(','));
QStringList colorNames;
(colorNames << ... << colors.name());
QString result = style;
for (int i = 0; i < colorNames.size(); ++i)
{
result = result.arg(colorNames[i]);
}
return result;
}
/**

View File

@ -216,6 +216,7 @@ void UI::DeclarativeWidget::setWidget(QWidget *widget)
delete m_widget;
m_widget = widget;
m_widget->setAttribute(Qt::WA_UpdatesDisabled, true);
Q_EMIT widgetChanged();
}
}
@ -228,6 +229,7 @@ void UI::DeclarativeWidget::renderWidget()
{
if (widget() && isVisible())
{
widget()->update();
m_pixmap = widget()->grab();
update();
}

View File

@ -133,10 +133,13 @@ void Widgets::FFTPlot::updateData()
points[i] = QPointF(frequency, dB);
}
// Plot obtained data
// Update curve with new data
m_curve.setSamples(points);
m_plot.setAxisScale(QwtPlot::xBottom, 0, m_samplingRate / 2);
m_plot.replot();
// Replot graph
if (isEnabled())
m_plot.replot();
}
}

View File

@ -167,9 +167,12 @@ void Widgets::Plot::updateData()
}
}
// Replot graph
// Add new data to curve
m_curve.setSamples(plotData.at(m_index));
m_plot.replot();
// Replot graph
if (isEnabled())
m_plot.replot();
}
}