개정판 3ba37adf
Add QEngineeringTextItem
DTI_PID/DTI_PID/Shapes/QEngineeringTextItem.py | ||
---|---|---|
1 |
# coding: utf-8 |
|
2 |
import os.path |
|
3 |
import copy |
|
4 |
try: |
|
5 |
from PyQt5.QtCore import Qt, QPointF, QRectF, pyqtSignal, QT_VERSION_STR |
|
6 |
from PyQt5.QtGui import QImage, QPixmap, QPainterPath, QBrush, QPen, QTransform |
|
7 |
from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QFileDialog, QGraphicsItem, QAbstractGraphicsShapeItem, QGraphicsTextItem |
|
8 |
except ImportError: |
|
9 |
try: |
|
10 |
from PyQt4.QtCore import Qt, QRectF, pyqtSignal, QT_VERSION_STR |
|
11 |
from PyQt4.QtGui import QGraphicsView, QGraphicsScene, QImage, QPixmap, QPainterPath, QFileDialog |
|
12 |
except ImportError: |
|
13 |
raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.") |
|
14 | ||
15 |
from QGraphicsPolylineItem import QGraphicsPolylineItem |
|
16 |
from QGraphicsBoundingBoxItem import QGraphicsBoundingBoxItem |
|
17 | ||
18 |
class QEngineeringTextItem(QGraphicsTextItem): |
|
19 |
def __init__(self, parent=None): |
|
20 |
QGraphicsTextItem.__init__(self, parent) |
|
21 | ||
22 |
self.setFlags(QGraphicsItem.ItemIsSelectable) |
|
23 |
self.setAcceptHoverEvents(True) |
|
24 | ||
25 |
def hoverEnterEvent(self, event): |
|
26 |
pass |
|
27 | ||
28 |
def hoverLeaveEvent(self, event): |
|
29 |
pass |
|
30 | ||
31 |
def hoverMoveEvent(self, event): |
|
32 |
pass |
내보내기 Unified diff