diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2013-04-13 17:16:47 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2013-04-15 15:59:22 +0200 |
commit | 4d83ff38ad836e507730034293d092df40b6d034 (patch) | |
tree | aef803b33ce2d73c78bf73d3267b8a6b39bf8ec5 | |
parent | e7c410b9dccdb0c248164811044824c83f0a3c17 (diff) |
QtPropertyBrowser: Respond to each change of text in QtLineEditFactory
I've extended this editor to allow adding a QCompleter to the line edit,
but when changing the value via the QCompleter only the 'textChanged'
and not the 'textEdited' signal is emitted.
'blockSignals' is now used to avoid this signal when applying a change
of property value, like for all other editors.
Change-Id: I1668dd45ad2e2bc651777b97cb143d1525eb5bd0
Reviewed-by: Jarek Kobus <jaroslaw.kobus@digia.com>
-rw-r--r-- | qtpropertybrowser/src/qteditorfactory.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/qtpropertybrowser/src/qteditorfactory.cpp b/qtpropertybrowser/src/qteditorfactory.cpp index 5cb4a37..afd1520 100644 --- a/qtpropertybrowser/src/qteditorfactory.cpp +++ b/qtpropertybrowser/src/qteditorfactory.cpp @@ -968,8 +968,11 @@ void QtLineEditFactoryPrivate::slotPropertyChanged(QtProperty *property, QListIterator<QLineEdit *> itEditor( m_createdEditors[property]); while (itEditor.hasNext()) { QLineEdit *editor = itEditor.next(); - if (editor->text() != value) + if (editor->text() != value) { + editor->blockSignals(true); editor->setText(value); + editor->blockSignals(false); + } } } @@ -1117,7 +1120,7 @@ QWidget *QtLineEditFactory::createEditor(QtStringPropertyManager *manager, } editor->setText(manager->value(property)); - connect(editor, SIGNAL(textEdited(const QString &)), + connect(editor, SIGNAL(textChanged(const QString &)), this, SLOT(slotSetValue(const QString &))); connect(editor, SIGNAL(destroyed(QObject *)), this, SLOT(slotEditorDestroyed(QObject *))); |