mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Put correct cursor style when mouse hover a map item.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from PySide2.QtGui import QPen
|
||||
from PySide2.QtWidgets import QGraphicsRectItem, QGraphicsSceneMouseEvent
|
||||
from PySide2.QtGui import QPen, Qt
|
||||
from PySide2.QtWidgets import QGraphicsRectItem, QGraphicsSceneMouseEvent, QGraphicsSceneHoverEvent
|
||||
|
||||
import qt_ui.uiconstants as CONST
|
||||
from game.event import Event
|
||||
@@ -29,6 +29,9 @@ class QMapEvent(QGraphicsRectItem):
|
||||
painter.setPen(QPen(brush=CONST.COLORS["red"]))
|
||||
painter.setBrush(CONST.COLORS["red"])
|
||||
|
||||
if self.isUnderMouse():
|
||||
painter.setBrush(CONST.COLORS["white"])
|
||||
|
||||
painter.drawRect(option.rect)
|
||||
painter.drawPixmap(option.rect, CONST.EVENT_ICONS[self.gameEvent.__class__])
|
||||
painter.restore()
|
||||
@@ -37,6 +40,10 @@ class QMapEvent(QGraphicsRectItem):
|
||||
if self.parent.get_display_rule("events"):
|
||||
self.openBriefing()
|
||||
|
||||
def hoverEnterEvent(self, event: QGraphicsSceneHoverEvent):
|
||||
self.update()
|
||||
self.setCursor(Qt.PointingHandCursor)
|
||||
|
||||
def openBriefing(self):
|
||||
self.briefing = QBriefingWindow(self.gameEvent)
|
||||
self.briefing.show()
|
||||
Reference in New Issue
Block a user