Android: eradicate Q_FOREACH loops [needing qAsConst()]
... by replacing them with C++11 range-for loops. To avoid detaches of these mutable Qt containers, wrap the container in qAsConst(). Change-Id: I9158c507f9249a7322b11c982bfcab1e6ed4a38a Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This commit is contained in:
parent
54d26804d7
commit
bb71bd8de9
@ -152,7 +152,7 @@ namespace QtAndroidMenu
|
||||
|
||||
visibleMenuBar = 0;
|
||||
activeTopLevelWindow = window;
|
||||
foreach (QAndroidPlatformMenuBar *menuBar, menuBars) {
|
||||
for (QAndroidPlatformMenuBar *menuBar : qAsConst(menuBars)) {
|
||||
if (menuBar->parentWindow() == window) {
|
||||
visibleMenuBar = menuBar;
|
||||
resetMenuBar();
|
||||
@ -350,7 +350,7 @@ namespace QtAndroidMenu
|
||||
item->activated();
|
||||
visibleMenu->aboutToHide();
|
||||
visibleMenu = 0;
|
||||
foreach (QAndroidPlatformMenu *menu, pendingContextMenus) {
|
||||
for (QAndroidPlatformMenu *menu : qAsConst(pendingContextMenus)) {
|
||||
if (menu->isVisible())
|
||||
menu->aboutToHide();
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ void QAndroidEventDispatcherStopper::startAll()
|
||||
return;
|
||||
|
||||
started = true;
|
||||
foreach (QAndroidEventDispatcher *d, m_dispatchers)
|
||||
for (QAndroidEventDispatcher *d : qAsConst(m_dispatchers))
|
||||
d->start();
|
||||
}
|
||||
|
||||
@ -123,7 +123,7 @@ void QAndroidEventDispatcherStopper::stopAll()
|
||||
return;
|
||||
|
||||
started = false;
|
||||
foreach (QAndroidEventDispatcher *d, m_dispatchers)
|
||||
for (QAndroidEventDispatcher *d : qAsConst(m_dispatchers))
|
||||
d->stop();
|
||||
}
|
||||
|
||||
@ -142,6 +142,6 @@ void QAndroidEventDispatcherStopper::removeEventDispatcher(QAndroidEventDispatch
|
||||
void QAndroidEventDispatcherStopper::goingToStop(bool stop)
|
||||
{
|
||||
QMutexLocker lock(&m_mutex);
|
||||
foreach (QAndroidEventDispatcher *d, m_dispatchers)
|
||||
for (QAndroidEventDispatcher *d : qAsConst(m_dispatchers))
|
||||
d->goingToStop(stop);
|
||||
}
|
||||
|
@ -263,7 +263,7 @@ void QAndroidPlatformScreen::setAvailableGeometry(const QRect &rect)
|
||||
|
||||
void QAndroidPlatformScreen::applicationStateChanged(Qt::ApplicationState state)
|
||||
{
|
||||
foreach (QAndroidPlatformWindow *w, m_windowStack)
|
||||
for (QAndroidPlatformWindow *w : qAsConst(m_windowStack))
|
||||
w->applicationStateChanged(state);
|
||||
|
||||
if (state <= Qt::ApplicationHidden) {
|
||||
@ -304,7 +304,7 @@ void QAndroidPlatformScreen::doRedraw()
|
||||
// windows that have renderToTexture children (i.e. they need the OpenGL path) then
|
||||
// we do not need an overlay surface.
|
||||
bool hasVisibleRasterWindows = false;
|
||||
foreach (QAndroidPlatformWindow *window, m_windowStack) {
|
||||
for (QAndroidPlatformWindow *window : qAsConst(m_windowStack)) {
|
||||
if (window->window()->isVisible() && window->isRaster() && !qt_window_private(window->window())->compositing) {
|
||||
hasVisibleRasterWindows = true;
|
||||
break;
|
||||
@ -357,7 +357,7 @@ void QAndroidPlatformScreen::doRedraw()
|
||||
compositePainter.setCompositionMode(QPainter::CompositionMode_Source);
|
||||
|
||||
QRegion visibleRegion(m_dirtyRect);
|
||||
foreach (QAndroidPlatformWindow *window, m_windowStack) {
|
||||
for (QAndroidPlatformWindow *window : qAsConst(m_windowStack)) {
|
||||
if (!window->window()->isVisible()
|
||||
|| qt_window_private(window->window())->compositing
|
||||
|| !window->isRaster())
|
||||
|
@ -1158,7 +1158,7 @@ QAndroidStyle::AndroidStateDrawable::AndroidStateDrawable(const QVariantMap &dra
|
||||
|
||||
QAndroidStyle::AndroidStateDrawable::~AndroidStateDrawable()
|
||||
{
|
||||
foreach (const StateType type, m_states)
|
||||
for (const StateType &type : qAsConst(m_states))
|
||||
delete type.second;
|
||||
}
|
||||
|
||||
@ -1282,7 +1282,7 @@ int QAndroidStyle::AndroidStateDrawable::extractState(const QVariantMap &value)
|
||||
|
||||
void QAndroidStyle::AndroidStateDrawable::setPaddingLeftToSizeWidth()
|
||||
{
|
||||
foreach (const StateType type, m_states)
|
||||
for (const StateType &type : qAsConst(m_states))
|
||||
const_cast<AndroidDrawable *>(type.second)->setPaddingLeftToSizeWidth();
|
||||
}
|
||||
|
||||
@ -1308,7 +1308,7 @@ QAndroidStyle::AndroidLayerDrawable::AndroidLayerDrawable(const QVariantMap &dra
|
||||
|
||||
QAndroidStyle::AndroidLayerDrawable::~AndroidLayerDrawable()
|
||||
{
|
||||
foreach (const LayerType &layer, m_layers)
|
||||
for (const LayerType &layer : qAsConst(m_layers))
|
||||
delete layer.second;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user