From ffe6fcdad9cdcd02e821b59270972a8f04b115a9 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 21 Jun 2010 14:21:31 +0200 Subject: Designer: Prevent QButtonGroup from being added for Q3ButtonGroup. The internal QButtonGroup used by Q3ButtonGroup interferes with saving mechanism for QButtonGroup (introduced in 4.5). Reviewed-by: Jarek Kobus Task-number: QTBUG-11431 --- tools/designer/src/lib/uilib/abstractformbuilder.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tools/designer/src/lib/uilib/abstractformbuilder.cpp b/tools/designer/src/lib/uilib/abstractformbuilder.cpp index a0c9e83..6f009e3 100644 --- a/tools/designer/src/lib/uilib/abstractformbuilder.cpp +++ b/tools/designer/src/lib/uilib/abstractformbuilder.cpp @@ -2125,6 +2125,21 @@ void QAbstractFormBuilder::saveComboBoxExtraInfo(QComboBox *comboBox, DomWidget ui_widget->setElementItem(ui_items); } +// Return the buttongroups assigned to a button except the internal one +// (with empty object name) used by Q3ButtonGroup. +static inline const QButtonGroup *formButtonGroup(const QAbstractButton *widget) +{ + const QButtonGroup *buttonGroup = widget->group(); + if (!buttonGroup) + return 0; + if (buttonGroup->objectName().isEmpty()) { + if (const QWidget *parent = widget->parentWidget()) + if (!qstrcmp(parent->metaObject()->className(), "Q3ButtonGroup")) + return 0; + } + return buttonGroup; +} + /*! \internal \since 4.5 @@ -2133,7 +2148,7 @@ void QAbstractFormBuilder::saveComboBoxExtraInfo(QComboBox *comboBox, DomWidget void QAbstractFormBuilder::saveButtonExtraInfo(const QAbstractButton *widget, DomWidget *ui_widget, DomWidget *) { typedef QList DomPropertyList; - if (const QButtonGroup *buttonGroup = widget->group()) { + if (const QButtonGroup *buttonGroup = formButtonGroup(widget)) { DomPropertyList attributes = ui_widget->elementAttribute(); DomString *domString = new DomString(); domString->setText(buttonGroup->objectName()); -- cgit v0.12