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>
This commit is contained in:
Giuseppe D'Angelo 2020-08-08 02:25:45 +02:00
parent 38806273e5
commit fce9ec0543
6 changed files with 6 additions and 6 deletions

View File

@ -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);
}

View File

@ -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;

View File

@ -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);

View File

@ -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 };

View File

@ -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);

View File

@ -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: