mirror of
https://github.com/Serial-Studio/Serial-Studio.git
synced 2025-01-31 17:42:55 +08:00
Fix QSS() implementation & try to avoid crash on a crappy laptop running OpenSUSE
This commit is contained in:
parent
a5d0593b21
commit
c6e7cd2e80
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user