diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-11-25 10:28:28 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-11-25 10:28:34 (GMT) |
commit | 931a81a116dd453b1714f0faa2be42bddcd066aa (patch) | |
tree | 7d1aacaf168fa4db3bf6739a677f0ad7e832e721 /src/gui/widgets | |
parent | e6010544c06232ff1baed9123c0292a7aff6985e (diff) | |
parent | a90a5b09a8cd1017b3743175f15c4e548de180fb (diff) | |
download | Qt-931a81a116dd453b1714f0faa2be42bddcd066aa.zip Qt-931a81a116dd453b1714f0faa2be42bddcd066aa.tar.gz Qt-931a81a116dd453b1714f0faa2be42bddcd066aa.tar.bz2 |
Merge commit 'upstream/4.6' into oslo-staging-2/4.6
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/qdialogbuttonbox.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/gui/widgets/qdialogbuttonbox.cpp b/src/gui/widgets/qdialogbuttonbox.cpp index 2ee5751..0e859f1 100644 --- a/src/gui/widgets/qdialogbuttonbox.cpp +++ b/src/gui/widgets/qdialogbuttonbox.cpp @@ -1215,6 +1215,30 @@ bool QDialogButtonBox::event(QEvent *event) }else if (event->type() == QEvent::LanguageChange) { d->retranslateStrings(); } +#ifdef QT_SOFTKEYS_ENABLED + else if (event->type() == QEvent::ParentChange) { + QWidget *dialog = 0; + QWidget *p = this; + while (p && !p->isWindow()) { + p = p->parentWidget(); + if ((dialog = qobject_cast<QDialog *>(p))) + break; + } + + // If the parent changes, then move the softkeys + for (QHash<QAbstractButton *, QAction *>::const_iterator it = d->softKeyActions.constBegin(); + it != d->softKeyActions.constEnd(); ++it) { + QAction *current = it.value(); + QList<QWidget *> widgets = current->associatedWidgets(); + foreach (QWidget *w, widgets) + w->removeAction(current); + if (dialog) + dialog->addAction(current); + else + addAction(current); + } + } +#endif return QWidget::event(event); } |