2 Copyright (C) 1997-2017 JDERobot Developers Team 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation; either version 2 of the License, or 7 (at your option) any later version. 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU Library General Public License for more details. 14 You should have received a copy of the GNU General Public License 15 along with this program; if not, see <http://www.gnu.org/licenses/>. 17 Authors : Okan Asik (asik.okan@gmail.com) 20 from PyQt5.QtWidgets
import QGraphicsRectItem
21 from PyQt5.QtGui
import QPen, QBrush, QPolygonF
22 from PyQt5.QtCore
import Qt
30 super(QGraphicsRectItem, self).
__init__(-SQUARE_SIDE / 2, -SQUARE_SIDE / 2, SQUARE_SIDE, SQUARE_SIDE, parent)
31 self.setAcceptHoverEvents(
True)
34 brush = QBrush(Qt.SolidPattern)
35 brush.setColor(Qt.red)
43 myPen = QPen(Qt.SolidLine)
44 myPen.setWidth(PEN_FOCUS_WIDTH)
49 myPen = QPen(Qt.SolidLine)
50 myPen.setWidth(PEN_NORMAL_WIDTH)
54 if qGraphicsSceneMouseEvent.button() == Qt.LeftButton:
56 super(QGraphicsRectItem, self).
mousePressEvent(qGraphicsSceneMouseEvent)
59 if qGraphicsSceneMouseEvent.button() == Qt.LeftButton:
65 self.parentItem().updateMiddlePoints(self.scenePos())
66 super(QGraphicsRectItem, self).
mouseMoveEvent(qGraphicsSceneMouseEvent)
def mouseMoveEvent(self, qGraphicsSceneMouseEvent)
def hoverLeaveEvent(self, event)
def hoverEnterEvent(self, event)
def disableInteraction(self)
def __init__(self, width, parent=None)
def mouseReleaseEvent(self, qGraphicsSceneMouseEvent)
def mousePressEvent(self, qGraphicsSceneMouseEvent)