Snapshot/SnapshotRegionGrabber.py

changeset 5736
000ea446ff4b
parent 5664
9b318fcb1ee2
child 5978
cf64d523f233
equal deleted inserted replaced
5735:f606dbe20be6 5736:000ea446ff4b
7 Module implementing a grabber widget for a rectangular snapshot region. 7 Module implementing a grabber widget for a rectangular snapshot region.
8 """ 8 """
9 9
10 from __future__ import unicode_literals 10 from __future__ import unicode_literals
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 qVersion
14 from PyQt5.QtGui import QPixmap, QColor, QRegion, QPainter, QPalette, \ 13 from PyQt5.QtGui import QPixmap, QColor, QRegion, QPainter, QPalette, \
15 QPaintEngine, QPen, QBrush 14 QPaintEngine, QPen, QBrush
16 from PyQt5.QtWidgets import QWidget, QApplication, QToolTip 15 from PyQt5.QtWidgets import QWidget, QApplication, QToolTip
16
17 from Globals import qVersionTuple
17 18
18 19
19 def drawRect(painter, rect, outline, fill=None): 20 def drawRect(painter, rect, outline, fill=None):
20 """ 21 """
21 Module function to draw a rectangle with the given parameters. 22 Module function to draw a rectangle with the given parameters.
112 Private slot to initialize the rest of the widget. 113 Private slot to initialize the rest of the widget.
113 """ 114 """
114 self.__desktop = QApplication.desktop() 115 self.__desktop = QApplication.desktop()
115 x = self.__desktop.x() 116 x = self.__desktop.x()
116 y = self.__desktop.y() 117 y = self.__desktop.y()
117 if qVersion() >= "5.0.0": 118 if qVersionTuple() >= (5, 0, 0):
118 self.__pixmap = QApplication.screens()[0].grabWindow( 119 self.__pixmap = QApplication.screens()[0].grabWindow(
119 self.__desktop.winId(), x, y, 120 self.__desktop.winId(), x, y,
120 self.__desktop.width(), self.__desktop.height()) 121 self.__desktop.width(), self.__desktop.height())
121 else: 122 else:
122 self.__pixmap = QPixmap.grabWindow( 123 self.__pixmap = QPixmap.grabWindow(

eric ide

mercurial