summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qpushbutton.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-03-28 09:23:03 +0200
committerLiang Qi <liang.qi@qt.io>2017-03-28 09:28:31 +0200
commitb48a13fd6843e12b5725aa3ff0d010007e7c43b4 (patch)
tree316cfe36fc67906efcd92ff806c7c0da56ed4f8e /src/widgets/widgets/qpushbutton.cpp
parent3398d9d40cb0dae2dc2a1a4f7dc3b4b9cceae903 (diff)
parent15fe60cfdada84ea519f08e905d59cc3fb6d20cd (diff)
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts: examples/examples.pro tests/auto/corelib/tools/qchar/tst_qchar.cpp tests/auto/other/qaccessibility/accessiblewidgets.h Change-Id: I426696c40ab57d14dc295b8103152cede79f244c
Diffstat (limited to 'src/widgets/widgets/qpushbutton.cpp')
-rw-r--r--src/widgets/widgets/qpushbutton.cpp13
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