48 |
48 |
49 def __init__(self): |
49 def __init__(self): |
50 """ |
50 """ |
51 Constructor |
51 Constructor |
52 """ |
52 """ |
53 super(SnapshotFreehandGrabber, self).__init__(None, |
53 super(SnapshotFreehandGrabber, self).__init__( |
|
54 None, |
54 Qt.X11BypassWindowManagerHint | Qt.WindowStaysOnTopHint | |
55 Qt.X11BypassWindowManagerHint | Qt.WindowStaysOnTopHint | |
55 Qt.FramelessWindowHint | Qt.Tool) |
56 Qt.FramelessWindowHint | Qt.Tool) |
56 |
57 |
57 self.__selection = QPolygon() |
58 self.__selection = QPolygon() |
58 self.__mouseDown = False |
59 self.__mouseDown = False |
85 if qVersion() >= "5.0.0": |
86 if qVersion() >= "5.0.0": |
86 self.__pixmap = QApplication.screens()[0].grabWindow( |
87 self.__pixmap = QApplication.screens()[0].grabWindow( |
87 self.__desktop.winId(), x, y, |
88 self.__desktop.winId(), x, y, |
88 self.__desktop.width(), self.__desktop.height()) |
89 self.__desktop.width(), self.__desktop.height()) |
89 else: |
90 else: |
90 self.__pixmap = QPixmap.grabWindow(self.__desktop.winId(), x, y, |
91 self.__pixmap = QPixmap.grabWindow( |
|
92 self.__desktop.winId(), x, y, |
91 self.__desktop.width(), self.__desktop.height()) |
93 self.__desktop.width(), self.__desktop.height()) |
92 self.resize(self.__pixmap.size()) |
94 self.resize(self.__pixmap.size()) |
93 self.move(x, y) |
95 self.move(x, y) |
94 self.setCursor(Qt.CrossCursor) |
96 self.setCursor(Qt.CrossCursor) |
95 self.show() |
97 self.show() |
146 Qt.TextWordWrap, self.__helpText).translated( |
148 Qt.TextWordWrap, self.__helpText).translated( |
147 -self.__desktop.x(), -self.__desktop.y()) |
149 -self.__desktop.x(), -self.__desktop.y()) |
148 self.__helpTextRect.adjust(-2, -2, 4, 2) |
150 self.__helpTextRect.adjust(-2, -2, 4, 2) |
149 drawPolygon(painter, self.__helpTextRect, textColor, |
151 drawPolygon(painter, self.__helpTextRect, textColor, |
150 textBackgroundColor) |
152 textBackgroundColor) |
151 painter.drawText(self.__helpTextRect.adjusted(3, 3, -3, -3), |
153 painter.drawText( |
|
154 self.__helpTextRect.adjusted(3, 3, -3, -3), |
152 Qt.TextWordWrap, self.__helpText) |
155 Qt.TextWordWrap, self.__helpText) |
153 |
156 |
154 if self.__selection.isEmpty(): |
157 if self.__selection.isEmpty(): |
155 return |
158 return |
156 |
159 |