From 7455507d0728782c05dbd7e0153483653fa5364a Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Sat, 12 Mar 2022 12:57:48 +0100 Subject: [PATCH] Don't rely on implicit QWeakPointer casting Needs to be explicit with Qt6. --- src/tabbox/tabbox.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/tabbox/tabbox.cpp b/src/tabbox/tabbox.cpp index 589b68dac1..48d7c4e1d0 100644 --- a/src/tabbox/tabbox.cpp +++ b/src/tabbox/tabbox.cpp @@ -110,7 +110,7 @@ QWeakPointer TabBoxHandlerImpl::nextClientFocusChain(TabBoxClient* if (TabBoxClientImpl* c = static_cast< TabBoxClientImpl* >(client)) { auto next = FocusChain::self()->nextMostRecentlyUsed(c->client()); if (next) - return next->tabBoxClient(); + return qWeakPointerCast(next->tabBoxClient()); } return QWeakPointer(); } @@ -118,7 +118,7 @@ QWeakPointer TabBoxHandlerImpl::nextClientFocusChain(TabBoxClient* QWeakPointer< TabBoxClient > TabBoxHandlerImpl::firstClientFocusChain() const { if (auto c = FocusChain::self()->firstMostRecentlyUsed()) { - return QWeakPointer(c->tabBoxClient()); + return qWeakPointerCast(c->tabBoxClient()); } else { return QWeakPointer(); } @@ -145,7 +145,7 @@ int TabBoxHandlerImpl::numberOfDesktops() const QWeakPointer TabBoxHandlerImpl::activeClient() const { if (Workspace::self()->activeClient()) - return Workspace::self()->activeClient()->tabBoxClient(); + return qWeakPointerCast(Workspace::self()->activeClient()->tabBoxClient()); else return QWeakPointer(); } @@ -261,14 +261,14 @@ QWeakPointer TabBoxHandlerImpl::clientToAddToList(TabBoxClient* cl AbstractClient* modal = current->findModal(); if (modal == nullptr || modal == current) ret = current; - else if (!clientList().contains(modal->tabBoxClient())) + else if (!clientList().contains(qWeakPointerCast(modal->tabBoxClient()))) ret = modal; else { // nothing } } if (ret) - return ret->tabBoxClient(); + return qWeakPointerCast(ret->tabBoxClient()); else return QWeakPointer(); } @@ -279,7 +279,7 @@ TabBoxClientList TabBoxHandlerImpl::stackingOrder() const TabBoxClientList ret; for (Toplevel *toplevel : stacking) { if (auto client = qobject_cast(toplevel)) { - ret.append(client->tabBoxClient()); + ret.append(qWeakPointerCast(client->tabBoxClient())); } } return ret; @@ -325,7 +325,7 @@ QWeakPointer TabBoxHandlerImpl::desktopClient() const for (Toplevel *toplevel : stackingOrder) { auto client = qobject_cast(toplevel); if (client && client->isDesktop() && client->isOnCurrentDesktop() && client->output() == workspace()->activeOutput()) { - return client->tabBoxClient(); + return qWeakPointerCast(client->tabBoxClient()); } } return QWeakPointer(); @@ -678,7 +678,7 @@ QList< int > TabBox::currentDesktopList() void TabBox::setCurrentClient(AbstractClient *newClient) { - setCurrentIndex(m_tabBox->index(newClient->tabBoxClient())); + setCurrentIndex(m_tabBox->index(qWeakPointerCast(newClient->tabBoxClient()))); } void TabBox::setCurrentDesktop(int newDesktop)