diff options
Diffstat (limited to 'src/gui/widgets/qpushbutton.cpp')
-rw-r--r-- | src/gui/widgets/qpushbutton.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/gui/widgets/qpushbutton.cpp b/src/gui/widgets/qpushbutton.cpp index ca58f87..a1c0d74 100644 --- a/src/gui/widgets/qpushbutton.cpp +++ b/src/gui/widgets/qpushbutton.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. +** contact the sales department at http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -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; @@ -576,7 +577,7 @@ void QPushButtonPrivate::_q_popupPressed() menu->setNoReplayFor(q); bool horizontal = true; #if !defined(QT_NO_TOOLBAR) - QToolBar *tb = qobject_cast<QToolBar*>(q->parentWidget()); + QToolBar *tb = qobject_cast<QToolBar*>(parent); if (tb && tb->orientation() == Qt::Vertical) horizontal = false; #endif @@ -589,7 +590,7 @@ void QPushButtonPrivate::_q_popupPressed() int x = globalPos.x(); int y = globalPos.y(); if (horizontal) { - if (globalPos.y() + rect.height() + menuSize.height() <= qApp->desktop()->height()) { + if (globalPos.y() + rect.height() + menuSize.height() <= QApplication::desktop()->height()) { y += rect.height(); } else { y -= menuSize.height(); @@ -597,7 +598,7 @@ void QPushButtonPrivate::_q_popupPressed() if (q->layoutDirection() == Qt::RightToLeft) x += rect.width() - menuSize.width(); } else { - if (globalPos.x() + rect.width() + menu->sizeHint().width() <= qApp->desktop()->width()) + if (globalPos.x() + rect.width() + menu->sizeHint().width() <= QApplication::desktop()->width()) x += rect.width(); else x -= menuSize.width(); @@ -657,6 +658,8 @@ bool QPushButton::event(QEvent *e) ) { d->resetLayoutItemMargins(); updateGeometry(); + } else if (e->type() == QEvent::PolishRequest) { + updateGeometry(); } return QAbstractButton::event(e); } |