From c2a21a91063de0c435ef75280ba6c0cc965df8c9 Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 16 Oct 2020 14:47:35 +0100 Subject: [PATCH] Don't emit redundant change signals when nothing changed --- qrenderdoc/Widgets/Extended/RDTreeWidget.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/qrenderdoc/Widgets/Extended/RDTreeWidget.h b/qrenderdoc/Widgets/Extended/RDTreeWidget.h index 7aa5e9d8f..dee5c83b0 100644 --- a/qrenderdoc/Widgets/Extended/RDTreeWidget.h +++ b/qrenderdoc/Widgets/Extended/RDTreeWidget.h @@ -87,13 +87,19 @@ public: inline void setForegroundColor(QColor foreground) { setForeground(QBrush(foreground)); } inline void setBackground(QBrush background) { - m_back = background; - dataChanged(0, Qt::BackgroundRole); + if(m_back != background) + { + m_back = background; + dataChanged(0, Qt::BackgroundRole); + } } inline void setForeground(QBrush foreground) { - m_fore = foreground; - dataChanged(0, Qt::ForegroundRole); + if(m_fore != foreground) + { + m_fore = foreground; + dataChanged(0, Qt::ForegroundRole); + } } inline QBrush background() { return m_back; } inline QBrush foreground() { return m_fore; }