diff options
Diffstat (limited to 'src/widgets/widgets/qpushbutton.cpp')
-rw-r--r-- | src/widgets/widgets/qpushbutton.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/widgets/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp index 1beea7edc5..a4318681c9 100644 --- a/src/widgets/widgets/qpushbutton.cpp +++ b/src/widgets/widgets/qpushbutton.cpp @@ -40,8 +40,9 @@ #include "qapplication.h" #include "qbitmap.h" #include "qdesktopwidget.h" -#include "qdialog.h" +#if QT_CONFIG(dialog) #include <private/qdialog_p.h> +#endif #include "qdrawutil.h" #include "qevent.h" #include "qfontmetrics.h" @@ -288,6 +289,7 @@ QPushButton::~QPushButton() { } +#if QT_CONFIG(dialog) QDialog *QPushButtonPrivate::dialogParent() const { Q_Q(const QPushButton); @@ -299,6 +301,7 @@ QDialog *QPushButtonPrivate::dialogParent() const } return 0; } +#endif /*! Initialize \a option with the values from this QPushButton. This method is useful @@ -362,10 +365,12 @@ void QPushButton::setDefault(bool enable) if (d->defaultButton == enable) return; d->defaultButton = enable; +#if QT_CONFIG(dialog) if (d->defaultButton) { if (QDialog *dlg = d->dialogParent()) dlg->d_func()->setMainDefault(this); } +#endif update(); #ifndef QT_NO_ACCESSIBILITY QAccessible::State s; @@ -474,9 +479,11 @@ void QPushButton::focusInEvent(QFocusEvent *e) Q_D(QPushButton); if (e->reason() != Qt::PopupFocusReason && autoDefault() && !d->defaultButton) { d->defaultButton = true; +#if QT_CONFIG(dialog) QDialog *dlg = qobject_cast<QDialog*>(window()); if (dlg) dlg->d_func()->setDefault(this); +#endif } QAbstractButton::focusInEvent(e); } @@ -488,11 +495,13 @@ void QPushButton::focusOutEvent(QFocusEvent *e) { Q_D(QPushButton); if (e->reason() != Qt::PopupFocusReason && autoDefault() && d->defaultButton) { +#if QT_CONFIG(dialog) QDialog *dlg = qobject_cast<QDialog*>(window()); if (dlg) dlg->d_func()->setDefault(0); else d->defaultButton = false; +#endif } QAbstractButton::focusOutEvent(e); @@ -657,10 +666,12 @@ bool QPushButton::event(QEvent *e) { Q_D(QPushButton); if (e->type() == QEvent::ParentChange) { +#if QT_CONFIG(dialog) if (QDialog *dialog = d->dialogParent()) { if (d->defaultButton) dialog->d_func()->setMainDefault(this); } +#endif } else if (e->type() == QEvent::StyleChange #ifdef Q_OS_MAC || e->type() == QEvent::MacSizeChange |