Mercurial > octave
changeset 27677:92fea2cd024f
use standard C++ range-based for loops instead of Qt foreach macro
* ButtonGroup.cc, Container.cc, Figure.cc, GenericEventNotify.h,
ListBoxControl.cc, Menu.cc, Panel.cc, QtHandlesUtils.cc: Replace uses
of Qt foreach macros with standard C++ range-based for loops.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 12 Nov 2019 14:39:07 -0500 |
parents | ea7d36e9f197 |
children | 3a85d8547584 |
files | libgui/graphics/ButtonGroup.cc libgui/graphics/Container.cc libgui/graphics/Figure.cc libgui/graphics/GenericEventNotify.h libgui/graphics/ListBoxControl.cc libgui/graphics/Menu.cc libgui/graphics/Panel.cc libgui/graphics/QtHandlesUtils.cc |
diffstat | 8 files changed, 17 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/graphics/ButtonGroup.cc Tue Nov 12 13:51:22 2019 -0500 +++ b/libgui/graphics/ButtonGroup.cc Tue Nov 12 14:39:07 2019 -0500 @@ -151,9 +151,9 @@ if (frame->hasMouseTracking ()) { - foreach (QWidget *w, frame->findChildren<QWidget*> ()) + for (auto *w : frame->findChildren<QWidget*> ()) w->setMouseTracking (true); - foreach (QWidget *w, buttongroup->findChildren<QWidget*> ()) + for (auto *w : buttongroup->findChildren<QWidget*> ()) w->setMouseTracking (true); }
--- a/libgui/graphics/Container.cc Tue Nov 12 13:51:22 2019 -0500 +++ b/libgui/graphics/Container.cc Tue Nov 12 14:39:07 2019 -0500 @@ -137,7 +137,7 @@ octave::autolock guard (gh_mgr.graphics_lock ()); - foreach (QObject *qObj, children ()) + for (auto *qObj : children ()) { if (qObj->isWidgetType ()) {
--- a/libgui/graphics/Figure.cc Tue Nov 12 13:51:22 2019 -0500 +++ b/libgui/graphics/Figure.cc Tue Nov 12 14:39:07 2019 -0500 @@ -291,8 +291,7 @@ if (canvas) canvas->redraw (); - foreach (QObject *qobj, - qWidget<QWidget> ()->findChildren<QObject*> ()) + for (auto *qobj : qWidget<QWidget> ()->findChildren<QObject*> ()) { if (qobj->objectName () == "UIPanel" || qobj->objectName () == "UIButtonGroup" @@ -382,7 +381,7 @@ int toffset = 0; int boffset = 0; - foreach (QToolBar *tb, win->findChildren<QToolBar*> ()) + for (auto *tb : win->findChildren<QToolBar*> ()) if (! tb->isHidden ()) toffset += tb->sizeHint ().height (); @@ -448,8 +447,7 @@ else m_container->canvas (m_handle)->addEventMask (Canvas::KeyPress); // Signal the change to uipanels as well - foreach (QObject *qobj, - qWidget<QWidget> ()->findChildren<QObject*> ()) + for (auto *qobj : qWidget<QWidget> ()->findChildren<QObject*> ()) { if (qobj->objectName () == "UIPanel") { @@ -475,8 +473,7 @@ m_container->canvas (m_handle)->addEventMask (Canvas::KeyRelease); break; // Signal the change to uipanels as well - foreach (QObject *qobj, - qWidget<QWidget> ()->findChildren<QObject*> ()) + for (auto *qobj : qWidget<QWidget> ()->findChildren<QObject*> ()) { if (qobj->objectName () == "UIPanel") { @@ -903,7 +900,7 @@ // Enable mouse tracking on every widgets m_container->setMouseTracking (true); m_container->canvas (m_handle)->qWidget ()->setMouseTracking (true); - foreach (QWidget *w, m_container->findChildren<QWidget*> ()) + for (auto *w : m_container->findChildren<QWidget*> ()) w->setMouseTracking (true); }
--- a/libgui/graphics/GenericEventNotify.h Tue Nov 12 13:51:22 2019 -0500 +++ b/libgui/graphics/GenericEventNotify.h Tue Nov 12 14:39:07 2019 -0500 @@ -68,7 +68,7 @@ bool GenericEventNotifySender::notifyReceiversBefore (QObject *obj, QEvent *evt) { - foreach (GenericEventNotifyReceiver *r, m_receivers) + for (auto *r : m_receivers) if (r->eventNotifyBefore (obj, evt)) return true; @@ -79,7 +79,7 @@ void GenericEventNotifySender::notifyReceiversAfter (QObject *obj, QEvent *evt) { - foreach (GenericEventNotifyReceiver *r, m_receivers) + for (auto *r : m_receivers) r->eventNotifyAfter (obj, evt); }
--- a/libgui/graphics/ListBoxControl.cc Tue Nov 12 13:51:22 2019 -0500 +++ b/libgui/graphics/ListBoxControl.cc Tue Nov 12 14:39:07 2019 -0500 @@ -180,7 +180,7 @@ Matrix value (dim_vector (1, l.size ())); int i = 0; - foreach (const QModelIndex& idx, l) + for (const auto& idx : l) value(i++) = idx.row () + 1; emit gh_set_event (m_handle, "value", octave_value (value), false);
--- a/libgui/graphics/Menu.cc Tue Nov 12 13:51:22 2019 -0500 +++ b/libgui/graphics/Menu.cc Tue Nov 12 14:39:07 2019 -0500 @@ -120,7 +120,7 @@ int count = 0; - foreach (QAction *a, m_parent->actions ()) + for (auto *a : m_parent->actions ()) if (! a->isSeparator ()) count++; @@ -133,7 +133,7 @@ int count = 0; QAction *before = nullptr; - foreach (QAction *a, m_parent->actions ()) + for (auto *a : m_parent->actions ()) { if (! a->isSeparator ()) { @@ -238,7 +238,7 @@ { int count = 0; - foreach (QAction *a, m_parent->actions ()) + for (auto *a : m_parent->actions ()) { if (! a->isSeparator ()) { @@ -308,7 +308,7 @@ { double count = 1.0; - foreach (QAction *a, m_parent->actions ()) + for (auto *a : m_parent->actions ()) { if (! a->isSeparator ()) {
--- a/libgui/graphics/Panel.cc Tue Nov 12 13:51:22 2019 -0500 +++ b/libgui/graphics/Panel.cc Tue Nov 12 14:39:07 2019 -0500 @@ -135,7 +135,7 @@ if (frame->hasMouseTracking ()) { - foreach (QWidget *w, frame->findChildren<QWidget*> ()) + for (auto *w : frame->findChildren<QWidget*> ()) w->setMouseTracking (true); }