diff options
author | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2010-06-04 10:12:01 (GMT) |
---|---|---|
committer | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2010-06-10 12:06:42 (GMT) |
commit | 7101ae5a0e90d97acf86a444c4d51ca45e7863fe (patch) | |
tree | e40aa11c165873378818fd2376dff4654f4c86aa /src/gui/kernel/qwidget_p.h | |
parent | 39e11b3f49fdc01155575f6d909efd92e435d5a6 (diff) | |
download | Qt-7101ae5a0e90d97acf86a444c4d51ca45e7863fe.zip Qt-7101ae5a0e90d97acf86a444c4d51ca45e7863fe.tar.gz Qt-7101ae5a0e90d97acf86a444c4d51ca45e7863fe.tar.bz2 |
QWidget::childAt for masked child widgets doesn't work properly
Problem was that we didn't take the children's effective mask
into account when checking whether a point was inside or not.
This commit is also an optimization since we no longer check the point
against the widget's rect twice. Furthermore, unnecessary
QRegion operations are completely avoided in the common case.
Auto tests included.
Task-number: QTBUG-7150
Reviewed-by: paul
Diffstat (limited to 'src/gui/kernel/qwidget_p.h')
-rw-r--r-- | src/gui/kernel/qwidget_p.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 49a2dc8..4247c3a 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -542,7 +542,9 @@ public: bool setMinimumSize_helper(int &minw, int &minh); bool setMaximumSize_helper(int &maxw, int &maxh); void setConstraints_sys(); + bool pointInsideRectAndMask(const QPoint &) const; QWidget *childAt_helper(const QPoint &, bool) const; + QWidget *childAtRecursiveHelper(const QPoint &p, bool, bool includeFrame = false) const; void updateGeometry_helper(bool forceUpdate); void getLayoutItemMargins(int *left, int *top, int *right, int *bottom) const; @@ -968,6 +970,13 @@ inline void QWidgetPrivate::setSharedPainter(QPainter *painter) x->sharedPainter = painter; } +inline bool QWidgetPrivate::pointInsideRectAndMask(const QPoint &p) const +{ + Q_Q(const QWidget); + return q->rect().contains(p) && (!extra || !extra->hasMask || q->testAttribute(Qt::WA_MouseNoMask) + || extra->mask.contains(p)); +} + inline QWidgetBackingStore *QWidgetPrivate::maybeBackingStore() const { Q_Q(const QWidget); |