93def customMouseMoveEvent(self, event):
94 if event.modifiers() != Qt.KeyboardModifier.ShiftModifier and event.modifiers() != Qt.KeyboardModifier.AltModifier:
95 self.PREVIOUS_DRAG_X = None
96 return
97
98
99 if self.PREVIOUS_DRAG_X and event.modifiers() == Qt.KeyboardModifier.AltModifier:
100 if self.PREVIOUS_DRAG_X < event.x() - DRAG_DELTA:
101 self.SIGNAL_WUP.emit(0)
102 self.PREVIOUS_DRAG_X = event.x()
103 elif self.PREVIOUS_DRAG_X > event.x() + DRAG_DELTA:
104 self.SIGNAL_WDN.emit(0)
105 self.PREVIOUS_DRAG_X = event.x()
106
107 return
108
109
110 mimedata = QMimeData()
111 url = QUrl().fromLocalFile(self.path)
112 mimedata.setUrls([url])
113
114
116
117
118 if doc is None:
119 return
120
121 scale = self.scale / 100
122
123
124 if self.fitCanvasChecked and not doc is None:
125 fullImage = QImage(self.path).scaled(doc.width() * scale, doc.height() * scale, Qt.AspectRatioMode.KeepAspectRatio, Qt.TransformationMode.SmoothTransformation)
126 else:
127 fullImage = QImage(self.path)
128
129 fullImage = fullImage.scaled(fullImage.width() * scale, fullImage.height() * scale, Qt.AspectRatioMode.KeepAspectRatio, Qt.TransformationMode.SmoothTransformation)
130
131 fullPixmap = QPixmap(50, 50).fromImage(fullImage)
132 mimedata.setImageData(fullPixmap)
133
134
135 QApplication.clipboard().setImage(self.qimage)
136
137
138 drag = QDrag(self)
139 drag.setMimeData(mimedata)
140 drag.setPixmap(self.pixmap)
141 drag.setHotSpot(QPoint(self.qimage.width() / 2, self.qimage.height() / 2))
142 drag.exec(Qt.DropAction.CopyAction)
143
static Krita * instance()
instance retrieve the singleton instance of the Application object.