Просмотр исходного кода

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 лет назад: 11
Родитель
Сommit
073ae6e5df
1 измененных файлов с 5 добавлено и 1 удалено
  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;
 }