Browse Source

fix: waveform repaint via viewport()->update() instead of activeWindow()

- Timer now calls s_voiceView->viewport()->update() for correct delegate repaint
- s_voiceView captured from option.widget in paint() voice section
- Previously activeWindow()->update() didn't reach QListView viewport
topo_upd
Evgeny 2 months ago
parent
commit
e050f3f1f9
  1. 4
      tools/chatgui/src/messagedelegate.cpp

4
tools/chatgui/src/messagedelegate.cpp

@ -32,6 +32,7 @@ struct VoicePlayState {
}; };
static QMap<QString, VoicePlayState> s_voiceStates; static QMap<QString, VoicePlayState> s_voiceStates;
static QTimer* s_voiceTimer = nullptr; static QTimer* s_voiceTimer = nullptr;
static QAbstractItemView* s_voiceView = nullptr;
static void ensureVoiceTimer() { static void ensureVoiceTimer() {
if (!s_voiceTimer) { if (!s_voiceTimer) {
@ -56,7 +57,7 @@ static void ensureVoiceTimer() {
} }
} }
if (!anyPlaying) s_voiceTimer->stop(); if (!anyPlaying) s_voiceTimer->stop();
if (auto* w = QApplication::activeWindow()) w->update(); if (s_voiceView) s_voiceView->viewport()->update();
}); });
} }
} }
@ -603,6 +604,7 @@ void MessageDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio
} }
if (L.isVoice) { if (L.isVoice) {
if (option.widget) s_voiceView = (QAbstractItemView*)option.widget;
drawBubble(painter, L, option); drawBubble(painter, L, option);
if (!L.narrow) drawAvatar(painter, L, index); if (!L.narrow) drawAvatar(painter, L, index);

Loading…
Cancel
Save