Prechádzať zdrojové kódy

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 rokov pred
rodič
commit
073ae6e5df
1 zmenil súbory, kde vykonal 5 pridanie a 1 odobranie
  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());
     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);
   Q_ASSERT(success);
   return success;
   return success;
 }
 }