'Resize to a reasonable size.'

def adjustSize(self):

    self.__textItem.setTextWidth((-1))
    self.__textItem.adjustSize()
    size = self.__textItem.boundingRect().size()
    (left, top, right, bottom) = self.textMargins()
    geom = QRectF(self.pos(), (size + QSizeF((left + right), (top + bottom))))
    self.setGeometry(geom)
