def paintEvent(self, event): """Qt Override. Include a validation icon to the left of the line edit. """ super(IconLineEdit, self).paintEvent(event) painter = QPainter(self) rect = self.geometry() space = int((rect.height())/6) h = rect.height() - space w = rect.width() - h if self._icon_visible: if self._status and self._status_set: pixmap = self._set_icon.pixmap(h, h) elif self._status: pixmap = self._valid_icon.pixmap(h, h) else: pixmap = self._invalid_icon.pixmap(h, h) painter.drawPixmap(w, space, pixmap) application_style = QApplication.style().objectName() if self._application_style != application_style: self._application_style = application_style self._refresh() # Small hack to gurantee correct padding on Spyder start if self._paint_count < 5: self._paint_count += 1 self._refresh()
def paintEvent(self, event): """Qt Override. Include a validation icon to the left of the line edit. """ super(IconLineEdit, self).paintEvent(event) painter = QPainter(self) rect = self.geometry() space = int((rect.height()) / 6) h = rect.height() - space w = rect.width() - h if self._icon_visible: if self._status and self._status_set: pixmap = self._set_icon.pixmap(h, h) elif self._status: pixmap = self._valid_icon.pixmap(h, h) else: pixmap = self._invalid_icon.pixmap(h, h) painter.drawPixmap(w, space, pixmap) application_style = QApplication.style().objectName() if self._application_style != application_style: self._application_style = application_style self._refresh() # Small hack to gurantee correct padding on Spyder start if self._paint_count < 5: self._paint_count += 1 self._refresh()