Gui: modernize C++: use range-based for loop
This commit is contained in:
@@ -53,9 +53,12 @@ using namespace Gui;
|
||||
namespace sp = std::placeholders;
|
||||
|
||||
AutoSaver* AutoSaver::self = nullptr;
|
||||
const int AutoSaveTimeout = 900000;
|
||||
|
||||
AutoSaver::AutoSaver(QObject* parent)
|
||||
: QObject(parent), timeout(900000), compressed(true)
|
||||
: QObject(parent)
|
||||
, timeout(AutoSaveTimeout)
|
||||
, compressed(true)
|
||||
{
|
||||
//NOLINTBEGIN
|
||||
App::GetApplication().signalNewDocument.connect(std::bind(&AutoSaver::slotCreateDocument, this, sp::_1));
|
||||
@@ -69,8 +72,9 @@ AutoSaver::~AutoSaver()
|
||||
|
||||
AutoSaver* AutoSaver::instance()
|
||||
{
|
||||
if (!self)
|
||||
if (!self) {
|
||||
self = new AutoSaver(QApplication::instance());
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -88,11 +92,11 @@ void AutoSaver::setTimeout(int ms)
|
||||
timeout = Base::clamp<int>(ms, 0, 3600000); // between 0 and 60 min
|
||||
|
||||
// go through the attached documents and apply the new timeout
|
||||
for (std::map<std::string, AutoSaveProperty*>::iterator it = saverMap.begin(); it != saverMap.end(); ++it) {
|
||||
if (it->second->timerId > 0)
|
||||
killTimer(it->second->timerId);
|
||||
for (auto & it : saverMap) {
|
||||
if (it.second->timerId > 0)
|
||||
killTimer(it.second->timerId);
|
||||
int id = timeout > 0 ? startTimer(timeout) : 0;
|
||||
it->second->timerId = id;
|
||||
it.second->timerId = id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,15 +231,15 @@ void AutoSaver::saveDocument(const std::string& name, AutoSaveProperty& saver)
|
||||
void AutoSaver::timerEvent(QTimerEvent * event)
|
||||
{
|
||||
int id = event->timerId();
|
||||
for (std::map<std::string, AutoSaveProperty*>::iterator it = saverMap.begin(); it != saverMap.end(); ++it) {
|
||||
if (it->second->timerId == id) {
|
||||
for (auto & it : saverMap) {
|
||||
if (it.second->timerId == id) {
|
||||
try {
|
||||
saveDocument(it->first, *it->second);
|
||||
it->second->touched.clear();
|
||||
saveDocument(it.first, *it.second);
|
||||
it.second->touched.clear();
|
||||
break;
|
||||
}
|
||||
catch (...) {
|
||||
Base::Console().Error("Failed to auto-save document '%s'\n", it->first.c_str());
|
||||
Base::Console().Error("Failed to auto-save document '%s'\n", it.first.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,11 +75,11 @@ void Std_TestQM::activated(int iMsg)
|
||||
if (!files.empty()) {
|
||||
Translator::instance()->activateLanguage("English");
|
||||
QList<QTranslator*> i18n = qApp->findChildren<QTranslator*>();
|
||||
for (QList<QTranslator*>::Iterator it = i18n.begin(); it != i18n.end(); ++it)
|
||||
qApp->removeTranslator(*it);
|
||||
for (QStringList::Iterator it = files.begin(); it != files.end(); ++it) {
|
||||
for (QTranslator* it : i18n)
|
||||
qApp->removeTranslator(it);
|
||||
for (const QString& it : files) {
|
||||
auto translator = new QTranslator(qApp);
|
||||
if (translator->load(*it)) {
|
||||
if (translator->load(it)) {
|
||||
qApp->installTranslator(translator);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -933,9 +933,9 @@ void Model::mousePressEvent(QGraphicsSceneMouseEvent* event)
|
||||
QPointF currentPickPoint = event->scenePos();
|
||||
QGraphicsLineItem intersectionLine(QLineF(lastPick, currentPickPoint));
|
||||
QList<QGraphicsItem *>selection = collidingItems(&intersectionLine);
|
||||
for (auto currentItem = selection.begin(); currentItem != selection.end(); ++currentItem)
|
||||
for (auto currentItem : selection)
|
||||
{
|
||||
auto rect = dynamic_cast<RectItem *>(*currentItem);
|
||||
auto rect = dynamic_cast<RectItem *>(currentItem);
|
||||
if (!rect) continue;
|
||||
const GraphLinkRecord &selectionRecord = findRecord(rect, *graphLink);
|
||||
Gui::Selection().addSelection(selectionRecord.DObject->getDocument()->getName(),
|
||||
|
||||
@@ -63,14 +63,14 @@ DlgActivateWindowImp::DlgActivateWindowImp(QWidget* parent, Qt::WindowFlags fl)
|
||||
|
||||
QWidget* activeWnd = getMainWindow()->activeWindow();
|
||||
|
||||
for (QList<QWidget*>::Iterator it = windows.begin(); it != windows.end(); ++it) {
|
||||
for (QWidget* it : windows) {
|
||||
auto item = new QTreeWidgetItem(ui->treeWidget);
|
||||
QString title = (*it)->windowTitle();
|
||||
QString title = it->windowTitle();
|
||||
title.replace(QLatin1String("[*]"), QLatin1String(""));
|
||||
if ((*it)->isWindowModified())
|
||||
if (it->isWindowModified())
|
||||
title += QLatin1String("*");
|
||||
item->setText(0, title);
|
||||
if (*it == activeWnd)
|
||||
if (it == activeWnd)
|
||||
active = item;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,9 +83,9 @@ DlgCustomizeImp::DlgCustomizeImp(QWidget* parent, Qt::WindowFlags fl)
|
||||
|
||||
// make sure that pages are ready to create
|
||||
GetWidgetFactorySupplier();
|
||||
for (QList<QByteArray>::Iterator it = _pages.begin(); it!=_pages.end(); ++it)
|
||||
for (const QByteArray& it : _pages)
|
||||
{
|
||||
addPage(WidgetFactory().createWidget((*it).constData()));
|
||||
addPage(WidgetFactory().createWidget(it.constData()));
|
||||
}
|
||||
|
||||
customLayout->addWidget(tabWidget, 0, 0);
|
||||
|
||||
@@ -348,8 +348,7 @@ void DlgCustomKeyboardImp::populatePriorityList(QTreeWidget *priorityList,
|
||||
|
||||
auto actionList = ShortcutManager::instance()->getActionsByShortcut(sc);
|
||||
QTreeWidgetItem *currentItem = nullptr;
|
||||
for (size_t i=0; i<actionList.size(); ++i) {
|
||||
const auto &info = actionList[i];
|
||||
for (const auto &info : actionList) {
|
||||
if (!info.second)
|
||||
continue;
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(priorityList);
|
||||
@@ -397,10 +396,10 @@ void DlgCustomKeyboardImp::populateCommandGroups(QComboBox *combo)
|
||||
}
|
||||
groupMap.push_back(std::make_pair(QLatin1String("All"), tr("All")));
|
||||
|
||||
for (GroupMap::iterator it = groupMap.begin(); it != groupMap.end(); ++it) {
|
||||
if (combo->findData(it->first) < 0) {
|
||||
combo->addItem(it->second);
|
||||
combo->setItemData(combo->count()-1, QVariant(it->first), Qt::UserRole);
|
||||
for (const auto & it : groupMap) {
|
||||
if (combo->findData(it.first) < 0) {
|
||||
combo->addItem(it.second);
|
||||
combo->setItemData(combo->count()-1, QVariant(it.first), Qt::UserRole);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,8 +124,8 @@ DlgUnitsCalculator::DlgUnitsCalculator( QWidget* parent, Qt::WindowFlags fl )
|
||||
<< Base::Unit::VolumeFlowRate
|
||||
<< Base::Unit::VolumetricThermalExpansionCoefficient
|
||||
<< Base::Unit::Work;
|
||||
for (QList<Base::Unit>::iterator it = units.begin(); it != units.end(); ++it) {
|
||||
ui->unitsBox->addItem(it->getTypeString());
|
||||
for (const Base::Unit& it : units) {
|
||||
ui->unitsBox->addItem(it.getTypeString());
|
||||
}
|
||||
|
||||
ui->quantitySpinBox->setValue(1.0);
|
||||
|
||||
@@ -2438,8 +2438,8 @@ void Document::handleChildren3D(ViewProvider* viewProvider, bool deleting)
|
||||
backGroup->addChild(childBackNode);
|
||||
|
||||
// cycling to all views of the document to remove the viewprovider from the viewer itself
|
||||
for (std::list<Gui::BaseView*>::iterator vIt = d->baseViews.begin();vIt != d->baseViews.end();++vIt) {
|
||||
auto activeView = dynamic_cast<View3DInventor *>(*vIt);
|
||||
for (Gui::BaseView* vIt : d->baseViews) {
|
||||
auto activeView = dynamic_cast<View3DInventor *>(vIt);
|
||||
if (activeView && activeView->getViewer()->hasViewProvider(ChildViewProvider)) {
|
||||
// @Note hasViewProvider()
|
||||
// remove the viewprovider serves the purpose of detaching the inventor nodes from the
|
||||
|
||||
@@ -269,8 +269,8 @@ PyObject* DocumentPy::mdiViewsOfType(PyObject *args)
|
||||
PY_TRY {
|
||||
std::list<Gui::MDIView*> views = getDocumentPtr()->getMDIViewsOfType(type);
|
||||
Py::List list;
|
||||
for (auto it = views.begin(); it != views.end(); ++it)
|
||||
list.append(Py::asObject((*it)->getPyObject()));
|
||||
for (auto it : views)
|
||||
list.append(Py::asObject(it->getPyObject()));
|
||||
return Py::new_reference_to(list);
|
||||
}
|
||||
PY_CATCH;
|
||||
|
||||
@@ -114,13 +114,13 @@ QUrl DownloadManager::redirectUrl(const QUrl& url) const
|
||||
if (url.host() == QLatin1String("www.dropbox.com")) {
|
||||
QUrlQuery urlQuery(url);
|
||||
QList< QPair<QString, QString> > query = urlQuery.queryItems();
|
||||
for (QList< QPair<QString, QString> >::iterator it = query.begin(); it != query.end(); ++it) {
|
||||
if (it->first == QLatin1String("dl")) {
|
||||
if (it->second == QLatin1String("0\r\n")) {
|
||||
for (const auto & it : query) {
|
||||
if (it.first == QLatin1String("dl")) {
|
||||
if (it.second == QLatin1String("0\r\n")) {
|
||||
urlQuery.removeQueryItem(QLatin1String("dl"));
|
||||
urlQuery.addQueryItem(QLatin1String("dl"), QLatin1String("1\r\n"));
|
||||
}
|
||||
else if (it->second == QLatin1String("0")) {
|
||||
else if (it.second == QLatin1String("0")) {
|
||||
urlQuery.removeQueryItem(QLatin1String("dl"));
|
||||
urlQuery.addQueryItem(QLatin1String("dl"), QLatin1String("1"));
|
||||
}
|
||||
|
||||
@@ -254,8 +254,7 @@ void FlagLayout::setGeometry(const QRect &rect)
|
||||
QLayout::setGeometry(rect);
|
||||
|
||||
// left side
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
ItemWrapper *wrapper = list.at(i);
|
||||
for (ItemWrapper *wrapper : list) {
|
||||
QLayoutItem *item = wrapper->item;
|
||||
Position position = wrapper->position;
|
||||
|
||||
@@ -275,8 +274,7 @@ void FlagLayout::setGeometry(const QRect &rect)
|
||||
// right side
|
||||
topHeight = 0;
|
||||
bottomHeight = 0;
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
ItemWrapper *wrapper = list.at(i);
|
||||
for (ItemWrapper *wrapper : list) {
|
||||
QLayoutItem *item = wrapper->item;
|
||||
Position position = wrapper->position;
|
||||
|
||||
@@ -318,8 +316,7 @@ QSize FlagLayout::calculateSize(SizeType sizeType) const
|
||||
{
|
||||
QSize totalSize;
|
||||
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
ItemWrapper *wrapper = list.at(i);
|
||||
for (ItemWrapper *wrapper : list) {
|
||||
QSize itemSize;
|
||||
|
||||
if (sizeType == MinimumSize)
|
||||
|
||||
@@ -429,8 +429,8 @@ void Polyline::paintGL()
|
||||
if (closed && !stippled) {
|
||||
glBegin(GL_LINE_LOOP);
|
||||
|
||||
for (std::vector<QPoint>::iterator it = _cNodeVector.begin(); it != _cNodeVector.end(); ++it) {
|
||||
glVertex2i(it->x(), it->y());
|
||||
for (const QPoint& it : _cNodeVector) {
|
||||
glVertex2i(it.x(), it.y());
|
||||
}
|
||||
|
||||
glEnd();
|
||||
@@ -439,10 +439,10 @@ void Polyline::paintGL()
|
||||
glBegin(GL_LINES);
|
||||
|
||||
QPoint start = _cNodeVector.front();
|
||||
for (std::vector<QPoint>::iterator it = _cNodeVector.begin(); it != _cNodeVector.end(); ++it) {
|
||||
for (const QPoint& it : _cNodeVector) {
|
||||
glVertex2i(start.x(), start.y());
|
||||
start = *it;
|
||||
glVertex2i(it->x(), it->y());
|
||||
start = it;
|
||||
glVertex2i(it.x(), it.y());
|
||||
}
|
||||
|
||||
glEnd();
|
||||
|
||||
@@ -455,16 +455,16 @@ bool GraphvizView::onMsg(const char* pMsg,const char**)
|
||||
//formatMap << qMakePair(tr("VRML format (*.vrml)"), QString::fromLatin1("vrml"));
|
||||
|
||||
QStringList filter;
|
||||
for (QList< QPair<QString, QString> >::iterator it = formatMap.begin(); it != formatMap.end(); ++it)
|
||||
filter << it->first;
|
||||
for (const auto & it : formatMap)
|
||||
filter << it.first;
|
||||
|
||||
QString selectedFilter;
|
||||
QString fn = Gui::FileDialog::getSaveFileName(this, tr("Export graph"), QString(), filter.join(QLatin1String(";;")), &selectedFilter);
|
||||
if (!fn.isEmpty()) {
|
||||
QString format;
|
||||
for (QList< QPair<QString, QString> >::iterator it = formatMap.begin(); it != formatMap.end(); ++it) {
|
||||
if (selectedFilter == it->first) {
|
||||
format = it->second;
|
||||
for (const auto & it : formatMap) {
|
||||
if (selectedFilter == it.first) {
|
||||
format = it.second;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -559,9 +559,9 @@ int MarkerBitmaps::getMarkerIndex(const std::string& name, int px)
|
||||
std::list<int> MarkerBitmaps::getSupportedSizes(const std::string& name)
|
||||
{
|
||||
std::list<int> sizes;
|
||||
for (std::map<Marker, int>::iterator it = markerIndex.begin(); it != markerIndex.end(); ++it) {
|
||||
if (it->first.first == name)
|
||||
sizes.push_back(it->first.second);
|
||||
for (const auto & it : markerIndex) {
|
||||
if (it.first.first == name)
|
||||
sizes.push_back(it.first.second);
|
||||
}
|
||||
return sizes;
|
||||
}
|
||||
|
||||
@@ -345,8 +345,8 @@ void Translator::refresh()
|
||||
std::map<std::string, std::string>::iterator tld = d->mapLanguageTopLevelDomain.find(d->activatedLanguage);
|
||||
if (tld == d->mapLanguageTopLevelDomain.end())
|
||||
return; // no language activated
|
||||
for (QStringList::iterator it = d->paths.begin(); it != d->paths.end(); ++it) {
|
||||
QDir dir(*it);
|
||||
for (const QString& it : d->paths) {
|
||||
QDir dir(it);
|
||||
installQMFiles(dir, tld->second.c_str());
|
||||
}
|
||||
}
|
||||
@@ -356,9 +356,9 @@ void Translator::refresh()
|
||||
*/
|
||||
void Translator::removeTranslators()
|
||||
{
|
||||
for (std::list<QTranslator*>::iterator it = d->translators.begin(); it != d->translators.end(); ++it) {
|
||||
qApp->removeTranslator(*it);
|
||||
delete *it;
|
||||
for (QTranslator* it : d->translators) {
|
||||
qApp->removeTranslator(it);
|
||||
delete it;
|
||||
}
|
||||
|
||||
d->translators.clear();
|
||||
|
||||
@@ -113,8 +113,8 @@ MergeDocuments::importObjects(std::istream& input)
|
||||
void MergeDocuments::importObject(const std::vector<App::DocumentObject*>& o, Base::XMLReader & r)
|
||||
{
|
||||
objects = o;
|
||||
for (std::vector<App::DocumentObject*>::iterator it = objects.begin(); it != objects.end(); ++it) {
|
||||
Gui::ViewProvider* vp = document->getViewProvider(*it);
|
||||
for (auto it : objects) {
|
||||
Gui::ViewProvider* vp = document->getViewProvider(it);
|
||||
if (vp) vp->hide();
|
||||
}
|
||||
Restore(r);
|
||||
|
||||
@@ -703,9 +703,9 @@ void PrefQuantitySpinBox::contextMenuEvent(QContextMenuEvent *event)
|
||||
|
||||
// data structure to remember actions for values
|
||||
QStringList history = d->history.asStringList();
|
||||
for (QStringList::const_iterator it = history.cbegin();it != history.cend(); ++it) {
|
||||
QAction* action = menu->addAction(*it);
|
||||
action->setProperty("history_value", *it);
|
||||
for (const auto & it : history) {
|
||||
QAction* action = menu->addAction(it);
|
||||
action->setProperty("history_value", it);
|
||||
}
|
||||
|
||||
// add the save value portion of the menu
|
||||
|
||||
@@ -887,8 +887,8 @@ void PythonConsole::runSource(const QString& line)
|
||||
PySys_SetObject("stdout", default_stdout);
|
||||
PySys_SetObject("stderr", default_stderr);
|
||||
d->interactive = false;
|
||||
for (QStringList::Iterator it = d->statements.begin(); it != d->statements.end(); ++it) {
|
||||
printStatement(*it);
|
||||
for (const auto & it : d->statements) {
|
||||
printStatement(it);
|
||||
}
|
||||
d->statements.clear();
|
||||
}
|
||||
|
||||
@@ -45,8 +45,8 @@ Breakpoint::Breakpoint()
|
||||
Breakpoint::Breakpoint(const Breakpoint& rBp)
|
||||
{
|
||||
setFilename(rBp.filename());
|
||||
for (std::set<int>::const_iterator it = rBp._linenums.begin(); it != rBp._linenums.end(); ++it)
|
||||
_linenums.insert(*it);
|
||||
for (int it : rBp._linenums)
|
||||
_linenums.insert(it);
|
||||
}
|
||||
|
||||
Breakpoint& Breakpoint::operator= (const Breakpoint& rBp)
|
||||
@@ -55,8 +55,8 @@ Breakpoint& Breakpoint::operator= (const Breakpoint& rBp)
|
||||
return *this;
|
||||
setFilename(rBp.filename());
|
||||
_linenums.clear();
|
||||
for (std::set<int>::const_iterator it = rBp._linenums.begin(); it != rBp._linenums.end(); ++it)
|
||||
_linenums.insert(*it);
|
||||
for (int it : rBp._linenums)
|
||||
_linenums.insert(it);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -88,10 +88,10 @@ bool Breakpoint::checkLine(int line)
|
||||
int Breakpoint::lineIndex(int ind)const
|
||||
{
|
||||
int i = 0;
|
||||
for (std::set<int>::const_iterator it = _linenums.begin(); it != _linenums.end(); ++it)
|
||||
for (int it : _linenums)
|
||||
{
|
||||
if (ind == i++)
|
||||
return *it;
|
||||
return it;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@@ -320,7 +320,7 @@ namespace Gui {
|
||||
class PythonDebuggerPy : public Py::PythonExtension<PythonDebuggerPy>
|
||||
{
|
||||
public:
|
||||
PythonDebuggerPy(PythonDebugger* d) : dbg(d), depth(0) { }
|
||||
explicit PythonDebuggerPy(PythonDebugger* d) : dbg(d), depth(0) { }
|
||||
~PythonDebuggerPy() override {}
|
||||
PythonDebugger* dbg;
|
||||
int depth;
|
||||
@@ -329,7 +329,7 @@ public:
|
||||
class RunningState
|
||||
{
|
||||
public:
|
||||
RunningState(bool& s) : state(s)
|
||||
explicit RunningState(bool& s) : state(s)
|
||||
{ state = true; }
|
||||
~RunningState()
|
||||
{ state = false; }
|
||||
@@ -350,7 +350,7 @@ struct PythonDebuggerP {
|
||||
PyObject* pydbg;
|
||||
std::vector<Breakpoint> bps;
|
||||
|
||||
PythonDebuggerP(PythonDebugger* that) :
|
||||
explicit PythonDebuggerP(PythonDebugger* that) :
|
||||
init(false), trystop(false), running(false)
|
||||
{
|
||||
out_o = nullptr;
|
||||
@@ -388,9 +388,9 @@ PythonDebugger::~PythonDebugger()
|
||||
|
||||
Breakpoint PythonDebugger::getBreakpoint(const QString& fn) const
|
||||
{
|
||||
for (std::vector<Breakpoint>::const_iterator it = d->bps.begin(); it != d->bps.end(); ++it) {
|
||||
if (fn == it->filename()) {
|
||||
return *it;
|
||||
for (const Breakpoint& it : d->bps) {
|
||||
if (fn == it.filename()) {
|
||||
return it;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -399,14 +399,14 @@ Breakpoint PythonDebugger::getBreakpoint(const QString& fn) const
|
||||
|
||||
bool PythonDebugger::toggleBreakpoint(int line, const QString& fn)
|
||||
{
|
||||
for (std::vector<Breakpoint>::iterator it = d->bps.begin(); it != d->bps.end(); ++it) {
|
||||
if (fn == it->filename()) {
|
||||
if (it->checkLine(line)) {
|
||||
it->removeLine(line);
|
||||
for (Breakpoint& it : d->bps) {
|
||||
if (fn == it.filename()) {
|
||||
if (it.checkLine(line)) {
|
||||
it.removeLine(line);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
it->addLine(line);
|
||||
it.addLine(line);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1150,8 +1150,7 @@ bool SelectionSingleton::addSelection(const SelectionObject& obj, bool clearPres
|
||||
}
|
||||
else if (!subNames.empty()) {
|
||||
bool ok = true;
|
||||
for (std::size_t i=0; i<subNames.size(); i++) {
|
||||
const std::string& name = subNames[i];
|
||||
for (const std::string& name : subNames) {
|
||||
ok &= addSelection(obj.getDocName(), obj.getFeatName(), name.c_str());
|
||||
}
|
||||
return ok;
|
||||
|
||||
@@ -96,8 +96,8 @@ std::string SelectionObject::getAsPropertyLinkSubString()const
|
||||
{
|
||||
std::ostringstream str;
|
||||
str << "(" << Gui::Command::getObjectCmd(getObject()) << ",[";
|
||||
for(std::vector<std::string>::const_iterator it = SubNames.begin();it!=SubNames.end();++it)
|
||||
str << "'" << *it << "',";
|
||||
for(const auto & it : SubNames)
|
||||
str << "'" << it << "',";
|
||||
str << "])";
|
||||
return str.str();
|
||||
}
|
||||
|
||||
@@ -202,21 +202,21 @@ void SelectionView::onSelectionChanged(const SelectionChanges &Reason)
|
||||
// remove all items
|
||||
selectionView->clear();
|
||||
std::vector<SelectionSingleton::SelObj> objs = Gui::Selection().getSelection(Reason.pDocName, ResolveMode::NoResolve);
|
||||
for (std::vector<SelectionSingleton::SelObj>::iterator it = objs.begin(); it != objs.end(); ++it) {
|
||||
for (const auto & it : objs) {
|
||||
// save as user data
|
||||
QStringList list;
|
||||
list << QString::fromLatin1(it->DocName);
|
||||
list << QString::fromLatin1(it->FeatName);
|
||||
list << QString::fromLatin1(it.DocName);
|
||||
list << QString::fromLatin1(it.FeatName);
|
||||
|
||||
// build name
|
||||
str << it->DocName;
|
||||
str << it.DocName;
|
||||
str << "#";
|
||||
str << it->FeatName;
|
||||
App::Document* doc = App::GetApplication().getDocument(it->DocName);
|
||||
App::DocumentObject* obj = doc->getObject(it->FeatName);
|
||||
if (it->SubName && it->SubName[0] != '\0') {
|
||||
str << it.FeatName;
|
||||
App::Document* doc = App::GetApplication().getDocument(it.DocName);
|
||||
App::DocumentObject* obj = doc->getObject(it.FeatName);
|
||||
if (it.SubName && it.SubName[0] != '\0') {
|
||||
str << ".";
|
||||
str << it->SubName;
|
||||
str << it.SubName;
|
||||
auto subObj = obj->getSubObject(Reason.pSubName);
|
||||
if(subObj)
|
||||
obj = subObj;
|
||||
@@ -280,20 +280,20 @@ void SelectionView::search(const QString& text)
|
||||
if (doc) {
|
||||
objects = doc->getObjects();
|
||||
selectionView->clear();
|
||||
for (std::vector<App::DocumentObject*>::iterator it = objects.begin(); it != objects.end(); ++it) {
|
||||
QString label = QString::fromUtf8((*it)->Label.getValue());
|
||||
for (auto it : objects) {
|
||||
QString label = QString::fromUtf8(it->Label.getValue());
|
||||
if (label.contains(text,Qt::CaseInsensitive)) {
|
||||
searchList.push_back(*it);
|
||||
searchList.push_back(it);
|
||||
// save as user data
|
||||
QString selObject;
|
||||
QTextStream str(&selObject);
|
||||
QStringList list;
|
||||
list << QString::fromLatin1(doc->getName());
|
||||
list << QString::fromLatin1((*it)->getNameInDocument());
|
||||
list << QString::fromLatin1(it->getNameInDocument());
|
||||
// build name
|
||||
str << QString::fromUtf8(doc->Label.getValue());
|
||||
str << "#";
|
||||
str << (*it)->getNameInDocument();
|
||||
str << it->getNameInDocument();
|
||||
str << " (";
|
||||
str << label;
|
||||
str << ")";
|
||||
@@ -312,8 +312,8 @@ void SelectionView::validateSearch()
|
||||
App::Document* doc = App::GetApplication().getActiveDocument();
|
||||
if (doc) {
|
||||
Gui::Selection().clearSelection();
|
||||
for (std::vector<App::DocumentObject*>::iterator it = searchList.begin(); it != searchList.end(); ++it) {
|
||||
Gui::Selection().addSelection(doc->getName(),(*it)->getNameInDocument(),nullptr);
|
||||
for (auto it : searchList) {
|
||||
Gui::Selection().addSelection(doc->getName(),it->getNameInDocument(),nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -664,11 +664,11 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action)
|
||||
corners.push_back(textOffset - dir * (this->imgWidth / 2 + margin) - normal * margin);
|
||||
|
||||
float minX = p1[0], minY = p1[1], maxX = p1[0] , maxY = p1[1];
|
||||
for (std::vector<SbVec3f>::const_iterator it=corners.begin(); it != corners.end(); ++it) {
|
||||
minX = ((*it)[0] < minX) ? (*it)[0] : minX;
|
||||
minY = ((*it)[1] < minY) ? (*it)[1] : minY;
|
||||
maxX = ((*it)[0] > maxX) ? (*it)[0] : maxX;
|
||||
maxY = ((*it)[1] > maxY) ? (*it)[1] : maxY;
|
||||
for (SbVec3f it : corners) {
|
||||
minX = (it[0] < minX) ? it[0] : minX;
|
||||
minY = (it[1] < minY) ? it[1] : minY;
|
||||
maxX = (it[0] > maxX) ? it[0] : maxX;
|
||||
maxY = (it[1] > maxY) ? it[1] : maxY;
|
||||
}
|
||||
//Store the bounding box
|
||||
this->bbox.setBounds(SbVec3f(minX, minY, 0.f), SbVec3f (maxX, maxY, 0.f));
|
||||
@@ -750,11 +750,11 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action)
|
||||
corners.push_back(pnt2);
|
||||
|
||||
float minX = p1[0], minY = p1[1], maxX = p1[0] , maxY = p1[1];
|
||||
for (std::vector<SbVec3f>::const_iterator it=corners.begin(); it != corners.end(); ++it) {
|
||||
minX = ((*it)[0] < minX) ? (*it)[0] : minX;
|
||||
minY = ((*it)[1] < minY) ? (*it)[1] : minY;
|
||||
maxX = ((*it)[0] > maxX) ? (*it)[0] : maxX;
|
||||
maxY = ((*it)[1] > maxY) ? (*it)[1] : maxY;
|
||||
for (SbVec3f it : corners) {
|
||||
minX = (it[0] < minX) ? it[0] : minX;
|
||||
minY = (it[1] < minY) ? it[1] : minY;
|
||||
maxX = (it[0] > maxX) ? it[0] : maxX;
|
||||
maxY = (it[1] > maxY) ? it[1] : maxY;
|
||||
}
|
||||
//Store the bounding box
|
||||
this->bbox.setBounds(SbVec3f(minX, minY, 0.f), SbVec3f (maxX, maxY, 0.f));
|
||||
@@ -852,11 +852,11 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action)
|
||||
corners.push_back(img4);
|
||||
|
||||
float minX = pnt1[0], minY = pnt1[1], maxX = pnt1[0] , maxY = pnt1[1];
|
||||
for (std::vector<SbVec3f>::const_iterator it=corners.begin(); it != corners.end(); ++it) {
|
||||
minX = ((*it)[0] < minX) ? (*it)[0] : minX;
|
||||
minY = ((*it)[1] < minY) ? (*it)[1] : minY;
|
||||
maxX = ((*it)[0] > maxX) ? (*it)[0] : maxX;
|
||||
maxY = ((*it)[1] > maxY) ? (*it)[1] : maxY;
|
||||
for (SbVec3f it : corners) {
|
||||
minX = (it[0] < minX) ? it[0] : minX;
|
||||
minY = (it[1] < minY) ? it[1] : minY;
|
||||
maxX = (it[0] > maxX) ? it[0] : maxX;
|
||||
maxY = (it[1] > maxY) ? it[1] : maxY;
|
||||
}
|
||||
//Store the bounding box
|
||||
this->bbox.setBounds(SbVec3f(minX, minY, 0.f), SbVec3f (maxX, maxY, 0.f));
|
||||
@@ -910,11 +910,11 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action)
|
||||
corners.push_back(p2);
|
||||
|
||||
float minX = p1[0], minY = p1[1], maxX = p1[0] , maxY = p1[1];
|
||||
for (std::vector<SbVec3f>::iterator it=corners.begin(); it != corners.end(); ++it) {
|
||||
minX = ((*it)[0] < minX) ? (*it)[0] : minX;
|
||||
minY = ((*it)[1] < minY) ? (*it)[1] : minY;
|
||||
maxX = ((*it)[0] > maxX) ? (*it)[0] : maxX;
|
||||
maxY = ((*it)[1] > maxY) ? (*it)[1] : maxY;
|
||||
for (SbVec3f it : corners) {
|
||||
minX = (it[0] < minX) ? it[0] : minX;
|
||||
minY = (it[1] < minY) ? it[1] : minY;
|
||||
maxX = (it[0] > maxX) ? it[0] : maxX;
|
||||
maxY = (it[1] > maxY) ? it[1] : maxY;
|
||||
}
|
||||
//Store the bounding box
|
||||
this->bbox.setBounds(SbVec3f(minX, minY, 0.f), SbVec3f (maxX, maxY, 0.f));
|
||||
@@ -1029,4 +1029,4 @@ void SoDatumLabel::setPoints(SbVec3f p1, SbVec3f p2)
|
||||
verts[0] = p1;
|
||||
verts[1] = p2;
|
||||
pnts.finishEditing();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace Gui {
|
||||
class SoFCColorBarProxyObject : public QObject
|
||||
{
|
||||
public:
|
||||
SoFCColorBarProxyObject(SoFCColorBar* b)
|
||||
explicit SoFCColorBarProxyObject(SoFCColorBar* b)
|
||||
: QObject(nullptr), bar(b) {}
|
||||
~SoFCColorBarProxyObject() override {}
|
||||
void customEvent(QEvent *) override
|
||||
@@ -190,8 +190,8 @@ SoFCColorBar::SoFCColorBar()
|
||||
_colorBars.push_back( new SoFCColorGradient );
|
||||
_colorBars.push_back( new SoFCColorLegend );
|
||||
|
||||
for (std::vector<SoFCColorBarBase*>::const_iterator it = _colorBars.begin(); it != _colorBars.end(); ++it)
|
||||
pColorMode->addChild( *it );
|
||||
for (auto it : _colorBars)
|
||||
pColorMode->addChild(it);
|
||||
pColorMode->whichChild = 0;
|
||||
}
|
||||
|
||||
@@ -227,14 +227,14 @@ void SoFCColorBar::setViewportSize( const SbVec2s& size )
|
||||
|
||||
void SoFCColorBar::setRange( float fMin, float fMax, int prec )
|
||||
{
|
||||
for (std::vector<SoFCColorBarBase*>::const_iterator it = _colorBars.begin(); it != _colorBars.end(); ++it)
|
||||
(*it)->setRange(fMin, fMax, prec);
|
||||
for (auto it : _colorBars)
|
||||
it->setRange(fMin, fMax, prec);
|
||||
}
|
||||
|
||||
void SoFCColorBar::setOutsideGrayed (bool bVal)
|
||||
{
|
||||
for (std::vector<SoFCColorBarBase*>::const_iterator it = _colorBars.begin(); it != _colorBars.end(); ++it)
|
||||
(*it)->setOutsideGrayed(bVal);
|
||||
for (auto it : _colorBars)
|
||||
it->setOutsideGrayed(bVal);
|
||||
}
|
||||
|
||||
bool SoFCColorBar::isVisible (float fVal) const
|
||||
@@ -318,10 +318,10 @@ void SoFCColorBar::handleEvent (SoHandleEventAction *action)
|
||||
SoFCColorBarBase* current = getActiveBar();
|
||||
QMenu menu;
|
||||
int i=0;
|
||||
for (std::vector<SoFCColorBarBase*>::const_iterator it = _colorBars.begin(); it != _colorBars.end(); ++it) {
|
||||
QAction* item = menu.addAction(QObject::tr((*it)->getColorBarName()));
|
||||
for (auto it : _colorBars) {
|
||||
QAction* item = menu.addAction(QObject::tr(it->getColorBarName()));
|
||||
item->setCheckable(true);
|
||||
item->setChecked((*it) == current);
|
||||
item->setChecked(it == current);
|
||||
item->setData(QVariant(i++));
|
||||
}
|
||||
|
||||
|
||||
@@ -140,9 +140,9 @@ void SoFCOffscreenRenderer::writeToImageFile(const char* filename, const char* c
|
||||
bool supported = false;
|
||||
QByteArray format;
|
||||
QList<QByteArray> qtformats = QImageWriter::supportedImageFormats();
|
||||
for (QList<QByteArray>::Iterator it = qtformats.begin(); it != qtformats.end(); ++it) {
|
||||
if (file.hasExtension((*it).data())) {
|
||||
format = *it;
|
||||
for (const auto & it : qtformats) {
|
||||
if (file.hasExtension(it.data())) {
|
||||
format = it;
|
||||
supported = true;
|
||||
break;
|
||||
}
|
||||
@@ -243,10 +243,10 @@ QStringList SoFCOffscreenRenderer::getWriteImageFiletypeInfo()
|
||||
|
||||
// add now all further QImage formats
|
||||
QList<QByteArray> qtformats = QImageWriter::supportedImageFormats();
|
||||
for (QList<QByteArray>::Iterator it = qtformats.begin(); it != qtformats.end(); ++it) {
|
||||
for (const auto & it : qtformats) {
|
||||
// not supported? then append
|
||||
if (!isWriteSupported((*it).data()) && formats.indexOf(QLatin1String(*it)) == -1)
|
||||
formats << QLatin1String(*it);
|
||||
if (!isWriteSupported(it.data()) && formats.indexOf(QLatin1String(it)) == -1)
|
||||
formats << QLatin1String(it);
|
||||
}
|
||||
|
||||
// now add PostScript and SGI RGB
|
||||
@@ -740,8 +740,8 @@ QStringList SoQtOffscreenRenderer::getWriteImageFiletypeInfo() const
|
||||
QList<QByteArray> qtformats = QImageWriter::supportedImageFormats();
|
||||
|
||||
QStringList formats;
|
||||
for (QList<QByteArray>::Iterator it = qtformats.begin(); it != qtformats.end(); ++it) {
|
||||
formats << QLatin1String(*it);
|
||||
for (const auto & it : qtformats) {
|
||||
formats << QLatin1String(it);
|
||||
}
|
||||
formats.sort();
|
||||
return formats;
|
||||
|
||||
@@ -733,9 +733,9 @@ void AboutDialog::showLibraryInformation()
|
||||
QTextStream out(&html);
|
||||
out << "<html><head/><body style=\" font-size:8.25pt; font-weight:400; font-style:normal;\">"
|
||||
<< "<p>" << msg << "<br/></p>\n<ul>\n";
|
||||
for (QList<LibraryInfo>::iterator it = libInfo.begin(); it != libInfo.end(); ++it) {
|
||||
out << "<li><p>" << it->name << " " << it->version << "</p>"
|
||||
"<p><a href=\"" << it->href << "\">" << it->url
|
||||
for (const auto & it : libInfo) {
|
||||
out << "<li><p>" << it.name << " " << it.version << "</p>"
|
||||
"<p><a href=\"" << it.href << "\">" << it.url
|
||||
<< "</a><br/></p></li>\n";
|
||||
}
|
||||
out << "</ul>\n</body>\n</html>";
|
||||
|
||||
@@ -48,9 +48,9 @@ TaskDialog::TaskDialog()
|
||||
|
||||
TaskDialog::~TaskDialog()
|
||||
{
|
||||
for (std::vector<QWidget*>::iterator it=Content.begin();it!=Content.end();++it) {
|
||||
delete *it;
|
||||
*it = 0;
|
||||
for (auto it : Content) {
|
||||
delete it;
|
||||
it = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -129,9 +129,9 @@ void TaskSelectLinkProperty::activate()
|
||||
std::string ObjName = StartObject->getNameInDocument();
|
||||
std::string DocName = StartObject->getDocument()->getName();
|
||||
|
||||
for (std::vector<std::string>::const_iterator it = StartValueBuffer.begin();it!=StartValueBuffer.end();++it)
|
||||
for (const auto & it : StartValueBuffer)
|
||||
{
|
||||
Gui::Selection().addSelection(DocName.c_str(),ObjName.c_str(),it->c_str());
|
||||
Gui::Selection().addSelection(DocName.c_str(),ObjName.c_str(),it.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -604,8 +604,8 @@ void TaskView::updateWatcher()
|
||||
void TaskView::addTaskWatcher(const std::vector<TaskWatcher*> &Watcher)
|
||||
{
|
||||
// remove and delete the old set of TaskWatcher
|
||||
for (std::vector<TaskWatcher*>::iterator it=ActiveWatcher.begin();it!=ActiveWatcher.end();++it)
|
||||
delete *it;
|
||||
for (TaskWatcher* tw : ActiveWatcher)
|
||||
delete tw;
|
||||
|
||||
ActiveWatcher = Watcher;
|
||||
addTaskWatcher();
|
||||
@@ -622,10 +622,10 @@ void TaskView::clearTaskWatcher()
|
||||
void TaskView::addTaskWatcher()
|
||||
{
|
||||
// add all widgets for all watcher to the task view
|
||||
for (std::vector<TaskWatcher*>::iterator it=ActiveWatcher.begin();it!=ActiveWatcher.end();++it){
|
||||
std::vector<QWidget*> &cont = (*it)->getWatcherContent();
|
||||
for (std::vector<QWidget*>::iterator it2=cont.begin();it2!=cont.end();++it2){
|
||||
taskPanel->addWidget(*it2);
|
||||
for (TaskWatcher* tw : ActiveWatcher) {
|
||||
std::vector<QWidget*> &cont = tw->getWatcherContent();
|
||||
for (QWidget* w : cont) {
|
||||
taskPanel->addWidget(w);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -668,11 +668,11 @@ void TaskView::removeTaskWatcher()
|
||||
}
|
||||
|
||||
// remove all widgets
|
||||
for (std::vector<TaskWatcher*>::iterator it=ActiveWatcher.begin();it!=ActiveWatcher.end();++it) {
|
||||
std::vector<QWidget*> &cont = (*it)->getWatcherContent();
|
||||
for (std::vector<QWidget*>::iterator it2=cont.begin();it2!=cont.end();++it2) {
|
||||
(*it2)->hide();
|
||||
taskPanel->removeWidget(*it2);
|
||||
for (TaskWatcher* tw : ActiveWatcher) {
|
||||
std::vector<QWidget*> &cont = tw->getWatcherContent();
|
||||
for (QWidget* w : cont) {
|
||||
w->hide();
|
||||
taskPanel->removeWidget(w);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,11 +50,10 @@ TaskWatcher::TaskWatcher(const char* Filter)
|
||||
|
||||
TaskWatcher::~TaskWatcher()
|
||||
{
|
||||
for (std::vector<QWidget*>::iterator it=Content.begin();it!=Content.end();++it){
|
||||
delete(*it);
|
||||
*it = 0;
|
||||
for (auto it : Content) {
|
||||
delete it;
|
||||
it = nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//==== implementer ===========================================================================
|
||||
|
||||
@@ -64,8 +64,8 @@ TextureMapping::TextureMapping(QWidget* parent, Qt::WindowFlags fl)
|
||||
// add all supported QImage formats
|
||||
QStringList formats;
|
||||
QList<QByteArray> qtformats = QImageReader::supportedImageFormats();
|
||||
for (QList<QByteArray>::Iterator it = qtformats.begin(); it != qtformats.end(); ++it) {
|
||||
formats << QString::fromLatin1("*.%1").arg(QLatin1String(*it));
|
||||
for (const auto & it : qtformats) {
|
||||
formats << QString::fromLatin1("*.%1").arg(QLatin1String(it));
|
||||
}
|
||||
|
||||
ui->fileChooser->setFilter(tr("Image files (%1)").arg(formats.join(QLatin1String(" "))));
|
||||
|
||||
@@ -83,40 +83,40 @@ void ToolBoxManager::setup( ToolBarItem* toolBar ) const
|
||||
CommandManager& mgr = Application::Instance->commandManager();
|
||||
QList<ToolBarItem*> items = toolBar->getItems();
|
||||
|
||||
for ( QList<ToolBarItem*>::Iterator item = items.begin(); item != items.end(); ++item )
|
||||
for ( auto item : items )
|
||||
{
|
||||
auto bar = new QToolBar();
|
||||
bar->setOrientation(Qt::Vertical);
|
||||
bar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
std::string toolbarName = (*item)->command();
|
||||
bar->setObjectName(QString::fromLatin1((*item)->command().c_str()));
|
||||
std::string toolbarName = item->command();
|
||||
bar->setObjectName(QString::fromLatin1(item->command().c_str()));
|
||||
bar->setWindowTitle(QObject::tr(toolbarName.c_str())); // i18n
|
||||
_toolBox->addItem( bar, bar->windowTitle() );
|
||||
|
||||
QList<ToolBarItem*> subitems = (*item)->getItems();
|
||||
for ( QList<ToolBarItem*>::Iterator subitem = subitems.begin(); subitem != subitems.end(); ++subitem )
|
||||
QList<ToolBarItem*> subitems = item->getItems();
|
||||
for (auto subitem : subitems)
|
||||
{
|
||||
if ( (*subitem)->command() == "Separator" ) {
|
||||
if ( subitem->command() == "Separator" ) {
|
||||
//bar->addSeparator();
|
||||
} else {
|
||||
mgr.addTo((*subitem)->command().c_str(), bar);
|
||||
mgr.addTo(subitem->command().c_str(), bar);
|
||||
}
|
||||
}
|
||||
|
||||
// Now set the right size policy for each tool button
|
||||
QList<QToolButton*> tool = bar->findChildren<QToolButton*>();
|
||||
for (QList<QToolButton*>::Iterator it = tool.begin(); it != tool.end(); ++it) {
|
||||
(*it)->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
for (auto it : tool) {
|
||||
it->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
// When setting the horizontal size policy but no icon is set we use the following trick
|
||||
// to make the button text left aligned.
|
||||
QIcon icon = (*it)->icon();
|
||||
QIcon icon = it->icon();
|
||||
if (icon.isNull())
|
||||
{
|
||||
// Create an icon filled with the button color
|
||||
int size = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize);
|
||||
QPixmap p(size, size);
|
||||
p.fill(Qt::transparent);
|
||||
(*it)->setIcon(p);
|
||||
it->setIcon(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -775,8 +775,8 @@ void View3DInventor::setCurrentViewMode(ViewMode newmode)
|
||||
_viewer->getGLWidget()->setFocusProxy(nullptr);
|
||||
qApp->removeEventFilter(this);
|
||||
QList<QAction*> acts = this->actions();
|
||||
for (QList<QAction*>::Iterator it = acts.begin(); it != acts.end(); ++it)
|
||||
this->removeAction(*it);
|
||||
for (QAction* it : acts)
|
||||
this->removeAction(it);
|
||||
|
||||
// Step two
|
||||
auto mdi = qobject_cast<QMdiSubWindow*>(parentWidget());
|
||||
|
||||
@@ -284,8 +284,8 @@ void LightManip(SoSeparator * root)
|
||||
const char * pointlightnames[3] = { "RedLight", "GreenLight", "BlueLight" };
|
||||
SoSearchAction sa;
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
sa.setName( pointlightnames[i] );
|
||||
for (const char* name : pointlightnames) {
|
||||
sa.setName(name);
|
||||
sa.setInterest( SoSearchAction::FIRST );
|
||||
sa.setSearchingAll( false );
|
||||
sa.apply( root );
|
||||
|
||||
@@ -1805,9 +1805,9 @@ std::list<GLGraphicsItem*> View3DInventorViewer::getGraphicsItems() const
|
||||
std::list<GLGraphicsItem*> View3DInventorViewer::getGraphicsItemsOfType(const Base::Type& type) const
|
||||
{
|
||||
std::list<GLGraphicsItem*> items;
|
||||
for (std::list<GLGraphicsItem*>::const_iterator it = this->graphicsItems.begin(); it != this->graphicsItems.end(); ++it) {
|
||||
if ((*it)->isDerivedFrom(type))
|
||||
items.push_back(*it);
|
||||
for (auto it : this->graphicsItems) {
|
||||
if (it->isDerivedFrom(type))
|
||||
items.push_back(it);
|
||||
}
|
||||
|
||||
return items;
|
||||
@@ -2131,8 +2131,8 @@ void View3DInventorViewer::renderFramebuffer()
|
||||
printDimension();
|
||||
navigation->redraw();
|
||||
|
||||
for (std::list<GLGraphicsItem*>::iterator it = this->graphicsItems.begin(); it != this->graphicsItems.end(); ++it)
|
||||
(*it)->paintGL();
|
||||
for (auto it : this->graphicsItems)
|
||||
it->paintGL();
|
||||
|
||||
if (naviCubeEnabled)
|
||||
naviCube->drawNaviCube();
|
||||
@@ -2163,8 +2163,8 @@ void View3DInventorViewer::renderGLImage()
|
||||
printDimension();
|
||||
navigation->redraw();
|
||||
|
||||
for (std::list<GLGraphicsItem*>::iterator it = this->graphicsItems.begin(); it != this->graphicsItems.end(); ++it)
|
||||
(*it)->paintGL();
|
||||
for (auto it : this->graphicsItems)
|
||||
it->paintGL();
|
||||
|
||||
if (naviCubeEnabled)
|
||||
naviCube->drawNaviCube();
|
||||
@@ -2223,8 +2223,8 @@ void View3DInventorViewer::renderScene()
|
||||
}
|
||||
catch (const Base::MemoryException&) {
|
||||
// FIXME: If this exception appears then the background and camera position get broken somehow. (Werner 2006-02-01)
|
||||
for (std::set<ViewProvider*>::iterator it = _ViewProviderSet.begin(); it != _ViewProviderSet.end(); ++it)
|
||||
(*it)->hide();
|
||||
for (auto it : _ViewProviderSet)
|
||||
it->hide();
|
||||
|
||||
inherited::actualRedraw();
|
||||
QMessageBox::warning(parentWidget(), QObject::tr("Out of memory"),
|
||||
@@ -2260,8 +2260,8 @@ void View3DInventorViewer::renderScene()
|
||||
printDimension();
|
||||
navigation->redraw();
|
||||
|
||||
for (std::list<GLGraphicsItem*>::iterator it = this->graphicsItems.begin(); it != this->graphicsItems.end(); ++it)
|
||||
(*it)->paintGL();
|
||||
for (auto it : this->graphicsItems)
|
||||
it->paintGL();
|
||||
|
||||
//fps rendering
|
||||
if (fpsEnabled) {
|
||||
@@ -2365,9 +2365,9 @@ void View3DInventorViewer::selectAll()
|
||||
{
|
||||
std::vector<App::DocumentObject*> objs;
|
||||
|
||||
for (std::set<ViewProvider*>::iterator it = _ViewProviderSet.begin(); it != _ViewProviderSet.end(); ++it) {
|
||||
if ((*it)->getTypeId().isDerivedFrom(ViewProviderDocumentObject::getClassTypeId())) {
|
||||
auto vp = static_cast<ViewProviderDocumentObject*>(*it);
|
||||
for (auto it : _ViewProviderSet) {
|
||||
if (it->getTypeId().isDerivedFrom(ViewProviderDocumentObject::getClassTypeId())) {
|
||||
auto vp = static_cast<ViewProviderDocumentObject*>(it);
|
||||
App::DocumentObject* obj = vp->getObject();
|
||||
|
||||
if (obj) objs.push_back(obj);
|
||||
|
||||
@@ -236,8 +236,8 @@ View3DInventorPy::View3DInventorPy(View3DInventor *vi)
|
||||
View3DInventorPy::~View3DInventorPy()
|
||||
{
|
||||
Base::PyGILStateLocker lock;
|
||||
for (std::list<PyObject*>::iterator it = callbacks.begin(); it != callbacks.end(); ++it)
|
||||
Py_DECREF(*it);
|
||||
for (auto it : callbacks)
|
||||
Py_DECREF(it);
|
||||
}
|
||||
|
||||
View3DInventor* View3DInventorPy::getView3DIventorPtr()
|
||||
|
||||
@@ -113,8 +113,8 @@ View3DInventorViewerPy::View3DInventorViewerPy(View3DInventorViewer *vi)
|
||||
View3DInventorViewerPy::~View3DInventorViewerPy()
|
||||
{
|
||||
Base::PyGILStateLocker lock;
|
||||
for (std::list<PyObject*>::iterator it = callbacks.begin(); it != callbacks.end(); ++it)
|
||||
Py_DECREF(*it);
|
||||
for (auto it : callbacks)
|
||||
Py_DECREF(it);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -412,9 +412,8 @@ SoNode* ViewProvider::getDisplayMaskMode(const char* type) const
|
||||
std::vector<std::string> ViewProvider::getDisplayMaskModes() const
|
||||
{
|
||||
std::vector<std::string> types;
|
||||
for (std::map<std::string, int>::const_iterator it = _sDisplayMaskModes.begin();
|
||||
it != _sDisplayMaskModes.end(); ++it)
|
||||
types.push_back( it->first );
|
||||
for (const auto & it : _sDisplayMaskModes)
|
||||
types.push_back( it.first );
|
||||
return types;
|
||||
}
|
||||
|
||||
|
||||
@@ -346,8 +346,8 @@ void ViewProviderDocumentObject::attach(App::DocumentObject *pcObj)
|
||||
// We must collect the const char* of the strings and give it to PropertyEnumeration,
|
||||
// but we are still responsible for them, i.e. the property class must not delete the literals.
|
||||
//for (auto it = aDisplayModesArray.begin(); it != aDisplayModesArray.end(); ++it) {
|
||||
for (std::vector<std::string>::iterator it = aDisplayModesArray.begin(); it != aDisplayModesArray.end(); ++it) {
|
||||
aDisplayEnumsArray.push_back( it->c_str() );
|
||||
for (const auto & it : aDisplayModesArray) {
|
||||
aDisplayEnumsArray.push_back( it.c_str() );
|
||||
}
|
||||
aDisplayEnumsArray.push_back(nullptr); // null termination
|
||||
DisplayMode.setEnums(&(aDisplayEnumsArray[0]));
|
||||
|
||||
@@ -409,8 +409,8 @@ PyResource::PyResource() : myDlg(nullptr)
|
||||
PyResource::~PyResource()
|
||||
{
|
||||
delete myDlg;
|
||||
for (std::vector<SignalConnect*>::iterator it = mySignals.begin(); it != mySignals.end(); ++it) {
|
||||
SignalConnect* sc = *it;
|
||||
for (auto it : mySignals) {
|
||||
SignalConnect* sc = it;
|
||||
delete sc;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,8 +54,8 @@ WorkbenchManager::WorkbenchManager() : _activeWorkbench(nullptr)
|
||||
|
||||
WorkbenchManager::~WorkbenchManager()
|
||||
{
|
||||
for (std::map<std::string, Workbench*>::iterator it = _workbenches.begin(); it != _workbenches.end(); ++it) {
|
||||
Workbench* wb = it->second;
|
||||
for (auto & it : _workbenches) {
|
||||
Workbench* wb = it.second;
|
||||
delete wb;
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ Workbench* WorkbenchManager::active() const
|
||||
std::list<std::string> WorkbenchManager::workbenches() const
|
||||
{
|
||||
std::list<std::string> wb;
|
||||
for (std::map<std::string, Workbench*>::const_iterator it = _workbenches.begin(); it != _workbenches.end(); ++it)
|
||||
wb.push_back(it->first);
|
||||
for (const auto & it : _workbenches)
|
||||
wb.push_back(it.first);
|
||||
return wb;
|
||||
}
|
||||
|
||||
@@ -176,11 +176,10 @@ void PropertyItem::setPropertyData(const std::vector<App::Property*>& items)
|
||||
void PropertyItem::updateData()
|
||||
{
|
||||
bool ro = true;
|
||||
for (std::vector<App::Property*>::const_iterator it = propertyItems.begin();
|
||||
it != propertyItems.end(); ++it) {
|
||||
App::PropertyContainer* parent = (*it)->getContainer();
|
||||
for (auto it : propertyItems) {
|
||||
App::PropertyContainer* parent = it->getContainer();
|
||||
if (parent)
|
||||
ro &= (parent->isReadOnly(*it) || (*it)->testStatus(App::Property::ReadOnly));
|
||||
ro &= (parent->isReadOnly(it) || it->testStatus(App::Property::ReadOnly));
|
||||
}
|
||||
this->setReadOnly(ro);
|
||||
}
|
||||
@@ -294,8 +293,8 @@ int PropertyItem::columnCount() const
|
||||
void PropertyItem::setReadOnly(bool ro)
|
||||
{
|
||||
readonly = ro;
|
||||
for (QList<PropertyItem*>::iterator it = childItems.begin(); it != childItems.end(); ++it)
|
||||
(*it)->setReadOnly(ro);
|
||||
for (auto it : childItems)
|
||||
it->setReadOnly(ro);
|
||||
}
|
||||
|
||||
bool PropertyItem::isReadOnly() const
|
||||
@@ -303,11 +302,11 @@ bool PropertyItem::isReadOnly() const
|
||||
return readonly;
|
||||
}
|
||||
|
||||
void PropertyItem::setLinked(bool l)
|
||||
void PropertyItem::setLinked(bool value)
|
||||
{
|
||||
linked = l;
|
||||
for (QList<PropertyItem*>::iterator it = childItems.begin(); it != childItems.end(); ++it)
|
||||
(*it)->setLinked(l);
|
||||
linked = value;
|
||||
for (auto it : childItems)
|
||||
it->setLinked(value);
|
||||
}
|
||||
|
||||
bool PropertyItem::isLinked() const
|
||||
@@ -540,9 +539,7 @@ void PropertyItem::setPropertyValue(const QString& value)
|
||||
// intermediate changes caused by property change that may potentially
|
||||
// invalidate the current property array.
|
||||
std::ostringstream ss;
|
||||
for (std::vector<App::Property*>::const_iterator it = propertyItems.begin();
|
||||
it != propertyItems.end(); ++it) {
|
||||
auto prop = *it;
|
||||
for (auto prop : propertyItems) {
|
||||
App::PropertyContainer* parent = prop->getContainer();
|
||||
if (!parent || parent->isReadOnly(prop) || prop->testStatus(App::Property::ReadOnly))
|
||||
continue;
|
||||
@@ -2833,8 +2830,8 @@ void PropertyEnumItem::setValue(const QVariant& value)
|
||||
QStringList values = value.toStringList();
|
||||
QTextStream str(&data);
|
||||
str << "[";
|
||||
for (QStringList::Iterator it = values.begin(); it != values.end(); ++it) {
|
||||
QString text(*it);
|
||||
for (const auto & it : values) {
|
||||
QString text(it);
|
||||
text.replace(QString::fromUtf8("'"),QString::fromUtf8("\\'"));
|
||||
|
||||
std::string pystr = Base::Tools::escapedUnicodeFromUtf8(text.toUtf8());
|
||||
@@ -3051,8 +3048,8 @@ QVariant PropertyStringListItem::value(const App::Property* prop) const
|
||||
assert(prop && prop->getTypeId().isDerivedFrom(App::PropertyStringList::getClassTypeId()));
|
||||
QStringList list;
|
||||
const std::vector<std::string>& value = (static_cast<const App::PropertyStringList*>(prop))->getValues();
|
||||
for (auto jt = value.begin(); jt != value.end(); ++jt ) {
|
||||
list << QString::fromUtf8((*jt).c_str());
|
||||
for (const auto & jt : value) {
|
||||
list << QString::fromUtf8(jt.c_str());
|
||||
}
|
||||
|
||||
return QVariant(list);
|
||||
@@ -3070,8 +3067,8 @@ void PropertyStringListItem::setValue(const QVariant& value)
|
||||
#endif
|
||||
|
||||
str << "[";
|
||||
for (QStringList::Iterator it = values.begin(); it != values.end(); ++it) {
|
||||
QString text(*it);
|
||||
for (const auto & it : values) {
|
||||
QString text(it);
|
||||
std::string pystr = Base::Interpreter().strToPython(text.toUtf8().constData());
|
||||
str << "\"" << QString::fromUtf8(pystr.c_str()) << "\", ";
|
||||
}
|
||||
@@ -3130,8 +3127,8 @@ QVariant PropertyFloatListItem::value(const App::Property* prop) const
|
||||
|
||||
QStringList list;
|
||||
const std::vector<double>& value = static_cast<const App::PropertyFloatList*>(prop)->getValues();
|
||||
for (std::vector<double>::const_iterator jt = value.begin(); jt != value.end(); ++jt) {
|
||||
list << QString::number(*jt, 'f', decimals());
|
||||
for (double jt : value) {
|
||||
list << QString::number(jt, 'f', decimals());
|
||||
}
|
||||
|
||||
return QVariant(list);
|
||||
@@ -3145,8 +3142,8 @@ void PropertyFloatListItem::setValue(const QVariant& value)
|
||||
QString data;
|
||||
QTextStream str(&data);
|
||||
str << "[";
|
||||
for (QStringList::Iterator it = values.begin(); it != values.end(); ++it) {
|
||||
str << *it << ",";
|
||||
for (const auto & it : values) {
|
||||
str << it << ",";
|
||||
}
|
||||
str << "]";
|
||||
if (data == QString::fromUtf8("[,]"))
|
||||
@@ -3205,8 +3202,8 @@ QVariant PropertyIntegerListItem::value(const App::Property* prop) const
|
||||
|
||||
QStringList list;
|
||||
const std::vector<long>& value = static_cast<const App::PropertyIntegerList*>(prop)->getValues();
|
||||
for (auto jt = value.begin(); jt != value.end(); ++jt) {
|
||||
list << QString::number(*jt);
|
||||
for (long jt : value) {
|
||||
list << QString::number(jt);
|
||||
}
|
||||
|
||||
return QVariant(list);
|
||||
|
||||
Reference in New Issue
Block a user