diff options
author | Sami Merilä <sami.merila@nokia.com> | 2009-10-08 09:19:35 (GMT) |
---|---|---|
committer | Sami Merilä <sami.merila@nokia.com> | 2009-10-08 09:19:35 (GMT) |
commit | cdf2e8162939257c6c715659db58854457f2811f (patch) | |
tree | 9c28a294329e423e6692fc3e8455946c7eaa7da5 /src | |
parent | c15b370c9db16fdbfd9e7bec89ee9bf8c1110827 (diff) | |
download | Qt-cdf2e8162939257c6c715659db58854457f2811f.zip Qt-cdf2e8162939257c6c715659db58854457f2811f.tar.gz Qt-cdf2e8162939257c6c715659db58854457f2811f.tar.bz2 |
DialogButtonBox is shown together with softkeys (QTBUG-4739)
This fixes issue that both DialogButtonBox and softkeys are visible
(e.g. in Ftp example) at the same time.
Reason is that the previous implementation did the visiblitity setting when buttons were created.
Unfortunately buttons can be created without parent and let layout manager to find parent them
for you - so dialog as parent (=hide dialogbuttonbox as softkeys are in use) check failed.
Now similar check is done before showing the widget - it is layoutted here, so it has parent as well.
As a bonus, the event handling is already looking for dialog parent, so we can avoid doing another
for-loop.
Task-number: QTBUG-4739
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/widgets/qdialogbuttonbox.cpp | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/src/gui/widgets/qdialogbuttonbox.cpp b/src/gui/widgets/qdialogbuttonbox.cpp index 6cc720d..280ca63 100644 --- a/src/gui/widgets/qdialogbuttonbox.cpp +++ b/src/gui/widgets/qdialogbuttonbox.cpp @@ -468,18 +468,6 @@ void QDialogButtonBoxPrivate::layoutButtons() if (center) buttonLayout->addStretch(); - -#ifdef QT_SOFTKEYS_ENABLED - QWidget *dialog = 0; - QWidget *p = q; - while (p && !p->isWindow()) { - p = p->parentWidget(); - if (dialog = qobject_cast<QDialog *>(p)) - break; - } - if (dialog) - q->setFixedSize(0, 0); -#endif } QPushButton *QDialogButtonBoxPrivate::createButton(QDialogButtonBox::StandardButton sbutton, @@ -1196,10 +1184,12 @@ bool QDialogButtonBox::event(QEvent *event) if (!hasDefault && firstAcceptButton) firstAcceptButton->setDefault(true); #ifdef QT_SOFTKEYS_ENABLED - if (dialog) + if (dialog) { + setFixedSize(0,0); dialog->addActions(d->softKeyActions.values()); - else + } else { addActions(d->softKeyActions.values()); + } #endif }else if (event->type() == QEvent::LanguageChange) { d->retranslateStrings(); |