1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

Bugfix for dials text and minimum range.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2321 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
edouard 2011-01-02 15:11:37 +00:00 committed by edouard
parent 0e43a0af5b
commit 6091f0be63

View File

@ -271,6 +271,10 @@ void DialGadgetWidget::setDialFile(QString dfn, QString bg, QString fg, QString
if (m_renderer->elementExists(fg)) {
m_foreground->setSharedRenderer(m_renderer);
m_foreground->setElementId(fg);
// Center it on the scene
QRectF rectB = m_background->boundingRect();
QRectF rectF = m_foreground->boundingRect();
m_foreground->setPos(rectB.width()/2-rectF.width()/2,rectB.height()/2-rectF.height()/2);
//l_scene->addItem(m_foreground);
fgenabled = true;
}
@ -447,13 +451,13 @@ void DialGadgetWidget::setDialFont(QString fontProps)
// this enables smooth rotation in rotateNeedles below
void DialGadgetWidget::setNeedle1(double value) {
if (rotateN1) {
needle1Target = 360*value*n1Factor/(n1MaxValue-n1MinValue);
needle1Target = 360*(value*n1Factor-n1MinValue)/(n1MaxValue-n1MinValue);
}
if (horizN1) {
needle1Target = value*n1Factor/(n1MaxValue-n1MinValue);
needle1Target = (value*n1Factor-n1MinValue)/(n1MaxValue-n1MinValue);
}
if (vertN1) {
needle1Target = value*n1Factor/(n1MaxValue-n1MinValue);
needle1Target = (value*n1Factor-n1MinValue)/(n1MaxValue-n1MinValue);
}
if (!dialTimer.isActive())
dialTimer.start();
@ -466,19 +470,19 @@ void DialGadgetWidget::setNeedle1(double value) {
void DialGadgetWidget::setNeedle2(double value) {
if (rotateN2) {
needle2Target = 360*value*n2Factor/(n2MaxValue-n2MinValue);
needle2Target = 360*(value*n2Factor-n2MinValue)/(n2MaxValue-n2MinValue);
}
if (horizN2) {
needle2Target = value*n2Factor/(n2MaxValue-n2MinValue);
needle2Target = (value*n2Factor-n2MinValue)/(n2MaxValue-n2MinValue);
}
if (vertN2) {
needle2Target = value*n2Factor/(n2MaxValue-n2MinValue);
needle2Target = (value*n2Factor-n2MinValue)/(n2MaxValue-n2MinValue);
}
if (!dialTimer.isActive())
dialTimer.start();
if (m_text2) {
QString s;
s.sprintf("%.2f",value*n1Factor);
s.sprintf("%.2f",value*n2Factor);
m_text2->setPlainText(s);
}
@ -486,19 +490,19 @@ void DialGadgetWidget::setNeedle2(double value) {
void DialGadgetWidget::setNeedle3(double value) {
if (rotateN3) {
needle3Target = 360*value*n3Factor/(n3MaxValue-n3MinValue);
needle3Target = 360*(value*n3Factor-n3MinValue)/(n3MaxValue-n3MinValue);
}
if (horizN3) {
needle3Target = value*n3Factor/(n3MaxValue-n3MinValue);
needle3Target = (value*n3Factor-n3MinValue)/(n3MaxValue-n3MinValue);
}
if (vertN3) {
needle3Target = value*n3Factor/(n3MaxValue-n3MinValue);
needle3Target = (value*n3Factor-n3MinValue)/(n3MaxValue-n3MinValue);
}
if (!dialTimer.isActive())
dialTimer.start();
if (m_text3) {
QString s;
s.sprintf("%.2f",value*n1Factor);
s.sprintf("%.2f",value*n3Factor);
m_text3->setPlainText(s);
}
}