1
0
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:
andrew 2010-10-31 05:54:10 +00:00 committed by andrew
parent 9b22bb07e6
commit beda5965bf
2 changed files with 26 additions and 0 deletions

View File

@ -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)

View File

@ -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 );