Make QWidget::mapTo/mapFrom() take const pointers.

This commit addresses a long-standing Qt 5 to-do. Whilst a trivial
change, it is binary incompatible.

Task-number: QTBUG-665
Change-Id: I4294233d876dec79eda57113bdf298ce73643e76
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This commit is contained in:
Jason McDonald 2012-03-26 19:59:56 +10:00 committed by Qt by Nokia
parent 13d936b0f2
commit 2b17b0235b
2 changed files with 6 additions and 6 deletions

View File

@ -3860,13 +3860,13 @@ void QWidget::setFixedHeight(int h)
\sa mapFrom() mapToParent() mapToGlobal() underMouse() \sa mapFrom() mapToParent() mapToGlobal() underMouse()
*/ */
QPoint QWidget::mapTo(QWidget * parent, const QPoint & pos) const QPoint QWidget::mapTo(const QWidget * parent, const QPoint & pos) const
{ {
QPoint p = pos; QPoint p = pos;
if (parent) { if (parent) {
const QWidget * w = this; const QWidget * w = this;
while (w != parent) { while (w != parent) {
Q_ASSERT_X(w, "QWidget::mapTo(QWidget *parent, const QPoint &pos)", Q_ASSERT_X(w, "QWidget::mapTo(const QWidget *parent, const QPoint &pos)",
"parent must be in parent hierarchy"); "parent must be in parent hierarchy");
p = w->mapToParent(p); p = w->mapToParent(p);
w = w->parentWidget(); w = w->parentWidget();
@ -3884,13 +3884,13 @@ QPoint QWidget::mapTo(QWidget * parent, const QPoint & pos) const
\sa mapTo() mapFromParent() mapFromGlobal() underMouse() \sa mapTo() mapFromParent() mapFromGlobal() underMouse()
*/ */
QPoint QWidget::mapFrom(QWidget * parent, const QPoint & pos) const QPoint QWidget::mapFrom(const QWidget * parent, const QPoint & pos) const
{ {
QPoint p(pos); QPoint p(pos);
if (parent) { if (parent) {
const QWidget * w = this; const QWidget * w = this;
while (w != parent) { while (w != parent) {
Q_ASSERT_X(w, "QWidget::mapFrom(QWidget *parent, const QPoint &pos)", Q_ASSERT_X(w, "QWidget::mapFrom(const QWidget *parent, const QPoint &pos)",
"parent must be in parent hierarchy"); "parent must be in parent hierarchy");
p = w->mapFromParent(p); p = w->mapFromParent(p);

View File

@ -306,8 +306,8 @@ public:
QPoint mapFromGlobal(const QPoint &) const; QPoint mapFromGlobal(const QPoint &) const;
QPoint mapToParent(const QPoint &) const; QPoint mapToParent(const QPoint &) const;
QPoint mapFromParent(const QPoint &) const; QPoint mapFromParent(const QPoint &) const;
QPoint mapTo(QWidget *, const QPoint &) const; QPoint mapTo(const QWidget *, const QPoint &) const;
QPoint mapFrom(QWidget *, const QPoint &) const; QPoint mapFrom(const QWidget *, const QPoint &) const;
QWidget *window() const; QWidget *window() const;
QWidget *nativeParentWidget() const; QWidget *nativeParentWidget() const;