Hi all<br><br>I am having new issues with that Rich Text Push Button and I tried everything but so far I have not succeed.<br><br>I wan my push button to have the icon and the text aligned left. I know how to change the text position since is in the reimplementation of the paintEvent. I just change that little bit.<br>


I should also change the sizeHint but I will come to that latter.<br><br>The thing is that I don't know how to align the icon. I know I should change something related to this line:<br>p.drawControl(QtGui.QStyle.CE_PushButton, self.getStyleOption())<br>


<br>but I don't know what. I've read the Qt documentation but I am more confused that before.<br><br>Any help, hint, whatever would be much appreciated!<br><br>Best Regards<br><br>    def paintEvent(self, event):<br>

<br>        p = QtGui.QStylePainter(self)<br>        buttonRect = QtCore.QRect(self.rect())<br><br>        richTextLabel = QtGui.QTextDocument()<br>
        richTextLabel.setHtml(self._htmlText)<br><br>        richTextPixmap = QtGui.QPixmap(richTextLabel.size().width(),<br>                                 richTextLabel.size().height())<br>        richTextPixmap.fill(QtCore.Qt.transparent)<br>


        richTextPainter = QtGui.QPainter(richTextPixmap)<br>        richTextLabel.drawContents(richTextPainter,<br>                                   QtCore.QRectF(richTextPixmap.rect()))<br><br>        richTextPainter.end()<br>


<br>        if not self.icon().isNull():<br>            point = QtCore.QPoint(buttonRect.x() +<br>                           self.iconSize().width() + RPushButton.SIZEADJ,<br>                           buttonRect.y() + buttonRect.height() / 2);<br>


        else:<br>            point = QtCore.QPoint(buttonRect.x(),<br>                           buttonRect.y() + buttonRect.height() / 2);<br><br>        buttonRect.translate(point.x() +<br>                             RPushButton.SIZEADJ,<br>


                             point.y() - richTextPixmap.height() / 2);<br><br>        p.drawControl(QtGui.QStyle.CE_PushButton, self.getStyleOption())<br>        p.drawPixmap(buttonRect.left(), buttonRect.top(),<br>                     richTextPixmap.width(), richTextPixmap.height(),<br>


                     richTextPixmap);<br>