|
@@ -6,7 +6,7 @@ an image file or a set of primitives.
|
|
|
|
|
|
from enum import Enum
|
|
|
from PyQt5.QtWidgets import QGraphicsItem, QStyleOptionGraphicsItem, QWidget
|
|
|
-from PyQt5.Qt import QRectF, QPainter, QFont, Qt
|
|
|
+from PyQt5.Qt import QRectF, QPainter, QFont, Qt, QBrush, QColor
|
|
|
|
|
|
|
|
|
class IconType(Enum):
|
|
@@ -25,6 +25,8 @@ class GraphicsNodeItem(QGraphicsItem):
|
|
|
self._font = QFont()
|
|
|
self._font.setPixelSize(12)
|
|
|
|
|
|
+ self.setZValue(1.0)
|
|
|
+
|
|
|
def set_type(self, node_type):
|
|
|
self._type = node_type
|
|
|
self.update(self.boundingRect())
|
|
@@ -44,10 +46,13 @@ class GraphicsNodeItem(QGraphicsItem):
|
|
|
# type: (QPainter, QStyleOptionGraphicsItem, QWidget) -> None
|
|
|
# draw type text and bounding rectangle
|
|
|
painter.setFont(self._font)
|
|
|
+
|
|
|
+ painter.setBrush(QBrush(Qt.white))
|
|
|
painter.drawRect(self.boundingRect())
|
|
|
|
|
|
text_box = QRectF(0, 100, 120, 20)
|
|
|
painter.drawRect(text_box)
|
|
|
+ painter.setBrush(QBrush(QColor(0, 0, 0, 0)))
|
|
|
painter.drawText(text_box, Qt.AlignCenter | Qt.TextDontClip, self._type)
|
|
|
|
|
|
# draw concrete syntax
|