From 4962271021860d1a7d0b9c6b00b4070af788537c Mon Sep 17 00:00:00 2001 From: Fatih Uzunoglu Date: Tue, 27 Jan 2026 22:58:55 +0200 Subject: [PATCH] qt: do not notify comparison key change by default in `TextureProviderObserver` Although it is not as rapid as size change (layer resize case), comparison key may still change often. Now that we have a property to enable notify all changes, we can make comparison key changes not notified by default. --- modules/gui/qt/util/textureproviderobserver.cpp | 12 ++++++++++-- modules/gui/qt/util/textureproviderobserver.hpp | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/modules/gui/qt/util/textureproviderobserver.cpp b/modules/gui/qt/util/textureproviderobserver.cpp index 0bb174c02b..13ea256553 100644 --- a/modules/gui/qt/util/textureproviderobserver.cpp +++ b/modules/gui/qt/util/textureproviderobserver.cpp @@ -282,8 +282,16 @@ void TextureProviderObserver::updateProperties() // Comparison key const qint64 comparisonKey = texture->comparisonKey(); - if (m_comparisonKey.exchange(comparisonKey, memoryOrder) != comparisonKey) - emit comparisonKeyChanged(comparisonKey); + if (notifyAllChanges) + { + if (m_comparisonKey.exchange(comparisonKey, memoryOrder) != comparisonKey) { + emit comparisonKeyChanged(comparisonKey); + } + } + else + { + m_comparisonKey.store(comparisonKey, memoryOrder); + } } return; diff --git a/modules/gui/qt/util/textureproviderobserver.hpp b/modules/gui/qt/util/textureproviderobserver.hpp index b6b338f586..a998d803b5 100644 --- a/modules/gui/qt/util/textureproviderobserver.hpp +++ b/modules/gui/qt/util/textureproviderobserver.hpp @@ -56,6 +56,7 @@ class TextureProviderObserver : public QObject Q_PROPERTY(QSize textureSize READ textureSize NOTIFY textureSizeChanged FINAL) // Scene graph texture size Q_PROPERTY(QSize nativeTextureSize READ nativeTextureSize NOTIFY nativeTextureSizeChanged FINAL) // Native texture size (e.g. for atlas textures, the atlas size) Q_PROPERTY(QRectF normalizedTextureSubRect READ normalizedTextureSubRect NOTIFY normalizedTextureSubRectChanged FINAL) + Q_PROPERTY(qint64 comparisonKey READ comparisonKey NOTIFY comparisonKeyChanged FINAL) // NOTE: Since it is not expected that these properties change rapidly, they have notify signals. // These signals may be emitted in the rendering thread, thus if the connection is auto @@ -64,7 +65,6 @@ class TextureProviderObserver : public QObject Q_PROPERTY(bool hasMipmaps READ hasMipmaps NOTIFY hasMipmapsChanged FINAL) Q_PROPERTY(bool isAtlasTexture READ isAtlasTexture NOTIFY isAtlasTextureChanged FINAL) Q_PROPERTY(bool isValid READ isValid NOTIFY isValidChanged FINAL) // whether a texture is provided or not - Q_PROPERTY(qint64 comparisonKey READ comparisonKey NOTIFY comparisonKeyChanged FINAL) public: explicit TextureProviderObserver(QObject *parent = nullptr);