From 25f73007f8fee4374244e9bfdb42a2c76343c2fa Mon Sep 17 00:00:00 2001 From: codeboss <2422523675@qq.com> Date: Tue, 14 Oct 2025 01:24:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E6=89=B9=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MapPresent/MapPresent.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/MapPresent/MapPresent.cpp b/MapPresent/MapPresent.cpp index 8359e7a..4c113f2 100644 --- a/MapPresent/MapPresent.cpp +++ b/MapPresent/MapPresent.cpp @@ -123,7 +123,8 @@ void MapPresent::paintEvent(QPaintEvent* ev) if (_updated_index_list.size()) { QPainter pic_painter(&_paint_buffer); - for (auto unit_idx : _updated_index_list) { + const int update_batch_count = 1200; + for (auto unit_idx : _updated_index_list.mid(0, update_batch_count)) { pic_painter.save(); auto opt = _visible_units[unit_idx]; @@ -147,7 +148,10 @@ void MapPresent::paintEvent(QPaintEvent* ev) pic_painter.restore(); } - _updated_index_list.clear(); + _updated_index_list = _updated_index_list.mid(update_batch_count); + if (_updated_index_list.size()) { + this->update(); + } } QPainter widget_painter(this);