diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2011-02-04 08:28:58 (GMT) |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2011-02-04 08:28:58 (GMT) |
commit | dd7873cd7e02e42b384709f33a34f69bc06fb25d (patch) | |
tree | adb570a6bd1b5e7c1c21c69d933ae235d2f9f7c3 | |
parent | dbfca8da2807921069c0e53da33f6e7bd3e73479 (diff) | |
download | Qt-dd7873cd7e02e42b384709f33a34f69bc06fb25d.zip Qt-dd7873cd7e02e42b384709f33a34f69bc06fb25d.tar.gz Qt-dd7873cd7e02e42b384709f33a34f69bc06fb25d.tar.bz2 |
Designer: Fix a crash in the Signal-Slot-Editor.
Object search found deleted widgets by name when
searching on the form window. Search main container
instead, do not assert.
Reviewed-by: Jarek Kobus <jaroslaw.kobus@nokia.com>
Task-number: QTBUG-17179
-rw-r--r-- | tools/designer/src/components/signalsloteditor/signalslot_utils.cpp | 22 | ||||
-rw-r--r-- | tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp | 2 |
2 files changed, 11 insertions, 13 deletions
diff --git a/tools/designer/src/components/signalsloteditor/signalslot_utils.cpp b/tools/designer/src/components/signalsloteditor/signalslot_utils.cpp index aecd1e5..d0af770 100644 --- a/tools/designer/src/components/signalsloteditor/signalslot_utils.cpp +++ b/tools/designer/src/components/signalsloteditor/signalslot_utils.cpp @@ -72,7 +72,6 @@ static void memberList(QDesignerFormEditorInterface *core, { if (!object) return; - // 1) member sheet const QDesignerMemberSheetExtension *members = qt_extension<QDesignerMemberSheetExtension*>(core->extensionManager(), object); Q_ASSERT(members != 0); @@ -118,15 +117,15 @@ static void memberList(QDesignerFormEditorInterface *core, if (!metaDataBase) return; - const qdesigner_internal::MetaDataBaseItem *mdbItem = metaDataBase->metaDataBaseItem(object); - Q_ASSERT(mdbItem); - const QStringList mdbFakeMethods = member_type == qdesigner_internal::SlotMember ? mdbItem->fakeSlots() : mdbItem->fakeSignals(); - if (!mdbFakeMethods.empty()) - foreach (const QString &fakeMethod, mdbFakeMethods) - if (predicate(fakeMethod)) { - *it = ClassNameSignaturePair(className, fakeMethod); - ++it; - } + if (const qdesigner_internal::MetaDataBaseItem *mdbItem = metaDataBase->metaDataBaseItem(object)) { + const QStringList mdbFakeMethods = member_type == qdesigner_internal::SlotMember ? mdbItem->fakeSlots() : mdbItem->fakeSignals(); + if (!mdbFakeMethods.empty()) + foreach (const QString &fakeMethod, mdbFakeMethods) + if (predicate(fakeMethod)) { + *it = ClassNameSignaturePair(className, fakeMethod); + ++it; + } + } } namespace { @@ -245,10 +244,9 @@ namespace qdesigner_internal { ClassesMemberFunctions reverseClassesMemberFunctions(const QString &obj_name, MemberType member_type, const QString &peer, QDesignerFormWindowInterface *form) { - QObject *object = qFindChild<QObject*>(form, obj_name); + QObject *object = qFindChild<QObject*>(form->mainContainer(), obj_name); if (!object) return ClassesMemberFunctions(); - QDesignerFormEditorInterface *core = form->core(); ClassesMemberFunctions rc; diff --git a/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp b/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp index ecee08e..831649f 100644 --- a/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp +++ b/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp @@ -658,7 +658,7 @@ QWidget *ConnectionDelegate::createEditor(QWidget *parent, const qdesigner_internal::ClassesMemberFunctions class_list = qdesigner_internal::reverseClassesMemberFunctions(obj_name, type, peer, m_form); - QObject *object = qFindChild<QObject*>(m_form, obj_name); + QObject *object = qFindChild<QObject*>(m_form->mainContainer(), obj_name); inline_editor->addText(type == qdesigner_internal::SignalMember ? tr("<signal>") : tr("<slot>")); foreach (const qdesigner_internal::ClassMemberFunctions &class_info, class_list) { |