title: How to turn QLineEdit background into a Progress Bar
body: <p>The code creates a single dialog with <code>QLineEdit</code> and a <code>QPushButton</code>.
  When the button is clicked I would like the <code>QLineEdit</code> to turn into a progress bar that would show a progress of the process triggered with the push of the button. When the process is completed the <code>QLineEdit</code> should get back to its normal "LineEdit" look. How to achieve this?</p>
  
  <p><a href="https://i.stack.imgur.com/H1DiA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/H1DiA.png" alt="enter image description here"></a></p>
  
  <p>Here is the Photoshop-ed idea:</p>
  
  <p><a href="https://i.stack.imgur.com/EUbAh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EUbAh.png" alt="enter image description here"></a></p>
  
  <p>A progress bar could be a thin line at the bottom of QLineEdit:
  <a href="https://i.stack.imgur.com/Nk0HC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Nk0HC.png" alt="enter image description here"></a></p>
  
  <pre><code>from PyQt4 import QtCore, QtGui
  import time
  
  class Dialog(QtGui.QDialog):
      def __init__(self, parent=None):
          QtGui.QDialog .__init__(self, parent)
          mainLayout = QtGui.QVBoxLayout()
          lineEdit = QtGui.QLineEdit('ITEM 001')
          mainLayout.addWidget(lineEdit)
          button = QtGui.QPushButton('Push Button')
          button.clicked.connect(self.buttonClicked)
          mainLayout.addWidget(button)
          self.setLayout(mainLayout)
  
      def buttonClicked(self):
          print 'button clicked'
          for i in range(3):
              time.sleep(1)
              print '...processing %s'%i
  
  if __name__ == '__main__':
      app = QtGui.QApplication([])
      window = Dialog()
      window.resize(300, 50)
      window.show()
      app.exec_()
  </code></pre>