diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-08-08 02:25:45 +0200 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-08-24 13:50:55 +0200 |
commit | fce9ec05432073d1b24164814511eadb6beee737 (patch) | |
tree | b49ecc00203140277f15aa573136afcc65ee116e /src/widgets | |
parent | 38806273e567a39bd7ca4ced5e6e38dfd7426f27 (diff) |
Widgets: make indexOf take const QWidget *
As it's the right thing to do to preserve const correctness.
Fixes: QTBUG-85833
Change-Id: I0d45442c5e2b997998bba8dc894fee75da3e8e8c
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/widgets/qstackedwidget.cpp | 2 | ||||
-rw-r--r-- | src/widgets/widgets/qstackedwidget.h | 2 | ||||
-rw-r--r-- | src/widgets/widgets/qtabwidget.cpp | 2 | ||||
-rw-r--r-- | src/widgets/widgets/qtabwidget.h | 2 | ||||
-rw-r--r-- | src/widgets/widgets/qtoolbox.cpp | 2 | ||||
-rw-r--r-- | src/widgets/widgets/qtoolbox.h | 2 |
6 files changed, 6 insertions, 6 deletions
diff --git a/src/widgets/widgets/qstackedwidget.cpp b/src/widgets/widgets/qstackedwidget.cpp index a565d4ab4c..9a9d2ddcbd 100644 --- a/src/widgets/widgets/qstackedwidget.cpp +++ b/src/widgets/widgets/qstackedwidget.cpp @@ -254,7 +254,7 @@ void QStackedWidget::setCurrentWidget(QWidget *widget) \sa currentIndex(), widget() */ -int QStackedWidget::indexOf(QWidget *widget) const +int QStackedWidget::indexOf(const QWidget *widget) const { return d_func()->layout->indexOf(widget); } diff --git a/src/widgets/widgets/qstackedwidget.h b/src/widgets/widgets/qstackedwidget.h index 5508f905d4..5ca6429d75 100644 --- a/src/widgets/widgets/qstackedwidget.h +++ b/src/widgets/widgets/qstackedwidget.h @@ -66,7 +66,7 @@ public: QWidget *currentWidget() const; int currentIndex() const; - int indexOf(QWidget *) const; + int indexOf(const QWidget *) const; QWidget *widget(int) const; int count() const; diff --git a/src/widgets/widgets/qtabwidget.cpp b/src/widgets/widgets/qtabwidget.cpp index 35b097b0c7..3c2bc4f66b 100644 --- a/src/widgets/widgets/qtabwidget.cpp +++ b/src/widgets/widgets/qtabwidget.cpp @@ -719,7 +719,7 @@ void QTabWidget::setCurrentIndex(int index) Returns the index position of the page occupied by the widget \a w, or -1 if the widget cannot be found. */ -int QTabWidget::indexOf(QWidget* w) const +int QTabWidget::indexOf(const QWidget *w) const { Q_D(const QTabWidget); return d->stack->indexOf(w); diff --git a/src/widgets/widgets/qtabwidget.h b/src/widgets/widgets/qtabwidget.h index 0b91f077e0..7de02d3b7e 100644 --- a/src/widgets/widgets/qtabwidget.h +++ b/src/widgets/widgets/qtabwidget.h @@ -104,7 +104,7 @@ public: int currentIndex() const; QWidget *currentWidget() const; QWidget *widget(int index) const; - int indexOf(QWidget *widget) const; + int indexOf(const QWidget *widget) const; int count() const; enum TabPosition { North, South, West, East }; diff --git a/src/widgets/widgets/qtoolbox.cpp b/src/widgets/widgets/qtoolbox.cpp index 9adf8fcd05..acd306b7f6 100644 --- a/src/widgets/widgets/qtoolbox.cpp +++ b/src/widgets/widgets/qtoolbox.cpp @@ -560,7 +560,7 @@ QWidget *QToolBox::widget(int index) const exist. */ -int QToolBox::indexOf(QWidget *widget) const +int QToolBox::indexOf(const QWidget *widget) const { Q_D(const QToolBox); const QToolBoxPrivate::Page *c = (widget ? d->page(widget) : nullptr); diff --git a/src/widgets/widgets/qtoolbox.h b/src/widgets/widgets/qtoolbox.h index d12d4dcfec..e572c7835a 100644 --- a/src/widgets/widgets/qtoolbox.h +++ b/src/widgets/widgets/qtoolbox.h @@ -84,7 +84,7 @@ public: int currentIndex() const; QWidget *currentWidget() const; QWidget *widget(int index) const; - int indexOf(QWidget *widget) const; + int indexOf(const QWidget *widget) const; int count() const; public Q_SLOTS: |