瀏覽代碼

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 年之前
父節點
當前提交
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;
 }