eric6/Snapshot/SnapshotFreehandGrabber.py

branch
without_py2_and_pyqt4
changeset 7198
684261ef2165
parent 6942
2602857055c5
child 7229
53054eb5b15a
equal deleted inserted replaced
7197:331569d44b19 7198:684261ef2165
11 11
12 from PyQt5.QtCore import pyqtSignal, Qt, QRect, QPoint, QTimer, QLocale 12 from PyQt5.QtCore import pyqtSignal, Qt, QRect, QPoint, QTimer, QLocale
13 from PyQt5.QtGui import QPixmap, QColor, QRegion, QPainter, QPalette, \ 13 from PyQt5.QtGui import QPixmap, QColor, QRegion, QPainter, QPalette, \
14 QPolygon, QPen, QBrush, QPaintEngine 14 QPolygon, QPen, QBrush, QPaintEngine
15 from PyQt5.QtWidgets import QWidget, QApplication, QToolTip 15 from PyQt5.QtWidgets import QWidget, QApplication, QToolTip
16
17 from Globals import qVersionTuple
18 16
19 17
20 def drawPolygon(painter, polygon, outline, fill=None): 18 def drawPolygon(painter, polygon, outline, fill=None):
21 """ 19 """
22 Module function to draw a polygon with the given parameters. 20 Module function to draw a polygon with the given parameters.
85 Private slot to initialize the rest of the widget. 83 Private slot to initialize the rest of the widget.
86 """ 84 """
87 self.__desktop = QApplication.desktop() 85 self.__desktop = QApplication.desktop()
88 x = self.__desktop.x() 86 x = self.__desktop.x()
89 y = self.__desktop.y() 87 y = self.__desktop.y()
90 if qVersionTuple() >= (5, 0, 0): 88 self.__pixmap = QApplication.screens()[0].grabWindow(
91 self.__pixmap = QApplication.screens()[0].grabWindow( 89 self.__desktop.winId(), x, y,
92 self.__desktop.winId(), x, y, 90 self.__desktop.width(), self.__desktop.height())
93 self.__desktop.width(), self.__desktop.height())
94 else:
95 self.__pixmap = QPixmap.grabWindow(
96 self.__desktop.winId(), x, y,
97 self.__desktop.width(), self.__desktop.height())
98 self.resize(self.__pixmap.size()) 91 self.resize(self.__pixmap.size())
99 self.move(x, y) 92 self.move(x, y)
100 self.setCursor(Qt.CrossCursor) 93 self.setCursor(Qt.CrossCursor)
101 self.show() 94 self.show()
102 95

eric ide

mercurial