Changeset 846 for trunk/src/gui/widgets/qpushbutton.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/widgets/qpushbutton.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 59 59 #include "qlayoutitem.h" 60 60 #include "qdialogbuttonbox.h" 61 #ifdef Q_WS_MAC 62 #include "qmacstyle_mac.h" 63 #include "private/qmacstyle_mac_p.h" 64 #endif // Q_WS_MAC 61 65 62 66 #ifndef QT_NO_ACCESSIBILITY … … 680 684 } 681 685 686 #ifdef Q_WS_MAC 687 /*! \reimp */ 688 bool QPushButton::hitButton(const QPoint &pos) const 689 { 690 QStyleOptionButton opt; 691 initStyleOption(&opt); 692 if (qt_mac_buttonIsRenderedFlat(this, &opt)) 693 return QAbstractButton::hitButton(pos); 694 695 // Now that we know we are using the native style, let's proceed. 696 Q_D(const QPushButton); 697 QPushButtonPrivate *nonConst = const_cast<QPushButtonPrivate *>(d); 698 // In OSX buttons are round, which causes the hit method to be special. 699 // We cannot simply relay on detecting if something is inside the rect or not, 700 // we need to check if it is inside the "rounded area" or not. A point might 701 // be inside the rect but not inside the rounded area. 702 // Notice this method is only reimplemented for OSX. 703 return nonConst->hitButton(pos); 704 } 705 706 bool QPushButtonPrivate::hitButton(const QPoint &pos) 707 { 708 Q_Q(QPushButton); 709 QRect roundedRect(q->rect().left() + QMacStylePrivate::PushButtonLeftOffset, 710 q->rect().top() + QMacStylePrivate::PushButtonContentPadding, 711 q->rect().width() - QMacStylePrivate::PushButtonRightOffset, 712 q->rect().height() - QMacStylePrivate::PushButtonBottomOffset); 713 return roundedRect.contains(pos); 714 } 715 #endif // Q_WS_MAC 716 682 717 #ifdef QT3_SUPPORT 683 718 /*!
Note:
See TracChangeset
for help on using the changeset viewer.