def draw(self, event): p = QtGui.QPainter() p.begin(self.ui.widget) pen = QtGui.QPen(QtGui.QColor(0, 255, 255), 3, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin) rect = self.myRect p.setPen(pen) p.setRenderHint(QtGui.QPainter.Antialiasing) #p.drawEllipse(rect) p.drawLine(self.vLine) p.drawLine(self.hLine) p.end()
def __init__(self, parent=None): super(ScribbleArea, self).__init__(parent) self.setAttribute(QtCore.Qt.WA_StaticContents) self.modified = False self.scribbling = False imageSize = QtCore.QSize(500, 500) self.image = QtGui.QImage(imageSize, QtGui.QImage.Format_RGB16) self.userimage = None self.painter = QtGui.QPainter() self.lastPoint = QtCore.QPoint() self.pen = QtGui.QPen()
def __init__(self, nom): QtWidgets.QMainWindow.__init__(self) self.ui = Ui_graphicsWindow() self.ui.setupUi(self, nom) self.ui.graphicsView.resizeEvent = self.gwResizeEvent self.currentRect = None self.myRect = QtCore.QRect() self.myPen = QtGui.QPen() self.rayon = 20 self.ui.widget.paintEvent = self.draw cursorPath = ":/Anaglyph/Icons/cursor3x3.png" cursorImage = QtGui.QImage(cursorPath) cursorPix = QtGui.QPixmap.fromImage(cursorImage) self.invisibleCursor = QtGui.QCursor(cursorPix) self.normalCursor = self.cursor()