title: Painter Shape over QIcon in PySide
body: <p>How can I append a painted rectangle to a QIcon. The final returned result has to be a qicon because I'm using this on a control which expects a qicon.</p>
  
  <p><strong>Before</strong>:</p>
  
  <p><a href="https://i.stack.imgur.com/GKhxS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GKhxS.png" alt="enter image description here"></a></p>
  
  <p><strong>After</strong>:</p>
  
  <p><a href="https://i.stack.imgur.com/Qk079.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Qk079.png" alt="enter image description here"></a></p>
  
  <pre><code>import os, sys
  from PySide import QtCore, QtGui
  
  
  class Example(QtGui.QWidget):
  
      def __init__(self, *args, **kwargs):
          super(Example, self).__init__(*args, **kwargs)
          self.resize(600,400)
  
          self.btn = QtGui.QPushButton()
          self.btn.setFixedSize(128,128)
          icon = QtGui.QIcon('thumb.jpg')
          self.btn.setIconSize(icon.availableSizes()[0])
          self.btn.setIcon(icon)
  
          lay = QtGui.QVBoxLayout()
          lay.addWidget(self.btn)
          self.setLayout(lay)
  
  
  def main():
      app = QtGui.QApplication(sys.argv)
      ex = Example()
      ex.show()
      sys.exit(app.exec_())
  
  
  if __name__ == '__main__':
      main()
  </code></pre>