mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
added function to MixerCurveWidget to update an existing curve from code without deleting the existing one.
Using the initCurve function to update a widget that had a slot connected to its curveUpdated signal caused the app to crash. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2045 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
9b22bb07e6
commit
beda5965bf
@ -139,6 +139,31 @@ QList<double> MixerCurveWidget::getCurve() {
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
Setd the current curve settings
|
||||
*/
|
||||
void MixerCurveWidget::setCurve(QList<double> points)
|
||||
{
|
||||
if (nodeList.length()<1)
|
||||
{
|
||||
initCurve(points);
|
||||
}
|
||||
else
|
||||
{
|
||||
qreal w = plot->boundingRect().width()/(points.length()-1);
|
||||
qreal h = plot->boundingRect().height();
|
||||
for (int i=0; i<points.length(); i++) {
|
||||
double val = points.at(i);
|
||||
if (val>1)
|
||||
val=1;
|
||||
if (val<0)
|
||||
val=0;
|
||||
nodeList.at(i)->setPos(w*i,h-val*h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MixerCurveWidget::showEvent(QShowEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
|
@ -45,6 +45,7 @@ public:
|
||||
void itemMoved(double itemValue); // Callback when a point is moved, to be updated
|
||||
void initCurve (QList<double> points);
|
||||
QList<double> getCurve();
|
||||
void setCurve(QList<double>);
|
||||
|
||||
signals:
|
||||
void curveUpdated(QList<double>, double );
|
||||
|
Loading…
x
Reference in New Issue
Block a user