eric7/IconEditor/IconEditorGrid.py

branch
eric7
changeset 8318
962bce857696
parent 8312
800c432b34c8
child 8353
799196d0b05d
--- a/eric7/IconEditor/IconEditorGrid.py	Sun May 16 11:43:59 2021 +0200
+++ b/eric7/IconEditor/IconEditorGrid.py	Sun May 16 20:07:24 2021 +0200
@@ -9,13 +9,12 @@
 
 import os
 
-from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QPoint, QRect, QSize
-from PyQt5.QtGui import (
-    QImage, QColor, QPixmap, qRgba, QPainter, QCursor, QBrush, qGray, qAlpha
+from PyQt6.QtCore import pyqtSignal, pyqtSlot, Qt, QPoint, QRect, QSize
+from PyQt6.QtGui import (
+    QImage, QColor, QPixmap, qRgba, QPainter, QCursor, QBrush, qGray, qAlpha,
+    QUndoCommand, QUndoStack
 )
-from PyQt5.QtWidgets import (
-    QUndoCommand, QWidget, QSizePolicy, QUndoStack, QApplication, QDialog
-)
+from PyQt6.QtWidgets import QWidget, QSizePolicy, QApplication, QDialog
 
 from E5Gui import E5MessageBox
 
@@ -486,19 +485,19 @@
             if self.__curTool == self.Pencil:
                 cmd = IconEditCommand(self, self.__undoTexts[self.__curTool],
                                       self.__image)
-                self.__setImagePixel(evt.pos(), True)
+                self.__setImagePixel(evt.position().toPoint(), True)
                 self.setDirty(True)
                 self.__undoStack.push(cmd)
                 self.__currentUndoCmd = cmd
             elif self.__curTool == self.Rubber:
                 cmd = IconEditCommand(self, self.__undoTexts[self.__curTool],
                                       self.__image)
-                self.__setImagePixel(evt.pos(), False)
+                self.__setImagePixel(evt.position().toPoint(), False)
                 self.setDirty(True)
                 self.__undoStack.push(cmd)
                 self.__currentUndoCmd = cmd
             elif self.__curTool == self.Fill:
-                i, j = self.__imageCoordinates(evt.pos())
+                i, j = self.__imageCoordinates(evt.position().toPoint())
                 col = QColor()
                 col.setRgba(self.__image.pixel(i, j))
                 cmd = IconEditCommand(self, self.__undoTexts[self.__curTool],
@@ -508,14 +507,14 @@
                 self.__undoStack.push(cmd)
                 cmd.setAfterImage(self.__image)
             elif self.__curTool == self.ColorPicker:
-                i, j = self.__imageCoordinates(evt.pos())
+                i, j = self.__imageCoordinates(evt.position().toPoint())
                 col = QColor()
                 col.setRgba(self.__image.pixel(i, j))
                 self.setPenColor(col)
             else:
                 self.__unMark()
-                self.__startPos = evt.pos()
-                self.__endPos = evt.pos()
+                self.__startPos = evt.position().toPoint()
+                self.__endPos = evt.position().toPoint()
     
     def mouseMoveEvent(self, evt):
         """
@@ -523,26 +522,26 @@
         
         @param evt reference to the mouse event object (QMouseEvent)
         """
-        self.positionChanged.emit(*self.__imageCoordinates(evt.pos()))
+        self.positionChanged.emit(*self.__imageCoordinates(evt.position().toPoint()))
         
         if (
             self.__isPasting and
             not (evt.buttons() & Qt.MouseButton.LeftButton)
         ):
-            self.__drawPasteRect(evt.pos())
+            self.__drawPasteRect(evt.position().toPoint())
             return
         
         if evt.buttons() & Qt.MouseButton.LeftButton:
             if self.__curTool == self.Pencil:
-                self.__setImagePixel(evt.pos(), True)
+                self.__setImagePixel(evt.position().toPoint(), True)
                 self.setDirty(True)
             elif self.__curTool == self.Rubber:
-                self.__setImagePixel(evt.pos(), False)
+                self.__setImagePixel(evt.position().toPoint(), False)
                 self.setDirty(True)
             elif self.__curTool in [self.Fill, self.ColorPicker]:
                 pass    # do nothing
             else:
-                self.__drawTool(evt.pos(), True)
+                self.__drawTool(evt.position().toPoint(), True)
     
     def mouseReleaseEvent(self, evt):
         """
@@ -564,7 +563,7 @@
                                       self.CircleSelection]:
                 cmd = IconEditCommand(self, self.__undoTexts[self.__curTool],
                                       self.__image)
-                if self.__drawTool(evt.pos(), False):
+                if self.__drawTool(evt.position().toPoint(), False):
                     self.__undoStack.push(cmd)
                     cmd.setAfterImage(self.__image)
                     self.setDirty(True)

eric ide

mercurial