From 9cee15a935202a4a63bb1e856c5f6846631a530b Mon Sep 17 00:00:00 2001
From: codeboss <2422523675@qq.com>
Date: Sun, 12 Oct 2025 11:42:08 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0update=E4=BF=A1=E5=8F=B7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
MapPresent/MapPresent.cpp | 4 ++++
MapPresent/MapPresent.h | 13 +++++++++++--
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/MapPresent/MapPresent.cpp b/MapPresent/MapPresent.cpp
index 93cb9a6..721d3d4 100644
--- a/MapPresent/MapPresent.cpp
+++ b/MapPresent/MapPresent.cpp
@@ -204,3 +204,7 @@ bool PresentIndex::isValid() const
{
return row != INT_MAX && col != INT_MAX;
}
+
+UnitPresentDelegate::UnitPresentDelegate(QObject* parent /*= nullptr*/)
+ :QObject(parent) {
+}
diff --git a/MapPresent/MapPresent.h b/MapPresent/MapPresent.h
index 5a47759..1968ed1 100644
--- a/MapPresent/MapPresent.h
+++ b/MapPresent/MapPresent.h
@@ -42,9 +42,12 @@ struct PresentOption {
///
/// 单元绘制委托
///
-class UnitPresentDelegate {
+class UnitPresentDelegate : public QObject {
+ Q_OBJECT
public:
+ UnitPresentDelegate(QObject* parent = nullptr);
virtual ~UnitPresentDelegate() = default;
+
///
/// 匹配单元类型
///
@@ -56,6 +59,12 @@ public:
///
///
virtual void paint(QPainter* p, const PresentOption& option) = 0;
+
+signals:
+ ///
+ /// 更新通知/重绘请求
+ ///
+ void updateRequest();
};
///
@@ -106,7 +115,7 @@ public:
signals:
void mouseIn();
void mouseOut();
- void mouseHover(const PresentIndex &unit_index);
+ void mouseHover(const PresentIndex& unit_index);
protected:
void paintEvent(QPaintEvent* ev) override;