def setPixmap(self, pixmap): self.setAttribute(Qt.WA_TranslucentBackground, pixmap.hasAlpha() and \ is_transparency_supported()) self.__pixmap = pixmap QSplashScreen.setPixmap(self, pixmap) if pixmap.hasAlpha() and not is_transparency_supported(): self.setMask(pixmap.createHeuristicMask())
def showMessage(self, message, alignment=Qt.AlignLeft, color=Qt.black): """ Show the `message` with `color` and `alignment`. """ # Need to store all this arguments for drawContents (no access # methods) self.__alignment = alignment self.__color = color self.__message = message QSplashScreen.showMessage(self, message, alignment, color) QApplication.instance().processEvents()
def __init__(self, parent=None, pixmap=None, textRect=None, textFormat=Qt.PlainText, **kwargs): QSplashScreen.__init__(self, parent, **kwargs) self.__textRect = textRect self.__message = "" self.__color = Qt.black self.__alignment = Qt.AlignLeft self.__textFormat = textFormat if pixmap is None: pixmap = QPixmap() self.setPixmap(pixmap) self.setAutoFillBackground(False) # Also set FramelesWindowHint (if not already set) self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint)
def event(self, event): if event.type() == event.Paint: pixmap = self.__pixmap painter = QPainter(self) if not pixmap.isNull(): painter.drawPixmap(0, 0, pixmap) self.drawContents(painter) return True return QSplashScreen.event(self, event)
def showEvent(self, event): QSplashScreen.showEvent(self, event) # Raise to top on show. self.raise_()