Explorar o código

ctkSettingsPanel - Trigger registered signal only if needed

QTextEdit triggers the "textChanged" signal when the user types a
character. Since after triggering the signal the widget text was reset
and the caret was repositioned at the end of the string, this was
making it very hard to update settings.

See http://www.na-mic.org/Bug/view.php?id=1904

See #359
Jean-Christophe Fillion-Robin %!s(int64=12) %!d(string=hai) anos
pai
achega
073ae6e5df
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      Libs/Widgets/ctkSettingsPanel.cpp

+ 5 - 1
Libs/Widgets/ctkSettingsPanel.cpp

@@ -83,7 +83,11 @@ bool PropertyType::setValue(const QVariant& val)
     {
     value = QVariant(QStringList());
     }
-  bool success = this->Object->setProperty(this->Property.toLatin1(), value);
+  bool success = true;
+  if (this->Object->property(this->Property.toLatin1()) != value)
+    {
+    success = this->Object->setProperty(this->Property.toLatin1(), value);
+    }
   Q_ASSERT(success);
   return success;
 }