Exemplo n.º 1
0
    def get_scale(self):
        # tricks to solve the hidpi impact on QCursor.pos()
        # screen = QGuiApplication.screenAt(QCursor.pos())
        # scale = self.screenPixel.width() // screen.geometry().width()

        screen = QApplication.primaryScreen().virtualGeometry()
        scale = self.screenPixel.width() // screen.width()
        return scale
Exemplo n.º 2
0
    def getscreenshot(self):
        # screen = QGuiApplication.screenAt(QApplication.desktop().cursor().pos())
        # self.screenPixel = screen.grabWindow(0)

        # dw = QtWidgets.QApplication.desktop()
        # self.screenPixel = QPixmap.grabWindow( dw.winId(), 0, 0, dw.width(), dw.height() )

        screenGeometry = QApplication.primaryScreen().virtualGeometry()
        try:
            self.screenPixel = QApplication.primaryScreen().grabWindow(
                QApplication.desktop().winId(), screenGeometry.x(),
                screenGeometry.y(), screenGeometry.width(),
                screenGeometry.height())
        except:
            self.screenPixel = QApplication.primaryScreen().grabWindow(
                int(QApplication.desktop().winId()), screenGeometry.x(),
                screenGeometry.y(), screenGeometry.width(),
                screenGeometry.height())
Exemplo n.º 3
0
    def _show(self):
        # self._screen = QApplication.desktop().screenNumber(QApplication.desktop().cursor().pos())

        self.getscreenshot()

        self.show()

        self.setScene(self.graphicsScene)

        # self.windowHandle().setScreen(QGuiApplication.screenAt(QCursor.pos()))

        self.scale = self.get_scale()

        # self.setGeometry(QGuiApplication.screenAt(QCursor.pos()).geometry())

        screenGeometry = QApplication.primaryScreen().virtualGeometry()
        self.setGeometry(screenGeometry.x(), screenGeometry.y(),
                         screenGeometry.width(), screenGeometry.height())

        # self.showFullScreen()

        self.redraw()