Qt 6: Change QMainWindow::toolBarArea to take const pointer instead

toolBarArea took non-const even though const would have been enough.
In the public API do this for Qt 6.

Fixes: QTBUG-45953
Change-Id: Ic99f4dd5a7f344d49d046e3b084b68120f8de3c0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
Joni Poikelin 2015-05-05 13:32:42 +03:00 committed by Frederik Gladhorn
parent c9aeb73fd1
commit d88c65a532
6 changed files with 14 additions and 6 deletions

View File

@ -863,7 +863,11 @@ void QMainWindow::removeToolBar(QToolBar *toolbar)
\sa addToolBar(), addToolBarBreak(), Qt::ToolBarArea
*/
Qt::ToolBarArea QMainWindow::toolBarArea(QToolBar *toolbar) const
Qt::ToolBarArea QMainWindow::toolBarArea(
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
const
#endif
QToolBar *toolbar) const
{ return d_func()->layout->toolBarArea(toolbar); }
/*!

View File

@ -158,7 +158,11 @@ public:
bool unifiedTitleAndToolBarOnMac() const;
Qt::ToolBarArea toolBarArea(QToolBar *toolbar) const;
Qt::ToolBarArea toolBarArea(
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
const
#endif
QToolBar *toolbar) const;
bool toolBarBreak(QToolBar *toolbar) const;
#endif
#if QT_CONFIG(dockwidget)

View File

@ -1388,7 +1388,7 @@ void QMainWindowLayout::insertToolBar(QToolBar *before, QToolBar *toolbar)
invalidate();
}
Qt::ToolBarArea QMainWindowLayout::toolBarArea(QToolBar *toolbar) const
Qt::ToolBarArea QMainWindowLayout::toolBarArea(const QToolBar *toolbar) const
{
QInternal::DockPosition pos = layoutState.toolBarAreaLayout.findToolBar(toolbar);
switch (pos) {

View File

@ -475,7 +475,7 @@ public:
void addToolBar(Qt::ToolBarArea area, QToolBar *toolbar, bool needAddChildWidget = true);
void insertToolBar(QToolBar *before, QToolBar *toolbar);
Qt::ToolBarArea toolBarArea(QToolBar *toolbar) const;
Qt::ToolBarArea toolBarArea(const QToolBar *toolbar) const;
bool toolBarBreak(QToolBar *toolBar) const;
void getStyleOptionInfo(QStyleOptionToolBar *option, QToolBar *toolBar) const;
void removeToolBar(QToolBar *toolbar);

View File

@ -789,7 +789,7 @@ void QToolBarAreaLayout::deleteAllLayoutItems()
}
}
QInternal::DockPosition QToolBarAreaLayout::findToolBar(QToolBar *toolBar) const
QInternal::DockPosition QToolBarAreaLayout::findToolBar(const QToolBar *toolBar) const
{
for (int i = 0; i < QInternal::DockCount; ++i) {
const QToolBarAreaLayoutInfo &dock = docks[i];

View File

@ -196,7 +196,7 @@ public:
void insertItem(QInternal::DockPosition pos, QLayoutItem *item);
void insertItem(QToolBar *before, QLayoutItem *item);
QInternal::DockPosition findToolBar(QToolBar *toolBar) const;
QInternal::DockPosition findToolBar(const QToolBar *toolBar) const;
bool toolBarBreak(QToolBar *toolBar) const;
void getStyleOptionInfo(QStyleOptionToolBar *option, QToolBar *toolBar) const;