Ok thanks

this is solved my problem:
Qt Code:
  1. void MyLineEdit::paintEvent(QPaintEvent * event)
  2. {
  3. QPainter p(this);
  4. initStyleOption(&panel);
  5. style()->drawPrimitive(QStyle::PE_PanelLineEdit, &panel, &p, this);
  6.  
  7. if(hasFocus() || progress == 100) QLineEdit::paintEvent(event);
  8.  
  9. QPainter painter(this);
  10. initStyleOption(&lenap);
  11. QRect backgroundRect = style()->subElementRect(QStyle::SE_LineEditContents, &lenap, this);
  12.  
  13. if(!hasFocus() && progress < 100)
  14. {
  15. QColor loadingColor = QColor(116, 192, 250);
  16. painter.setBrush(generateGradient(loadingColor));
  17. painter.setPen(Qt::transparent);
  18. int mid = backgroundRect.width() / 100 * progress;
  19. QRect progressRect(backgroundRect.x(), backgroundRect.y(), mid, backgroundRect.height());
  20. painter.drawRect(progressRect);
  21.  
  22. painter.setPen(Qt::SolidLine);
  23. painter.drawText(backgroundRect,Qt::AlignLeft|Qt::AlignVCenter, " " + this->text());
  24. }
  25. }
To copy to clipboard, switch view to plain text mode