def testFlagAccess(self): #QEvent.Type flags usage event = QEvent(QEvent.Timer) self.assertEqual(event.type(), QEvent.Timer) event = QEvent(QEvent.Close) self.assertEqual(event.type(), QEvent.Close) event = QEvent(QEvent.IconTextChange) self.assertEqual(event.type(), QEvent.IconTextChange)
def changeIcon(self, path): self.iconPath = path if os.path.isfile(self.iconPath): self.px = QPixmap(self.iconPath) self.px.scaled(self.iconResolution, self.iconResolution, Qt.KeepAspectRatio, Qt.SmoothTransformation) self.px_mask = self.px.createMaskFromColor(QColor('transparent')) self.event(QEvent(QEvent.Type.MouseButtonRelease)) self.update()
def update_stylesheet(widget): """ dirty hack to force style recalc needed to react to changing properties """ widget.style().unpolish(widget) widget.style().polish(widget) evt = QEvent(QEvent.StyleChange) QApplication.sendEvent(widget, evt) widget.update()
def on_crossing_event(self, wl_view, type_, local_x, local_y, window_x, window_y, screen_x, screen_y): if type_ == EventType.enter: event = QEnterEvent(QPointF(local_x, local_y), QPointF(window_x, window_y), QPointF(screen_x, screen_y)) else: event = QEvent(QEvent.Leave) self.renderer.sendEvent(event)
def headless_main(args): """ Executes a project using :class:`QCoreApplication`. Args: args (argparser.Namespace): parsed command line arguments. Returns: int: exit status code; 0 for success, everything else for failure """ application = QCoreApplication(sys.argv) startup_event_type = QEvent.Type(QEvent.registerEventType()) task = ExecuteProject(args, startup_event_type, application) application.postEvent(task, QEvent(startup_event_type)) return application.exec_()