Aggregation/Utils/ExtensionSystem: Make member functions const/static

readability-make-member-function-const finds lots of member functions
that could be made const. This change just picks getter functions that
really should be const.

readability-convert-member-functions-to-static finds non-static member
functions which do not access this. This change turns most of them
into static ones, but leaves some non static to keep the class API
consistent.

readability-static-accessed-through-instance fixes the places where
the originally non-static, now static functions were called through
instance.

Change-Id: I8cf16c01f7988a7c9d073b5f8ede6a9706b94fb0
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Alessandro Portale
2020-11-21 01:04:56 +01:00
parent 5951b26f1a
commit 81f3452e1c
21 changed files with 83 additions and 86 deletions

View File

@@ -566,7 +566,7 @@ class WizardProgressPrivate
public:
WizardProgressPrivate() = default;
bool isNextItem(WizardProgressItem *item, WizardProgressItem *nextItem) const;
static bool isNextItem(WizardProgressItem *item, WizardProgressItem *nextItem);
// if multiple paths are possible the empty list is returned
QList<WizardProgressItem *> singlePathBetween(WizardProgressItem *fromItem, WizardProgressItem *toItem) const;
void updateReachableItems();
@@ -597,7 +597,7 @@ public:
WizardProgressItem *m_nextShownItem;
};
bool WizardProgressPrivate::isNextItem(WizardProgressItem *item, WizardProgressItem *nextItem) const
bool WizardProgressPrivate::isNextItem(WizardProgressItem *item, WizardProgressItem *nextItem)
{
QHash<WizardProgressItem *, bool> visitedItems;
QList<WizardProgressItem *> workingItems = item->nextItems();
@@ -767,7 +767,7 @@ void WizardProgress::removePage(int pageId)
item->d_ptr->m_pages.removeOne(pageId);
}
QList<int> WizardProgress::pages(WizardProgressItem *item) const
QList<int> WizardProgress::pages(WizardProgressItem *item)
{
return item->pages();
}
@@ -931,7 +931,7 @@ void WizardProgressItem::setNextItems(const QList<WizardProgressItem *> &items)
// check if we create cycle
for (int i = 0; i < items.count(); i++) {
WizardProgressItem *nextItem = items.at(i);
if (nextItem == this || d->m_wizardProgress->d_ptr->isNextItem(nextItem, this)) {
if (nextItem == this || WizardProgressPrivate::isNextItem(nextItem, this)) {
qWarning("WizardProgress::setNextItems: Setting one of the next items would create a cycle");
return;
}