Pārlūkot izejas kodu

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 12 gadi atpakaļ
vecāks
revīzija
073ae6e5df
1 mainītis faili ar 5 papildinājumiem un 1 dzēšanām
  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;
 }