title: QPainter::drawLine and QPainter::drawText with different color issue in Qt
body: <p>I am facing problem for drawing line and text with different color using QPainter. I am using the following piece of code to achieve this but it's not working. Both lines and texts are drawn using the color set for drawing Text.</p>
  
  <pre><code>void MyWidget::drawHorLinesWithText(QPainter &amp; painter, const QRect &amp; rect)
  {  
      for(int i=0; i &lt; 5; i++)
      {
          QPen penHLines(QColor("#0e5a77"), 1, Qt::DotLine, Qt::FlatCap, Qt::RoundJoin);
          painter.setPen(penHLines);
          painter.drawLine(10, 50 - (5*(i+1)), 200, 50 - (5*(i+1)));
  
          QString strNumber = QString::number((2)*(i+1));
  
          painter.setFont(QFont("Arial", 8, QFont::Bold));
          //QBrush brush(QColor("#00e0fc"));
          //painter.setBrush(brush);
          QPen penHText(QColor("#00e0fc"));//Here lines are also drawn using this color
          painter.setPen(penHText);
          painter.drawText(5, 50 - (5*(i+1)) - 10), 20, 30, Qt::AlignHCenter | Qt::AlignVCenter,
                           strNumber);
      }
  }
  </code></pre>
  
  <p>How would I set different colors for drawing lines and Texts. Any suggestions. Thanks. </p>