Hi,

I want to create a flat progress bar with QPainter, I paint graphics with the fallowing code:

Qt Code:
  1. QPainter painter(this);
  2.  
  3. // Bar Background
  4. painter.setBrush(QBrush(Qt::white));
  5. painter.setPen(Qt::NoPen);
  6. painter.drawRect(0, 0, m_width, this->height());
  7.  
  8. // Bar Value
  9. painter.setBrush(QBrush(m_fillColor));
  10.  
  11. if (m_value == 0)
  12. {
  13. return;
  14. }
  15.  
  16. qDebug() << "Value: " << m_value;
  17. qDebug() << "Height: " << this->height();
  18.  
  19. int heightValue = (this->height() / m_value);
  20.  
  21. qDebug() << "HValue: " << heightValue;
  22.  
  23. painter.drawRect(0, 0, m_width, heightValue);
To copy to clipboard, switch view to plain text mode 

But I tried some calculation for set the height of the progress bar with the progress bar value but nothing works...