abstract_client: convert some Q_FOREACH

This commit is contained in:
Méven Car 2021-10-13 10:45:30 +02:00
parent 59143eeef9
commit cc5b47ee30

View file

@ -492,8 +492,10 @@ void AbstractClient::setDesktops(QVector<VirtualDesktop*> desktops)
// the (just moved) modal dialog will confusingly return to the mainwindow with // the (just moved) modal dialog will confusingly return to the mainwindow with
// the next desktop change // the next desktop change
{ {
Q_FOREACH (AbstractClient * c2, mainClients()) const auto clients = mainClients();
c2->setDesktops(desktops); for (AbstractClient *c2 : clients) {
c2->setDesktops(desktops);
}
} }
doSetDesktop(); doSetDesktop();
@ -1992,7 +1994,7 @@ QList< AbstractClient* > AbstractClient::mainClients() const
QList<AbstractClient*> AbstractClient::allMainClients() const QList<AbstractClient*> AbstractClient::allMainClients() const
{ {
auto result = mainClients(); auto result = mainClients();
Q_FOREACH (const auto *cl, result) { for (const auto *cl : result) {
result += cl->allMainClients(); result += cl->allMainClients();
} }
return result; return result;
@ -3265,7 +3267,8 @@ void AbstractClient::sendToOutput(AbstractOutput *newOutput)
if (isActive()) { if (isActive()) {
workspace()->setActiveOutput(newOutput); workspace()->setActiveOutput(newOutput);
// might impact the layer of a fullscreen window // might impact the layer of a fullscreen window
Q_FOREACH (AbstractClient *cc, workspace()->allClientList()) { const auto clients = workspace()->allClientList();
for (AbstractClient *cc : clients) {
if (cc->isFullScreen() && cc->output() == newOutput) { if (cc->isFullScreen() && cc->output() == newOutput) {
cc->updateLayer(); cc->updateLayer();
} }
@ -3412,7 +3415,8 @@ void AbstractClient::checkWorkspacePosition(QRect oldGeometry, QRect oldClientGe
// we need to find the screen area as it was before the change // we need to find the screen area as it was before the change
oldScreenArea = QRect( 0, 0, workspace()->oldDisplayWidth(), workspace()->oldDisplayHeight()); oldScreenArea = QRect( 0, 0, workspace()->oldDisplayWidth(), workspace()->oldDisplayHeight());
int distance = INT_MAX; int distance = INT_MAX;
Q_FOREACH(const QRect &r, workspace()->previousScreenSizes()) { const auto previousSizes = workspace()->previousScreenSizes();
for (const QRect &r : previousSizes) {
int d = r.contains( oldGeometry.center()) ? 0 : ( r.center() - oldGeometry.center()).manhattanLength(); int d = r.contains( oldGeometry.center()) ? 0 : ( r.center() - oldGeometry.center()).manhattanLength();
if( d < distance ) { if( d < distance ) {
distance = d; distance = d;