mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-04-13 12:42:20 +00:00
Restore colored zones code to QWT curve
This fragment was missing from #4497 Also commented not used features from qwtconfig.pri.in to reduce ci build time. Fixes #4639
This commit is contained in:
@@ -137,7 +137,7 @@ win32 {
|
|||||||
# Otherwise you have to build them from the examples directory.
|
# Otherwise you have to build them from the examples directory.
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
QWT_CONFIG += QwtExamples
|
#QWT_CONFIG += QwtExamples
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
# The playground is primarily intended for the Qwt development
|
# The playground is primarily intended for the Qwt development
|
||||||
@@ -148,14 +148,14 @@ QWT_CONFIG += QwtExamples
|
|||||||
# Otherwise you have to build them from the playground directory.
|
# Otherwise you have to build them from the playground directory.
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
QWT_CONFIG += QwtPlayground
|
#QWT_CONFIG += QwtPlayground
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
# If you want to auto build the tests, enable the line below
|
# If you want to auto build the tests, enable the line below
|
||||||
# Otherwise you have to build them from the tests directory.
|
# Otherwise you have to build them from the tests directory.
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
QWT_CONFIG += QwtTests
|
#QWT_CONFIG += QwtTests
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
# When Qt has been built as framework qmake wants
|
# When Qt has been built as framework qmake wants
|
||||||
|
|||||||
@@ -902,6 +902,8 @@ void QwtPlotCurve::fillCurve( QPainter* painter,
|
|||||||
if ( polygon.count() <= 2 ) // a line can't be filled
|
if ( polygon.count() <= 2 ) // a line can't be filled
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
double avg=(yMap.invTransform(polygon[0].y())+yMap.invTransform(polygon[1].y())) / 2.00;
|
||||||
|
|
||||||
QBrush brush = m_data->brush;
|
QBrush brush = m_data->brush;
|
||||||
if ( !brush.color().isValid() )
|
if ( !brush.color().isValid() )
|
||||||
brush.setColor( m_data->pen.color() );
|
brush.setColor( m_data->pen.color() );
|
||||||
@@ -917,6 +919,27 @@ void QwtPlotCurve::fillCurve( QPainter* painter,
|
|||||||
painter->setPen( Qt::NoPen );
|
painter->setPen( Qt::NoPen );
|
||||||
painter->setBrush( brush );
|
painter->setBrush( brush );
|
||||||
|
|
||||||
|
// if we have zones we need to process the polygon point by point...
|
||||||
|
if (m_data->zones.count()>0 && polygon.count() == 4) {
|
||||||
|
|
||||||
|
// we need to set color based upon zone
|
||||||
|
double alpha = m_data->brush.color().alphaF();
|
||||||
|
QColor color = m_data->brush.color();
|
||||||
|
|
||||||
|
if (avg < 1) color=Qt::black;
|
||||||
|
else {
|
||||||
|
for(int i=0; i<m_data->zones.count(); i++) {
|
||||||
|
if (avg < m_data->zones[i].lim) {
|
||||||
|
color = m_data->zones[i].color;
|
||||||
|
color.setAlphaF(alpha);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
brush.setColor(color);
|
||||||
|
painter->setBrush(brush);
|
||||||
|
}
|
||||||
|
|
||||||
QwtPainter::drawPolygon( painter, polygon );
|
QwtPainter::drawPolygon( painter, polygon );
|
||||||
|
|
||||||
painter->restore();
|
painter->restore();
|
||||||
|
|||||||
Reference in New Issue
Block a user