Commit 9b381609 authored by Ben Boeckel's avatar Ben Boeckel
Browse files

qt: replace usage of `foreach`

parent 9edfbcc2
......@@ -132,7 +132,7 @@ pq@_paraview_client_NAME@Initializer::Status pq@_paraview_client_NAME@Initialize
vtkVLogStartScopeF(PARAVIEW_LOG_PLUGIN_VERBOSITY(), "req-plugins", "load required plugins: `@_paraview_client_REQUIRED_PLUGINS@`");
QString plugin_string = "@_paraview_client_REQUIRED_PLUGINS@";
QStringList plugin_list = plugin_string.split(';',PV_QT_SKIP_EMPTY_PARTS);
foreach (const QString plugin_name, plugin_list)
Q_FOREACH (const QString plugin_name, plugin_list)
{
if (!loader->LoadPluginByName(plugin_name.toUtf8().data()))
{
......@@ -146,7 +146,7 @@ pq@_paraview_client_NAME@Initializer::Status pq@_paraview_client_NAME@Initialize
vtkVLogStartScopeF(PARAVIEW_LOG_PLUGIN_VERBOSITY(), "opt-plugins", "load optional plugins: `@_paraview_client_OPTIONAL_PLUGINS@`");
plugin_string = "@_paraview_client_OPTIONAL_PLUGINS@";
plugin_list = plugin_string.split(';', PV_QT_SKIP_EMPTY_PARTS);
foreach (const QString plugin_name, plugin_list)
Q_FOREACH (const QString plugin_name, plugin_list)
{
if (!loader->LoadPluginByName(plugin_name.toUtf8().data()))
{
......@@ -167,7 +167,7 @@ pq@_paraview_client_NAME@Initializer::Status pq@_paraview_client_NAME@Initialize
// given this too much thought.
QDir dir2(":/@_paraview_client_NAME@/Configuration");
QStringList files = dir2.entryList(QDir::Files);
foreach (QString file, files)
Q_FOREACH (QString file, files)
{
this->PVApp->loadConfiguration(QString(":/@_paraview_client_NAME@/Configuration/") + file);
}
......
......@@ -164,7 +164,7 @@ myMainWindow::myMainWindow()
pqApplyBehavior* applyBehavior = new pqApplyBehavior(this);
// Register panels
foreach (pqPropertiesPanel* ppanel, this->findChildren<pqPropertiesPanel*>())
Q_FOREACH (pqPropertiesPanel* ppanel, this->findChildren<pqPropertiesPanel*>())
{
applyBehavior->registerPanel(ppanel);
}
......
......@@ -76,7 +76,7 @@ void pqSurfaceRepresentationBehavior::onRepresentationAdded(pqRepresentation* re
// Set a representation type based on a priority
int priority = 0;
std::string finalValue;
foreach (QVariant v, list)
Q_FOREACH (QVariant v, list)
{
if (v.toString() == "Surface" && priority < 1)
{
......
......@@ -226,7 +226,7 @@ void pqIntegrationModelSeedHelperWidget::updateEnabledState()
QGroupBox* gb = qobject_cast<QGroupBox*>(cb->parent());
bool constant = cb->itemData(cb->currentIndex()).toInt() == vtkLagrangianSeedHelper::CONSTANT;
gb->findChild<QComboBox*>("Arrays")->setEnabled(!constant);
foreach (pqLineEdit* line, gb->findChildren<pqLineEdit*>())
Q_FOREACH (pqLineEdit* line, gb->findChildren<pqLineEdit*>())
{
line->setEnabled(constant);
}
......@@ -236,7 +236,7 @@ void pqIntegrationModelSeedHelperWidget::updateEnabledState()
QList<QVariant> pqIntegrationModelSeedHelperWidget::arrayToGenerate() const
{
QList<QVariant> values;
foreach (QGroupBox* gb, this->findChildren<QGroupBox*>())
Q_FOREACH (QGroupBox* gb, this->findChildren<QGroupBox*>())
{
// Recover the state of each groupbox
if (gb->isChecked())
......@@ -278,7 +278,7 @@ void pqIntegrationModelSeedHelperWidget::setArrayToGenerate(const QList<QVariant
{
QGroupBox* gb;
QList<QGroupBox*> gbs = this->findChildren<QGroupBox*>();
foreach (gb, gbs)
Q_FOREACH (gb, gbs)
{
gb->setChecked(false);
}
......@@ -297,7 +297,7 @@ void pqIntegrationModelSeedHelperWidget::setArrayToGenerate(const QList<QVariant
QString arrayName = i->toString();
int type = (i + 1)->toInt();
gb = nullptr;
foreach (gb, gbs)
Q_FOREACH (gb, gbs)
{
// Identify correct combo box
if (arrayName == gb->property("name"))
......
......@@ -334,7 +334,7 @@ QList<QVariant> pqIntegrationModelSurfaceHelperWidget::arrayToGenerate() const
{
QList<QVariant> values;
// For each group box
foreach (QGroupBox* gb, this->findChildren<QGroupBox*>())
Q_FOREACH (QGroupBox* gb, this->findChildren<QGroupBox*>())
{
if (gb->isChecked())
{
......@@ -381,7 +381,7 @@ void pqIntegrationModelSurfaceHelperWidget::setArrayToGenerate(const QList<QVari
{
QGroupBox* gb;
QList<QGroupBox*> gbs = this->findChildren<QGroupBox*>();
foreach (gb, gbs)
Q_FOREACH (gb, gbs)
{
gb->setChecked(false);
}
......@@ -399,7 +399,7 @@ void pqIntegrationModelSurfaceHelperWidget::setArrayToGenerate(const QList<QVari
QString arrayName = i->toString();
int type = (i + 1)->toInt();
gb = nullptr;
foreach (gb, gbs)
Q_FOREACH (gb, gbs)
{
if (arrayName == gb->property("name"))
{
......
......@@ -210,7 +210,7 @@ pqServer* pqSLACManager::getActiveServer()
//-----------------------------------------------------------------------------
QWidget* pqSLACManager::getMainWindow()
{
foreach (QWidget* topWidget, QApplication::topLevelWidgets())
Q_FOREACH (QWidget* topWidget, QApplication::topLevelWidgets())
{
if (qobject_cast<QMainWindow*>(topWidget))
return topWidget;
......@@ -224,7 +224,7 @@ pqView* pqSLACManager::findView(pqPipelineSource* source, int port, const QStrin
// Step 1, try to find a view in which the source is already shown.
if (source)
{
foreach (pqView* view, source->getViews())
Q_FOREACH (pqView* view, source->getViews())
{
pqDataRepresentation* repr = source->getRepresentation(port, view);
if (repr && repr->isVisible())
......@@ -241,7 +241,7 @@ pqView* pqSLACManager::findView(pqPipelineSource* source, int port, const QStrin
// showing anything.
pqApplicationCore* core = pqApplicationCore::instance();
pqServerManagerModel* smModel = core->getServerManagerModel();
foreach (view, smModel->findItems<pqView*>())
Q_FOREACH (view, smModel->findItems<pqView*>())
{
if (view && (view->getViewType() == viewType) &&
(view->getNumberOfVisibleRepresentations() < 1))
......@@ -276,7 +276,7 @@ pqPipelineSource* pqSLACManager::findPipelineSource(const char* SMName)
pqServerManagerModel* smModel = core->getServerManagerModel();
QList<pqPipelineSource*> sources = smModel->findItems<pqPipelineSource*>(this->getActiveServer());
foreach (pqPipelineSource* s, sources)
Q_FOREACH (pqPipelineSource* s, sources)
{
if (strcmp(s->getProxy()->GetXMLName(), SMName) == 0)
return s;
......@@ -316,7 +316,7 @@ void pqSLACManager::loaderCreatingPipeline()
//-----------------------------------------------------------------------------
static void destroyPortConsumers(pqOutputPort* port)
{
foreach (pqPipelineSource* consumer, port->getConsumers())
Q_FOREACH (pqPipelineSource* consumer, port->getConsumers())
{
pqSLACManager::destroyPipelineSourceAndConsumers(consumer);
}
......@@ -327,7 +327,7 @@ void pqSLACManager::destroyPipelineSourceAndConsumers(pqPipelineSource* source)
if (!source)
return;
foreach (pqOutputPort* port, source->getOutputPorts())
Q_FOREACH (pqOutputPort* port, source->getOutputPorts())
{
destroyPortConsumers(port);
}
......
......@@ -52,7 +52,7 @@ pqStreamLinesAnimationManager::pqStreamLinesAnimationManager(QObject* p /*=nullp
QObject::connect(smmodel, SIGNAL(preViewRemoved(pqView*)), this, SLOT(onViewRemoved(pqView*)));
// Add currently existing views
foreach (pqView* view, smmodel->findItems<pqView*>())
Q_FOREACH (pqView* view, smmodel->findItems<pqView*>())
{
this->onViewAdded(view);
}
......
......@@ -487,7 +487,7 @@ void pqVRAddConnectionDialog::pqInternals::addInput()
void pqVRAddConnectionDialog::pqInternals::removeInput()
{
bool changed = false;
foreach (QListWidgetItem* item, this->listWidget->selectedItems())
Q_FOREACH (QListWidgetItem* item, this->listWidget->selectedItems())
{
QString id = this->parseEntry(item->text()).first;
if (id.isEmpty())
......
......@@ -97,7 +97,7 @@ pqVRAddStyleDialog::pqVRAddStyleDialog(QWidget* parentObject, Qt::WindowFlags f)
std::map<std::string, std::string> buttons;
std::map<std::string, std::string> trackers;
foreach (const QString& connName, mgr->connectionNames())
Q_FOREACH (const QString& connName, mgr->connectionNames())
{
analogs.clear();
buttons.clear();
......@@ -202,7 +202,7 @@ void pqVRAddStyleDialog::updateInteractorStyle()
return;
}
foreach (const pqInternals::InputGui& gui, this->Internals->Inputs)
Q_FOREACH (const pqInternals::InputGui& gui, this->Internals->Inputs)
{
const std::string& role = gui.role;
const std::string& name = gui.combo->currentText().toStdString();
......
......@@ -121,7 +121,7 @@ void pqVRConnectionManager::remove(pqVRPNConnection* conn)
pqVRPNConnection* pqVRConnectionManager::GetVRPNConnection(const QString& name)
{
std::string target = name.toStdString();
foreach (const QPointer<pqVRPNConnection>& conn, this->Internals->VRPNConnections)
Q_FOREACH (const QPointer<pqVRPNConnection>& conn, this->Internals->VRPNConnections)
{
if (!conn.isNull())
{
......@@ -156,7 +156,7 @@ void pqVRConnectionManager::remove(pqVRUIConnection* conn)
pqVRUIConnection* pqVRConnectionManager::GetVRUIConnection(const QString& name)
{
std::string target = name.toStdString();
foreach (const QPointer<pqVRUIConnection>& conn, this->Internals->VRUIConnections)
Q_FOREACH (const QPointer<pqVRUIConnection>& conn, this->Internals->VRUIConnections)
{
if (!conn.isNull())
{
......@@ -188,7 +188,7 @@ QList<QString> pqVRConnectionManager::connectionNames() const
{
QList<QString> result;
#if PARAVIEW_PLUGIN_VRPlugin_USE_VRPN
foreach (pqVRPNConnection* conn, this->Internals->VRPNConnections)
Q_FOREACH (pqVRPNConnection* conn, this->Internals->VRPNConnections)
{
if (conn)
{
......@@ -197,7 +197,7 @@ QList<QString> pqVRConnectionManager::connectionNames() const
}
#endif
#if PARAVIEW_PLUGIN_VRPlugin_USE_VRUI
foreach (pqVRUIConnection* conn, this->Internals->VRUIConnections)
Q_FOREACH (pqVRUIConnection* conn, this->Internals->VRUIConnections)
{
if (conn)
{
......@@ -214,7 +214,7 @@ int pqVRConnectionManager::numConnections() const
{
int result = 0;
#if PARAVIEW_PLUGIN_VRPlugin_USE_VRPN
foreach (pqVRPNConnection* conn, this->Internals->VRPNConnections)
Q_FOREACH (pqVRPNConnection* conn, this->Internals->VRPNConnections)
{
if (conn)
{
......@@ -223,7 +223,7 @@ int pqVRConnectionManager::numConnections() const
}
#endif
#if PARAVIEW_PLUGIN_VRPlugin_USE_VRUI
foreach (pqVRUIConnection* conn, this->Internals->VRUIConnections)
Q_FOREACH (pqVRUIConnection* conn, this->Internals->VRUIConnections)
{
if (conn)
{
......@@ -238,7 +238,7 @@ int pqVRConnectionManager::numConnections() const
void pqVRConnectionManager::start()
{
#if PARAVIEW_PLUGIN_VRPlugin_USE_VRPN
foreach (pqVRPNConnection* conn, this->Internals->VRPNConnections)
Q_FOREACH (pqVRPNConnection* conn, this->Internals->VRPNConnections)
{
if (conn && conn->init())
{
......@@ -247,7 +247,7 @@ void pqVRConnectionManager::start()
}
#endif
#if PARAVIEW_PLUGIN_VRPlugin_USE_VRUI
foreach (pqVRUIConnection* conn, this->Internals->VRUIConnections)
Q_FOREACH (pqVRUIConnection* conn, this->Internals->VRUIConnections)
{
if (conn && conn->init())
{
......@@ -261,7 +261,7 @@ void pqVRConnectionManager::start()
void pqVRConnectionManager::stop()
{
#if PARAVIEW_PLUGIN_VRPlugin_USE_VRPN
foreach (pqVRPNConnection* conn, this->Internals->VRPNConnections)
Q_FOREACH (pqVRPNConnection* conn, this->Internals->VRPNConnections)
{
if (conn)
{
......@@ -270,7 +270,7 @@ void pqVRConnectionManager::stop()
}
#endif
#if PARAVIEW_PLUGIN_VRPlugin_USE_VRUI
foreach (pqVRUIConnection* conn, this->Internals->VRUIConnections)
Q_FOREACH (pqVRUIConnection* conn, this->Internals->VRUIConnections)
{
if (conn)
{
......@@ -349,7 +349,7 @@ void pqVRConnectionManager::saveConnectionsConfiguration(vtkPVXMLElement* root)
vtkPVXMLElement* tempParent = vtkPVXMLElement::New();
tempParent->SetName("VRConnectionManager");
#if PARAVIEW_PLUGIN_VRPlugin_USE_VRPN
foreach (pqVRPNConnection* conn, this->Internals->VRPNConnections)
Q_FOREACH (pqVRPNConnection* conn, this->Internals->VRPNConnections)
{
vtkPVXMLElement* child = conn->saveConfiguration();
if (child)
......@@ -360,7 +360,7 @@ void pqVRConnectionManager::saveConnectionsConfiguration(vtkPVXMLElement* root)
}
#endif
#if PARAVIEW_PLUGIN_VRPlugin_USE_VRUI
foreach (pqVRUIConnection* conn, this->Internals->VRUIConnections)
Q_FOREACH (pqVRUIConnection* conn, this->Internals->VRUIConnections)
{
vtkPVXMLElement* child = conn->saveConfiguration();
if (child)
......
......@@ -191,7 +191,7 @@ void pqVRDockPanel::updateConnections()
pqVRConnectionManager* mgr = pqVRConnectionManager::instance();
QList<QString> connectionNames = mgr->connectionNames();
foreach (const QString& name, connectionNames)
Q_FOREACH (const QString& name, connectionNames)
{
this->Internals->connectionsTable->addItem(name);
}
......@@ -376,7 +376,7 @@ void pqVRDockPanel::updateStyles()
this->Internals->StyleNameMap.clear();
this->Internals->stylesTable->clear();
foreach (vtkVRInteractorStyle* style, pqVRQueueHandler::instance()->styles())
Q_FOREACH (vtkVRInteractorStyle* style, pqVRQueueHandler::instance()->styles())
{
QString name = this->Internals->createName(style);
this->Internals->StyleNameMap.insert(name, style);
......
......@@ -161,7 +161,7 @@ void pqVRPNEventListener::stop()
//------------------------------------------------------------------------------
void pqVRPNThreadBridge::listen()
{
foreach (pqVRPNConnection* conn, this->Connections)
Q_FOREACH (pqVRPNConnection* conn, this->Connections)
{
conn->listen();
}
......
......@@ -51,7 +51,7 @@ pqServer* PVBlotPluginActions::activeServer()
//-----------------------------------------------------------------------------
QWidget* PVBlotPluginActions::mainWindow()
{
foreach (QWidget* topWidget, QApplication::topLevelWidgets())
Q_FOREACH (QWidget* topWidget, QApplication::topLevelWidgets())
{
if (qobject_cast<QMainWindow*>(topWidget))
return topWidget;
......
......@@ -110,7 +110,7 @@ void pqBlotDialog::runScript()
//-----------------------------------------------------------------------------
void pqBlotDialog::runScript(const QStringList& files)
{
foreach (QString filename, files)
Q_FOREACH (QString filename, files)
{
this->ui->shellWidget->executeBlotScript(filename);
}
......
......@@ -181,7 +181,7 @@ void pqApplyBehavior::applied(pqPropertiesPanel*)
//---------------------------------------------------------------------------
// If there is a catalyst session, push its updates to the server
foreach (pqServer* server, smmodel->findItems<pqServer*>())
Q_FOREACH (pqServer* server, smmodel->findItems<pqServer*>())
{
if (pqLiveInsituManager::isInsituServer(server))
{
......@@ -193,7 +193,7 @@ void pqApplyBehavior::applied(pqPropertiesPanel*)
//---------------------------------------------------------------------------
// find views that need updating and update them.
foreach (pqView* view, smmodel->findItems<pqView*>())
Q_FOREACH (pqView* view, smmodel->findItems<pqView*>())
{
if (view && view->getViewProxy()->GetNeedsUpdate())
{
......@@ -205,7 +205,7 @@ void pqApplyBehavior::applied(pqPropertiesPanel*)
// Update all the views separately. This ensures that all pipelines are
// up-to-date before we render as we may need to change some rendering
// properties like color transfer functions before the actual render.
foreach (pqView* view, dirty_views)
Q_FOREACH (pqView* view, dirty_views)
{
SM_SCOPED_TRACE(CallMethod)
.arg(view->getViewProxy())
......@@ -217,7 +217,7 @@ void pqApplyBehavior::applied(pqPropertiesPanel*)
vtkPVGeneralSettings* gsettings = vtkPVGeneralSettings::GetInstance();
if (gsettings->GetColorByBlockColorsOnApply())
{
foreach (const pqInternals::PairType& pair, this->Internals->NewlyCreatedRepresentations)
Q_FOREACH (const pqInternals::PairType& pair, this->Internals->NewlyCreatedRepresentations)
{
vtkSMRepresentationProxy* reprProxy = pair.first;
vtkSMViewProxy* viewProxy = pair.second;
......@@ -253,7 +253,7 @@ void pqApplyBehavior::applied(pqPropertiesPanel*)
//---------------------------------------------------------------------------
// Perform the render on visible views.
foreach (pqView* view, dirty_views)
Q_FOREACH (pqView* view, dirty_views)
{
if (view->widget()->isVisible())
{
......@@ -372,7 +372,7 @@ void pqApplyBehavior::hideInputIfRequired(pqPipelineFilter* filter, pqView* view
// hide input source.
QList<pqOutputPort*> inputs = filter->getAllInputs();
foreach (pqOutputPort* input, inputs)
Q_FOREACH (pqOutputPort* input, inputs)
{
pqDataRepresentation* inputRepr = input->getRepresentation(view);
if (inputRepr)
......
......@@ -50,14 +50,14 @@ void getAllParaViewResourcesDirs(const QString& prefix, QSet<QString>& set)
if (prefix.endsWith("/ParaViewResources"))
{
QStringList contents = dir.entryList(QDir::Files);
foreach (QString file, contents)
Q_FOREACH (QString file, contents)
{
set.insert(prefix + "/" + file);
}
return;
}
QStringList contents = dir.entryList(QDir::AllDirs);
foreach (QString sub_dir, contents)
Q_FOREACH (QString sub_dir, contents)
{
getAllParaViewResourcesDirs(prefix + "/" + sub_dir, set);
}
......@@ -78,7 +78,7 @@ void pqAutoLoadPluginXMLBehavior::updateResources()
QSet<QString> xml_files;
::getAllParaViewResourcesDirs(":", xml_files);
foreach (QString dir, xml_files)
Q_FOREACH (QString dir, xml_files)
{
if (!this->PreviouslyParsedResources.contains(dir))
{
......
......@@ -69,7 +69,7 @@ void pqCTHArraySelectionDecorator::updateSelection()
return;
}
foreach (const QString& pname, this->PropertyNames)
Q_FOREACH (const QString& pname, this->PropertyNames)
{
vtkSMProperty* prop = proxy->GetProperty(pname.toUtf8().data());
if (prop && prop != curProperty)
......
......@@ -76,7 +76,7 @@ pqCategoryToolbarsBehavior::pqCategoryToolbarsBehavior(
void pqCategoryToolbarsBehavior::updateToolbars()
{
QStringList toolbarCategories = this->MenuManager->getToolbarCategories();
foreach (QString category, toolbarCategories)
Q_FOREACH (QString category, toolbarCategories)
{
QToolBar* toolbar = this->MainWindow->findChild<QToolBar*>(category);
if (!toolbar)
......@@ -112,7 +112,7 @@ void pqCategoryToolbarsBehavior::updateToolbars()
void pqCategoryToolbarsBehavior::prepareForTest()
{
foreach (QAction* toolbar, this->ToolbarsToHide)
Q_FOREACH (QAction* toolbar, this->ToolbarsToHide)
{
if (toolbar && toolbar->isChecked())
{
......
......@@ -106,7 +106,7 @@ void pqChangePipelineInputReaction::changeInput()
std::vector<vtkSMProxy*> inputPtrs;
std::vector<unsigned int> inputPorts;
foreach (pqOutputPort* opport, inputs)
Q_FOREACH (pqOutputPort* opport, inputs)
{
inputPtrs.push_back(opport->getSource()->getProxy());
inputPorts.push_back(opport->getPortNumber());
......
......@@ -207,7 +207,7 @@ void pqCommandLineOptionsBehavior::processData()
}
QList<QStringList> files = dialog.getAllSelectedFiles();
QStringList file;
foreach (file, files)
Q_FOREACH (file, files)
{
if (pqLoadDataReaction::loadData(file) == nullptr)
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment