Fixed GaugeArc
authorKate Alhola <kate.alhola@gmail.com>
Sat, 1 Sep 2012 10:23:35 +0000 (13:23 +0300)
committerKate Alhola <kate.alhola@gmail.com>
Sat, 1 Sep 2012 10:23:35 +0000 (13:23 +0300)
mardrone/gauges/gaugearc.cpp

index 5227aff..5326be3 100644 (file)
@@ -43,7 +43,7 @@ void GaugeArc::paintArcScale(QPainter *painter,int width,int height)
     QBrush backBrush(m_backColor);
    // QBrush cbrush(m_color);
     painter->setBrush(cbrush);
     QBrush backBrush(m_backColor);
    // QBrush cbrush(m_color);
     painter->setBrush(cbrush);
-    alpha=m_lowPosition;
+    alpha=0;
     int val=m_low;
     painter->setFont(m_font);
     QFontMetrics fm(m_font);
     int val=m_low;
     painter->setFont(m_font);
     QFontMetrics fm(m_font);
@@ -55,15 +55,17 @@ void GaugeArc::paintArcScale(QPainter *painter,int width,int height)
     painter->drawChord(QRect(-xo,-xo,2*xo,2*xo),0,360*16);
     painter->setBrush(cbrush);
     painter->setPen(pen);
     painter->drawChord(QRect(-xo,-xo,2*xo,2*xo),0,360*16);
     painter->setBrush(cbrush);
     painter->setPen(pen);
-    while(alpha<=(m_highPosition<m_lowPosition?m_highPosition+360:m_highPosition)) {
+    painter->setTransform(QTransform().rotate(m_lowPosition),true);
+    painter->drawArc(-arcsize,-arcsize,2*arcsize,2*arcsize,(int(270)%360)*-16,(int(m_highPosition)%360)*-16);
+    while(alpha<=m_highPosition) {
         QTransform rotT;
         QTransform rotT;
-        rotT.rotate(alpha);
+        rotT.rotate(alpha+m_lowPosition);
         QString label;
         label=QString("%1").arg(val);
         int labelWidth=fm.width(label);
         int labelHeight=fm.height();
         painter->setTransform(savematrix);
         QString label;
         label=QString("%1").arg(val);
         int labelWidth=fm.width(label);
         int labelHeight=fm.height();
         painter->setTransform(savematrix);
-        painter->drawArc(-arcsize,-arcsize,2*arcsize,2*arcsize,(int(m_lowPosition+270)%360)*-16,(int(m_highPosition+270)%360)*-16);
+
         QPoint labelP=QPoint(0,-xo+15);
         labelP=rotT.map(labelP);
         QPoint lineInP=QPoint(0,-xo+2);
         QPoint labelP=QPoint(0,-xo+15);
         labelP=rotT.map(labelP);
         QPoint lineInP=QPoint(0,-xo+2);