def set_viewer(self, container, factory): QGuiApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) viewer = factory(container) self.replaceWidget(1, viewer) self.viewer = viewer self.__balance() QGuiApplication.restoreOverrideCursor()
def startProgress(self, message): """Shows that the window is busy doing some work.""" self.translateButton.setEnabled(False) self.dictsCombo.setEnabled(False) label = QLabel(message) label.setAlignment(Qt.AlignHCenter) progressBar = QProgressBar() progressBar.setRange(0, 0) self.statusBar().clearMessage() self.statusBar().addWidget(label, 1) self.statusBar().addWidget(progressBar, 1) QGuiApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
def __start_panning_view(self, view: "QGraphicsView", event: "QMouseEvent"): """Responds to the event of start panning the view. Changes the mouse icon to a dragging hand, and saves the last clicked position. This is used for calculating the mouse displacement. Args: view: The QGraphicsView object to pan. event: Mouse event. """ QGuiApplication.setOverrideCursor(Qt.ClosedHandCursor) self.__panning_start_x = event.x() self.__panning_start_y = event.y() self.__state = self.State.Panning
logger = logging.getLogger(__name__) logger.debug("Geo sources: %s" % QGeoPositionInfoSource.availableSources()) QGuiApplication.setAttribute(Qt.AA_DisableHighDpiScaling) QGuiApplication.setAttribute(Qt.AA_Use96Dpi) QGuiApplication.setAttribute(Qt.AA_ShareOpenGLContexts) # Create the application instance. app = QGuiApplication(sys.argv) loop = QEventLoop(app) asyncio.set_event_loop(loop) touchscreens = list( filter(lambda d: d.type() == QTouchDevice.TouchScreen, QTouchDevice.devices())) if touchscreens: logger.info("touchscreens detected, disabling mouse %s" % touchscreens) app.setOverrideCursor(QCursor(Qt.BlankCursor)) # Create a QML engine. engine = QQmlApplicationEngine() engine.load('./ui/main.qml') win = engine.rootObjects()[0] win.show() with loop: ## context manager calls .close() when loop completes, and releases all resources sys.exit(loop.run_forever())