Commit 5ffe4bb5 authored by Frédéric Larue's avatar Frédéric Larue
Browse files

FunctionGraphWidget display now modified when disabled.

parent 322efecf
...@@ -48,6 +48,8 @@ void FunctionGraphWidget::paintEvent( QPaintEvent *evt ) ...@@ -48,6 +48,8 @@ void FunctionGraphWidget::paintEvent( QPaintEvent *evt )
{ {
if( !m_FuncValues.empty() ) if( !m_FuncValues.empty() )
{ {
QColor color = this->palette().windowText().color();
QPolygonF polyPoints( m_FuncValues.size()+2 ); QPolygonF polyPoints( m_FuncValues.size()+2 );
for( int i=0; i<m_FuncValues.size(); ++i ) for( int i=0; i<m_FuncValues.size(); ++i )
{ {
...@@ -66,6 +68,7 @@ void FunctionGraphWidget::paintEvent( QPaintEvent *evt ) ...@@ -66,6 +68,7 @@ void FunctionGraphWidget::paintEvent( QPaintEvent *evt )
painter.begin( this ); painter.begin( this );
// Background grid. // Background grid.
painter.setOpacity( 0.1f ); painter.setOpacity( 0.1f );
painter.setPen( QPen(QBrush(color),1.0f) );
for( int i=0; i<4; ++i ) for( int i=0; i<4; ++i )
{ {
float y = 0.25f*i * (height()-1); float y = 0.25f*i * (height()-1);
...@@ -76,15 +79,15 @@ void FunctionGraphWidget::paintEvent( QPaintEvent *evt ) ...@@ -76,15 +79,15 @@ void FunctionGraphWidget::paintEvent( QPaintEvent *evt )
// Function curve. // Function curve.
painter.setOpacity( 0.1f ); painter.setOpacity( 0.1f );
painter.fillPath( polyPath, QBrush(QColor("black")) ); painter.fillPath( polyPath, QBrush(color) );
painter.setOpacity( 0.5f ); painter.setOpacity( 0.5f );
painter.setPen( QPen(QBrush(QColor("black")),1.0f) ); painter.setPen( QPen(QBrush(color),1.0f) );
painter.drawPolyline( &polyPoints[0], m_FuncValues.size() ); painter.drawPolyline( &polyPoints[0], m_FuncValues.size() );
// Axis. // Axis.
painter.setOpacity( 1.0f ); painter.setOpacity( 1.0f );
painter.setPen( QPen(QBrush(QColor("black")),1.0f) ); painter.setPen( QPen(QBrush(color),1.0f) );
painter.drawLine( 0, 0, 0, height()-1 ); painter.drawLine( 0, 0, 0, height()-1 );
painter.drawLine( 0, height()-1, width()-1, height()-1 ); painter.drawLine( 0, height()-1, width()-1, height()-1 );
...@@ -101,7 +104,7 @@ void FunctionGraphWidget::paintEvent( QPaintEvent *evt ) ...@@ -101,7 +104,7 @@ void FunctionGraphWidget::paintEvent( QPaintEvent *evt )
QFontMetrics fm( font() ); QFontMetrics fm( font() );
int labelW = fm.width( m_Label ); int labelW = fm.width( m_Label );
painter.setPen( QPen(QBrush(QColor("black")),1.0f) ); painter.setPen( QPen(QBrush(color),1.0f) );
painter.drawText( (width()-labelW)>>1, 2+fm.height(), m_Label ); painter.drawText( (width()-labelW)>>1, 2+fm.height(), m_Label );
painter.end(); painter.end();
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment