Hi there,

as suggested without fully functional reviewboard, here is the little patch 
for discussion.

Emit urlChanged only when actually changing url trough setUrl. The drawback of 
this is that now the fast assignment is replaced by possibly expensive string 
comparison. On the other hand, when the urls are the same, the emit wont fire 
and whole bunch of potentially expensive operations connected to that signal 
will not happen.

IMHO the same could/should be done for others setters.

Cheers

Michal
diff --git a/src/part.cpp b/src/part.cpp
index a485900..7fbea3d 100644
--- a/src/part.cpp
+++ b/src/part.cpp
@@ -475,8 +475,11 @@ void ReadOnlyPart::setUrl(const QUrl &url)
 {
     Q_D(ReadOnlyPart);
 
-    d->m_url = url;
-    emit urlChanged(url);
+    if (d->m_url != url)
+    {
+      d->m_url = url;
+      emit urlChanged(url);
+    }
 }
 
 QString ReadOnlyPart::localFilePath() const
_______________________________________________
Kde-frameworks-devel mailing list
Kde-frameworks-devel@kde.org
https://mail.kde.org/mailman/listinfo/kde-frameworks-devel

Reply via email to