summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qpushbutton.cpp
diff options
context:
space:
mode:
authorjasplin <qt-info@nokia.com>2009-06-29 06:12:48 (GMT)
committerjasplin <qt-info@nokia.com>2009-06-29 06:41:22 (GMT)
commita8cd5dc1294f2bbaa12c88d7f59b61a1011f5d18 (patch)
tree84e8b45b2b2549a1fb4d6e1502c364a192da7e07 /src/gui/widgets/qpushbutton.cpp
parent37229d77646347db089553a82c44ef0d52eb36c7 (diff)
downloadQt-a8cd5dc1294f2bbaa12c88d7f59b61a1011f5d18.zip
Qt-a8cd5dc1294f2bbaa12c88d7f59b61a1011f5d18.tar.gz
Qt-a8cd5dc1294f2bbaa12c88d7f59b61a1011f5d18.tar.bz2
Fixed QPushButton sizeHint recalculation bug.
This patch causes the size hint of QPushButton to be recalculated in cases where the value of the autoDefault property may have changed due to changes in the ancestor chain. If not explicitly set, the value of the autoDefault property depends on the presence of a QDialog ancestor. Note: The new autotest covers two different use cases related to this behavior. Reviewed-by: janarve Task-number: 255581
Diffstat (limited to 'src/gui/widgets/qpushbutton.cpp')
-rw-r--r--src/gui/widgets/qpushbutton.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gui/widgets/qpushbutton.cpp b/src/gui/widgets/qpushbutton.cpp
index 7da5930..a1c0d74 100644
--- a/src/gui/widgets/qpushbutton.cpp
+++ b/src/gui/widgets/qpushbutton.cpp
@@ -387,8 +387,9 @@ bool QPushButton::isDefault() const
QSize QPushButton::sizeHint() const
{
Q_D(const QPushButton);
- if (d->sizeHint.isValid())
+ if (d->sizeHint.isValid() && d->lastAutoDefault == autoDefault())
return d->sizeHint;
+ d->lastAutoDefault = autoDefault();
ensurePolished();
int w = 0, h = 0;
@@ -657,6 +658,8 @@ bool QPushButton::event(QEvent *e)
) {
d->resetLayoutItemMargins();
updateGeometry();
+ } else if (e->type() == QEvent::PolishRequest) {
+ updateGeometry();
}
return QAbstractButton::event(e);
}