diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-05-24 07:29:32 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-05-24 07:29:32 (GMT) |
commit | 803ac286afd47de44359d66b9c711f0b03780f36 (patch) | |
tree | a52007ad0e432f107e30116f1857a9ebcb8cb942 /src/gui/widgets | |
parent | 2e2ce693e16899dcfd1f39374a78bf2ca3a0e016 (diff) | |
parent | 2fa76dc524b97590e554f0f86e6e8c58b6396d51 (diff) | |
download | Qt-803ac286afd47de44359d66b9c711f0b03780f36.zip Qt-803ac286afd47de44359d66b9c711f0b03780f36.tar.gz Qt-803ac286afd47de44359d66b9c711f0b03780f36.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (39 commits)
fix typo in documentation
Improve Bearer Management related documentation in QNetworkAccessManager
Compile with QT_NO_ACTION.
Unbreak compilation outside Mac
QDBusAbstractInterface: don't set lastError outside the object's own thread
tst_bic: make it possible to test for cross-compilation
Remove Q_PACKED from QChar and QLocale::Data.
QDebug operator for QFlags
Removing unneeded qDebug statement.
Fixing incorrect addition of public API symbols.
Removal erroneous inclusion of new Public API in qmacstyle.
Doc: design changes
qdoc: Fixed html error, but the problem is still there.
qdoc: Changed number of columns to 1. Oila!
Doc: Changes to the HTMLGenerator, style and js
remove dead code that will never get called.
add bytes and activeTime to corelwan.
Fix formating of license header.
fix irix build
clarify wording of warning message
...
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/qpushbutton.cpp | 35 | ||||
-rw-r--r-- | src/gui/widgets/qpushbutton.h | 3 | ||||
-rw-r--r-- | src/gui/widgets/qpushbutton_p.h | 3 |
3 files changed, 41 insertions, 0 deletions
diff --git a/src/gui/widgets/qpushbutton.cpp b/src/gui/widgets/qpushbutton.cpp index 1a9adcc..8a18ed0 100644 --- a/src/gui/widgets/qpushbutton.cpp +++ b/src/gui/widgets/qpushbutton.cpp @@ -58,6 +58,10 @@ #include "qdebug.h" #include "qlayoutitem.h" #include "qdialogbuttonbox.h" +#ifdef Q_WS_MAC +#include "qmacstyle_mac.h" +#include "private/qmacstyle_mac_p.h" +#endif // Q_WS_MAC #ifndef QT_NO_ACCESSIBILITY #include "qaccessible.h" @@ -679,6 +683,37 @@ bool QPushButton::event(QEvent *e) return QAbstractButton::event(e); } +#ifdef Q_WS_MAC +/*! \reimp */ +bool QPushButton::hitButton(const QPoint &pos) const +{ + // This is only required if we are using the native style, so check that first. + QMacStyle *macStyle = qobject_cast<QMacStyle *>(style()); + // If this is a flat button we just bail out. + if(isFlat() || (0 == macStyle)) + return QAbstractButton::hitButton(pos); + // Now that we know we are using the native style, let's proceed. + Q_D(const QPushButton); + QPushButtonPrivate *nonConst = const_cast<QPushButtonPrivate *>(d); + // In OSX buttons are round, which causes the hit method to be special. + // We cannot simply relay on detecting if something is inside the rect or not, + // we need to check if it is inside the "rounded area" or not. A point might + // be inside the rect but not inside the rounded area. + // Notice this method is only reimplemented for OSX. + return nonConst->hitButton(pos); +} + +bool QPushButtonPrivate::hitButton(const QPoint &pos) +{ + Q_Q(QPushButton); + QRect roundedRect(q->rect().left() + QMacStylePrivate::PushButtonLeftOffset, + q->rect().top() + QMacStylePrivate::PushButtonContentPadding, + q->rect().width() - QMacStylePrivate::PushButtonRightOffset, + q->rect().height() - QMacStylePrivate::PushButtonBottomOffset); + return roundedRect.contains(pos); +} +#endif // Q_WS_MAC + #ifdef QT3_SUPPORT /*! Use one of the constructors that doesn't take the \a name diff --git a/src/gui/widgets/qpushbutton.h b/src/gui/widgets/qpushbutton.h index 2a4823d..cf28753 100644 --- a/src/gui/widgets/qpushbutton.h +++ b/src/gui/widgets/qpushbutton.h @@ -91,6 +91,9 @@ public Q_SLOTS: protected: bool event(QEvent *e); +#ifdef Q_WS_MAC + bool hitButton(const QPoint &pos) const; +#endif // Q_WS_MAC void paintEvent(QPaintEvent *); void keyPressEvent(QKeyEvent *); void focusInEvent(QFocusEvent *); diff --git a/src/gui/widgets/qpushbutton_p.h b/src/gui/widgets/qpushbutton_p.h index f2ee09d..6feb726 100644 --- a/src/gui/widgets/qpushbutton_p.h +++ b/src/gui/widgets/qpushbutton_p.h @@ -69,6 +69,9 @@ public: inline void init() { resetLayoutItemMargins(); } static QPushButtonPrivate* get(QPushButton *b) { return b->d_func(); } +#ifdef Q_WS_MAC + bool hitButton(const QPoint &pos); +#endif #ifndef QT_NO_MENU QPoint adjustedMenuPosition(); #endif |