diff --git a/src/App/DocumentObject.cpp b/src/App/DocumentObject.cpp index 3d903f8bb2..0ee1d368ae 100644 --- a/src/App/DocumentObject.cpp +++ b/src/App/DocumentObject.cpp @@ -708,13 +708,13 @@ bool DocumentObject::removeDynamicProperty(const char* name) auto expressions = ExpressionEngine.getExpressions(); std::vector removeExpr; - for (auto it : expressions) { + for (const auto& it : expressions) { if (it.first.getProperty() == prop) { removeExpr.push_back(it.first); } } - for (auto it : removeExpr) { + for (const auto& it : removeExpr) { ExpressionEngine.setValue(it, std::shared_ptr()); } diff --git a/src/App/ExtensionContainer.cpp b/src/App/ExtensionContainer.cpp index 0c3d9022a9..b2fc999ba8 100644 --- a/src/App/ExtensionContainer.cpp +++ b/src/App/ExtensionContainer.cpp @@ -43,7 +43,7 @@ ExtensionContainer::ExtensionContainer() { ExtensionContainer::~ExtensionContainer() { //we need to delete all dynamically added extensions - for(auto entry : _extensions) { + for(const auto& entry : _extensions) { if(entry.second->isPythonExtension()) delete entry.second; } @@ -56,7 +56,7 @@ void ExtensionContainer::registerExtension(Base::Type extension, Extension* ext) //no duplicate extensions (including base classes) if(hasExtension(extension)) { - for(auto entry : _extensions) { + for(const auto& entry : _extensions) { if(entry.first == extension || entry.first.isDerivedFrom(extension)) { _extensions.erase(entry.first); break; @@ -73,7 +73,7 @@ bool ExtensionContainer::hasExtension(Base::Type t, bool derived) const { bool found = _extensions.find(t) != _extensions.end(); if(!found && derived) { //and for types derived from it, as they can be cast to the extension - for(auto entry : _extensions) { + for(const auto& entry : _extensions) { if(entry.first.isDerivedFrom(t)) return true; } @@ -85,7 +85,7 @@ bool ExtensionContainer::hasExtension(Base::Type t, bool derived) const { bool ExtensionContainer::hasExtension(const std::string& name) const { //and for types derived from it, as they can be cast to the extension - for(auto entry : _extensions) { + for(const auto& entry : _extensions) { if(entry.second->name() == name) return true; } @@ -98,11 +98,11 @@ Extension* ExtensionContainer::getExtension(Base::Type t, bool derived, bool no_ auto result = _extensions.find(t); if((result == _extensions.end()) && derived) { //we need to check for derived types - for(auto entry : _extensions) { + for(const auto& entry : _extensions) { if(entry.first.isDerivedFrom(t)) return entry.second; } - if(no_except) + if(no_except) return nullptr; //if we arrive here we don't have anything matching throw Base::TypeError("ExtensionContainer::getExtension: No extension of given type available"); @@ -111,7 +111,7 @@ Extension* ExtensionContainer::getExtension(Base::Type t, bool derived, bool no_ return result->second; } else { - if(no_except) + if(no_except) return nullptr; //if we arrive here we don't have anything matching throw Base::TypeError("ExtensionContainer::getExtension: No extension of given type available"); @@ -126,7 +126,7 @@ bool ExtensionContainer::hasExtensions() const { Extension* ExtensionContainer::getExtension(const std::string& name) const { //and for types derived from it, as they can be cast to the extension - for(auto entry : _extensions) { + for(const auto& entry : _extensions) { if(entry.second->name() == name) return entry.second; } @@ -137,7 +137,7 @@ std::vector< Extension* > ExtensionContainer::getExtensionsDerivedFrom(Base::Typ std::vector vec; //and for types derived from it, as they can be cast to the extension - for(auto entry : _extensions) { + for(const auto& entry : _extensions) { if(entry.first.isDerivedFrom(type)) vec.push_back(entry.second); } @@ -146,13 +146,13 @@ std::vector< Extension* > ExtensionContainer::getExtensionsDerivedFrom(Base::Typ void ExtensionContainer::getPropertyList(std::vector< Property* >& List) const { App::PropertyContainer::getPropertyList(List); - for(auto entry : _extensions) + for(const auto& entry : _extensions) entry.second->extensionGetPropertyList(List); } void ExtensionContainer::getPropertyMap(std::map< std::string, Property* >& Map) const { App::PropertyContainer::getPropertyMap(Map); - for(auto entry : _extensions) + for(const auto& entry : _extensions) entry.second->extensionGetPropertyMap(Map); } @@ -161,7 +161,7 @@ Property* ExtensionContainer::getPropertyByName(const char* name) const { if(prop) return prop; - for(auto entry : _extensions) { + for(const auto& entry : _extensions) { auto prop = entry.second->extensionGetPropertyByName(name); if(prop) return prop; @@ -176,7 +176,7 @@ short int ExtensionContainer::getPropertyType(const Property* prop) const { if(res != 0) return res; - for(auto entry : _extensions) { + for(const auto& entry : _extensions) { res = entry.second->extensionGetPropertyType(prop); if(res != 0) return res; @@ -191,7 +191,7 @@ short int ExtensionContainer::getPropertyType(const char* name) const { if(res != 0) return res; - for(auto entry : _extensions) { + for(const auto& entry : _extensions) { res = entry.second->extensionGetPropertyType(name); if(res != 0) return res; @@ -207,7 +207,7 @@ const char* ExtensionContainer::getPropertyName(const Property* prop) const { if(res != nullptr) return res; - for(auto entry : _extensions) { + for(const auto& entry : _extensions) { res = entry.second->extensionGetPropertyName(prop); if(res != nullptr) return res; @@ -222,7 +222,7 @@ const char* ExtensionContainer::getPropertyGroup(const Property* prop) const { if(res != nullptr) return res; - for(auto entry : _extensions) { + for(const auto& entry : _extensions) { res = entry.second->extensionGetPropertyGroup(prop); if(res != nullptr) return res; @@ -237,7 +237,7 @@ const char* ExtensionContainer::getPropertyGroup(const char* name) const { if(res != nullptr) return res; - for(auto entry : _extensions) { + for(const auto& entry : _extensions) { res = entry.second->extensionGetPropertyGroup(name); if(res != nullptr) return res; @@ -253,7 +253,7 @@ const char* ExtensionContainer::getPropertyDocumentation(const Property* prop) c if(res != nullptr) return res; - for(auto entry : _extensions) { + for(const auto& entry : _extensions) { res = entry.second->extensionGetPropertyDocumentation(prop); if(res != nullptr) return res; @@ -268,7 +268,7 @@ const char* ExtensionContainer::getPropertyDocumentation(const char* name) const if(res != nullptr) return res; - for(auto entry : _extensions) { + for(const auto& entry : _extensions) { res = entry.second->extensionGetPropertyDocumentation(name); if(res != nullptr) return res; @@ -281,7 +281,7 @@ void ExtensionContainer::onChanged(const Property* prop) { //inform all extensions about changed property. This includes all properties from the //extended object (this) as well as all extension properties - for(auto entry : _extensions) + for(const auto& entry : _extensions) entry.second->extensionOnChanged(prop); App::PropertyContainer::onChanged(prop); @@ -318,7 +318,7 @@ void ExtensionContainer::saveExtensions(Base::Writer& writer) const { //save dynamic extensions writer.incInd(); // indentation for 'Extensions' writer.Stream() << writer.ind() << "" << std::endl; - for(auto entry : _extensions) { + for(const auto& entry : _extensions) { auto ext = entry.second; writer.incInd(); // indentation for 'Extension name' diff --git a/src/Gui/Action.cpp b/src/Gui/Action.cpp index 055190394f..431a491446 100644 --- a/src/Gui/Action.cpp +++ b/src/Gui/Action.cpp @@ -254,7 +254,7 @@ void ActionGroup::addTo(QWidget *w) } else if (w->inherits("QToolBar")) { w->addAction(_action); - QToolButton* tb = w->findChildren().last(); + QToolButton* tb = w->findChildren().constLast(); tb->setPopupMode(QToolButton::MenuButtonPopup); tb->setObjectName(QString::fromLatin1("qt_toolbutton_menubutton")); QList acts = _group->actions(); @@ -329,10 +329,13 @@ int ActionGroup::checkedAction() const void ActionGroup::setCheckedAction(int i) { - QAction* a = _group->actions()[i]; + auto acts = _group->actions(); + QAction* a = acts.at(i); a->setChecked(true); this->setIcon(a->icon()); - if (!this->_isMode) this->setToolTip(a->toolTip()); + + if (!this->_isMode) + this->setToolTip(a->toolTip()); this->setProperty("defaultAction", QVariant(i)); } @@ -481,7 +484,7 @@ void WorkbenchComboBox::onActivated(int i) { // Send the event to the workbench group to delay the destruction of the emitting widget. int index = itemData(i).toInt(); - WorkbenchActionEvent* ev = new WorkbenchActionEvent(this->actions()[index]); + WorkbenchActionEvent* ev = new WorkbenchActionEvent(this->actions().at(index)); QApplication::postEvent(this->group, ev); // TODO: Test if we can use this instead //QTimer::singleShot(20, this->actions()[i], SLOT(trigger())); diff --git a/src/Gui/BitmapFactory.cpp b/src/Gui/BitmapFactory.cpp index ff3e9a0840..bfc0f9e2d2 100644 --- a/src/Gui/BitmapFactory.cpp +++ b/src/Gui/BitmapFactory.cpp @@ -169,7 +169,7 @@ QStringList BitmapFactoryInst::findIconFiles() const QStringList paths = QDir::searchPaths(QString::fromLatin1("icons")); paths.removeDuplicates(); - for (QStringList::ConstIterator pt = paths.begin(); pt != paths.end(); ++pt) { + for (QStringList::Iterator pt = paths.begin(); pt != paths.end(); ++pt) { QDir d(*pt); d.setNameFilters(filters); QFileInfoList fi = d.entryInfoList(); @@ -193,7 +193,7 @@ void BitmapFactoryInst::addPixmapToCache(const char* name, const QPixmap& icon) bool BitmapFactoryInst::findPixmapInCache(const char* name, QPixmap& px) const { - QMap::ConstIterator it = d->xpmCache.find(name); + QMap::Iterator it = d->xpmCache.find(name); if (it != d->xpmCache.end()) { px = it.value(); return true; @@ -241,13 +241,13 @@ QPixmap BitmapFactoryInst::pixmap(const char* name) const return QPixmap(); // as very first test check whether the pixmap is in the cache - QMap::ConstIterator it = d->xpmCache.find(name); + QMap::Iterator it = d->xpmCache.find(name); if (it != d->xpmCache.end()) return it.value(); // now try to find it in the built-in XPM QPixmap icon; - QMap::ConstIterator It = d->xpmMap.find(name); + QMap::Iterator It = d->xpmMap.find(name); if (It != d->xpmMap.end()) icon = QPixmap(It.value()); @@ -350,9 +350,9 @@ QPixmap BitmapFactoryInst::pixmapFromSvg(const QByteArray& originalContents, con QStringList BitmapFactoryInst::pixmapNames() const { QStringList names; - for (QMap::ConstIterator It = d->xpmMap.begin(); It != d->xpmMap.end(); ++It) + for (QMap::Iterator It = d->xpmMap.begin(); It != d->xpmMap.end(); ++It) names << QString::fromUtf8(It.key().c_str()); - for (QMap::ConstIterator It = d->xpmCache.begin(); It != d->xpmCache.end(); ++It) { + for (QMap::Iterator It = d->xpmCache.begin(); It != d->xpmCache.end(); ++It) { QString item = QString::fromUtf8(It.key().c_str()); if (!names.contains(item)) names << item; diff --git a/src/Gui/CallTips.cpp b/src/Gui/CallTips.cpp index c01b3b103d..0cb4792452 100644 --- a/src/Gui/CallTips.cpp +++ b/src/Gui/CallTips.cpp @@ -637,21 +637,21 @@ bool CallTipsList::eventFilter(QObject * watched, QEvent * event) // which in Qt 4.8 gives Key_Minus instead of Key_Underscore } else if (this->hideKeys.indexOf(ke->key()) > -1) { - itemActivated(currentItem()); + Q_EMIT itemActivated(currentItem()); return false; } else if (ke->key() == Qt::Key_Return || ke->key() == Qt::Key_Enter) { - itemActivated(currentItem()); + Q_EMIT itemActivated(currentItem()); return true; } else if (ke->key() == Qt::Key_Tab) { // enable call completion for activating items Temporary tmp( this->doCallCompletion, true ); //< previous state restored on scope exit - itemActivated( currentItem() ); + Q_EMIT itemActivated( currentItem() ); return true; } else if (this->compKeys.indexOf(ke->key()) > -1) { - itemActivated(currentItem()); + Q_EMIT itemActivated(currentItem()); return false; } else if (ke->key() == Qt::Key_Shift || ke->key() == Qt::Key_Control || diff --git a/src/Gui/CommandView.cpp b/src/Gui/CommandView.cpp index 5cf9010897..64241c21ee 100644 --- a/src/Gui/CommandView.cpp +++ b/src/Gui/CommandView.cpp @@ -342,7 +342,7 @@ void StdCmdFreezeViews::activated(int iMsg) QList acts = pcAction->actions(); int index = 1; - for (QList::ConstIterator it = acts.begin()+offset; it != acts.end(); ++it, index++) { + for (QList::Iterator it = acts.begin()+offset; it != acts.end(); ++it, index++) { if (!(*it)->isVisible()) { savedViews++; QString viewnr = QString(QObject::tr("Restore view &%1")).arg(index); @@ -359,7 +359,7 @@ void StdCmdFreezeViews::activated(int iMsg) else if (iMsg == 4) { savedViews = 0; QList acts = pcAction->actions(); - for (QList::ConstIterator it = acts.begin()+offset; it != acts.end(); ++it) + for (QList::Iterator it = acts.begin()+offset; it != acts.end(); ++it) (*it)->setVisible(false); } else if (iMsg >= offset) { @@ -388,7 +388,7 @@ void StdCmdFreezeViews::onSaveViews() << "\n"; str << " \n"; - for (QList::ConstIterator it = acts.begin()+offset; it != acts.end(); ++it) { + for (QList::Iterator it = acts.begin()+offset; it != acts.end(); ++it) { if ( !(*it)->isVisible() ) break; QString data = (*it)->toolTip(); @@ -529,7 +529,7 @@ void StdCmdFreezeViews::languageChange() acts[3]->setText(QObject::tr("Freeze view")); acts[4]->setText(QObject::tr("Clear views")); int index=1; - for (QList::ConstIterator it = acts.begin()+5; it != acts.end(); ++it, index++) { + for (QList::Iterator it = acts.begin()+5; it != acts.end(); ++it, index++) { if ((*it)->isVisible()) { QString viewnr = QString(QObject::tr("Restore view &%1")).arg(index); (*it)->setText(viewnr); diff --git a/src/Gui/DlgActionsImp.cpp b/src/Gui/DlgActionsImp.cpp index 1cfb23a547..d531f0608c 100644 --- a/src/Gui/DlgActionsImp.cpp +++ b/src/Gui/DlgActionsImp.cpp @@ -268,7 +268,7 @@ void DlgCustomActionsImp::on_buttonAddAction_clicked() ui->actionAccel->clear(); // emit signal to notify the container widget - addMacroAction(actionName); + Q_EMIT addMacroAction(actionName); } void DlgCustomActionsImp::on_buttonReplaceAction_clicked() @@ -352,7 +352,7 @@ void DlgCustomActionsImp::on_buttonReplaceAction_clicked() } // emit signal to notify the container widget - modifyMacroAction(actionName); + Q_EMIT modifyMacroAction(actionName); // call this at the end because it internally invokes the highlight method if (macro->getPixmap()) @@ -378,7 +378,7 @@ void DlgCustomActionsImp::on_buttonRemoveAction_clicked() if (actionName == (*it2)->getName()) { // emit signal to notify the container widget - removeMacroAction(actionName); + Q_EMIT removeMacroAction(actionName); // remove from manager and delete it immediately rclMan.removeCommand(*it2); break; diff --git a/src/Gui/DlgActivateWindowImp.cpp b/src/Gui/DlgActivateWindowImp.cpp index d8a346381f..f42b39bcda 100644 --- a/src/Gui/DlgActivateWindowImp.cpp +++ b/src/Gui/DlgActivateWindowImp.cpp @@ -63,7 +63,7 @@ DlgActivateWindowImp::DlgActivateWindowImp(QWidget* parent, Qt::WindowFlags fl) QWidget* activeWnd = getMainWindow()->activeWindow(); - for (QList::ConstIterator it = windows.begin(); it != windows.end(); ++it) { + for (QList::Iterator it = windows.begin(); it != windows.end(); ++it) { QTreeWidgetItem* item = new QTreeWidgetItem(ui->treeWidget); QString title = (*it)->windowTitle(); title.replace(QLatin1String("[*]"), QLatin1String("")); diff --git a/src/Gui/DlgCustomizeSpaceball.cpp b/src/Gui/DlgCustomizeSpaceball.cpp index 884aa3d702..dc258e50d4 100644 --- a/src/Gui/DlgCustomizeSpaceball.cpp +++ b/src/Gui/DlgCustomizeSpaceball.cpp @@ -67,7 +67,7 @@ void ButtonView::goSelectionChanged(const QItemSelection &selected, const QItemS if (selected.indexes().isEmpty()) return; QModelIndex select(selected.indexes().at(0)); - changeCommandSelection(this->model()->data(select, Qt::UserRole).toString()); + Q_EMIT changeCommandSelection(this->model()->data(select, Qt::UserRole).toString()); } void ButtonView::goChangedCommand(const QString& commandName) @@ -329,7 +329,7 @@ void CommandView::goClicked(const QModelIndex &index) QString commandName = this->model()->data(index, Qt::UserRole).toString(); if (commandName.isEmpty()) return; - changedCommand(commandName); + Q_EMIT changedCommand(commandName); } } diff --git a/src/Gui/DlgEditorImp.cpp b/src/Gui/DlgEditorImp.cpp index e7c45c52cd..79d79f48c1 100644 --- a/src/Gui/DlgEditorImp.cpp +++ b/src/Gui/DlgEditorImp.cpp @@ -132,7 +132,7 @@ DlgSettingsEditorImp::DlgSettingsEditorImp( QWidget* parent ) QStringList labels; labels << tr("Items"); ui->displayItems->setHeaderLabels(labels); ui->displayItems->header()->hide(); - for (QVector >::ConstIterator it = d->colormap.begin(); it != d->colormap.end(); ++it) { + for (QVector >::Iterator it = d->colormap.begin(); it != d->colormap.end(); ++it) { QTreeWidgetItem* item = new QTreeWidgetItem(ui->displayItems); item->setText(0, tr((*it).first.toLatin1())); } @@ -193,7 +193,7 @@ void DlgSettingsEditorImp::saveSettings() // Saves the color map ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("Editor"); - for (QVector >::ConstIterator it = d->colormap.begin(); it != d->colormap.end(); ++it) { + for (QVector >::Iterator it = d->colormap.begin(); it != d->colormap.end(); ++it) { unsigned long col = static_cast((*it).second); hGrp->SetUnsigned((*it).first.toLatin1(), col); } @@ -265,7 +265,7 @@ void DlgSettingsEditorImp::changeEvent(QEvent *e) { if (e->type() == QEvent::LanguageChange) { int index = 0; - for (QVector >::ConstIterator it = d->colormap.begin(); it != d->colormap.end(); ++it) + for (QVector >::Iterator it = d->colormap.begin(); it != d->colormap.end(); ++it) ui->displayItems->topLevelItem(index++)->setText(0, tr((*it).first.toLatin1())); ui->retranslateUi(this); } else { diff --git a/src/Gui/DlgParameterFind.cpp b/src/Gui/DlgParameterFind.cpp index d05be2e58b..6298c3a880 100644 --- a/src/Gui/DlgParameterFind.cpp +++ b/src/Gui/DlgParameterFind.cpp @@ -132,54 +132,54 @@ bool DlgParameterFind::matches(QTreeWidgetItem* item, const Options& opt) const // check the name of an entry in the group if (opt.name) { if (opt.match) { - for (auto it : boolMap) { + for (const auto& it : boolMap) { QString text = QString::fromUtf8(it.first.c_str()); if (text.compare(opt.text, Qt::CaseInsensitive) == 0) return true; } - for (auto it : intMap) { + for (const auto& it : intMap) { QString text = QString::fromUtf8(it.first.c_str()); if (text.compare(opt.text, Qt::CaseInsensitive) == 0) return true; } - for (auto it : uintMap) { + for (const auto& it : uintMap) { QString text = QString::fromUtf8(it.first.c_str()); if (text.compare(opt.text, Qt::CaseInsensitive) == 0) return true; } - for (auto it : floatMap) { + for (const auto& it : floatMap) { QString text = QString::fromUtf8(it.first.c_str()); if (text.compare(opt.text, Qt::CaseInsensitive) == 0) return true; } - for (auto it : asciiMap) { + for (const auto& it : asciiMap) { QString text = QString::fromUtf8(it.first.c_str()); if (text.compare(opt.text, Qt::CaseInsensitive) == 0) return true; } } else { - for (auto it : boolMap) { + for (const auto& it : boolMap) { QString text = QString::fromUtf8(it.first.c_str()); if (text.indexOf(opt.text, 0, Qt::CaseInsensitive) >= 0) return true; } - for (auto it : intMap) { + for (const auto& it : intMap) { QString text = QString::fromUtf8(it.first.c_str()); if (text.indexOf(opt.text, 0, Qt::CaseInsensitive) >= 0) return true; } - for (auto it : uintMap) { + for (const auto& it : uintMap) { QString text = QString::fromUtf8(it.first.c_str()); if (text.indexOf(opt.text, 0, Qt::CaseInsensitive) >= 0) return true; } - for (auto it : floatMap) { + for (const auto& it : floatMap) { QString text = QString::fromUtf8(it.first.c_str()); if (text.indexOf(opt.text, 0, Qt::CaseInsensitive) >= 0) return true; } - for (auto it : asciiMap) { + for (const auto& it : asciiMap) { QString text = QString::fromUtf8(it.first.c_str()); if (text.indexOf(opt.text, 0, Qt::CaseInsensitive) >= 0) return true; @@ -190,14 +190,14 @@ bool DlgParameterFind::matches(QTreeWidgetItem* item, const Options& opt) const // check the value of an entry in the group if (opt.value) { if (opt.match) { - for (auto it : asciiMap) { + for (const auto& it : asciiMap) { QString text = QString::fromUtf8(it.second.c_str()); if (text.compare(opt.text, Qt::CaseInsensitive) == 0) return true; } } else { - for (auto it : asciiMap) { + for (const auto& it : asciiMap) { QString text = QString::fromUtf8(it.second.c_str()); if (text.indexOf(opt.text, 0, Qt::CaseInsensitive) >= 0) return true; diff --git a/src/Gui/DlgToolbarsImp.cpp b/src/Gui/DlgToolbarsImp.cpp index 5851df825e..3a9245a041 100644 --- a/src/Gui/DlgToolbarsImp.cpp +++ b/src/Gui/DlgToolbarsImp.cpp @@ -791,7 +791,7 @@ void DlgCustomToolbarsImp::removeCustomCommand(const QString& name, const QByteA cmd = "Separator"; } QList actions = bars.front()->actions(); - for (QList::ConstIterator it = actions.begin(); it != actions.end(); ++it) { + for (QList::Iterator it = actions.begin(); it != actions.end(); ++it) { if ((*it)->data().toByteArray() == cmd) { // if we move a separator then make sure to pick up the right one if (numSep > 0) { @@ -822,7 +822,7 @@ void DlgCustomToolbarsImp::moveUpCustomCommand(const QString& name, const QByteA } QList actions = bars.front()->actions(); QAction* before=nullptr; - for (QList::ConstIterator it = actions.begin(); it != actions.end(); ++it) { + for (QList::Iterator it = actions.begin(); it != actions.end(); ++it) { if ((*it)->data().toByteArray() == cmd) { // if we move a separator then make sure to pick up the right one if (numSep > 0) { @@ -862,7 +862,7 @@ void DlgCustomToolbarsImp::moveDownCustomCommand(const QString& name, const QByt cmd = "Separator"; } QList actions = bars.front()->actions(); - for (QList::ConstIterator it = actions.begin(); it != actions.end(); ++it) { + for (QList::Iterator it = actions.begin(); it != actions.end(); ++it) { if ((*it)->data().toByteArray() == cmd) { // if we move a separator then make sure to pick up the right one if (numSep > 0) { diff --git a/src/Gui/DlgUndoRedo.cpp b/src/Gui/DlgUndoRedo.cpp index 49e59e629d..e0ca6df7cd 100644 --- a/src/Gui/DlgUndoRedo.cpp +++ b/src/Gui/DlgUndoRedo.cpp @@ -76,7 +76,7 @@ void UndoDialog::onSelected() { QAction* a = static_cast(sender()); QList acts = this->actions(); - for (QList::ConstIterator it = acts.begin(); it != acts.end(); ++it) { + for (QList::Iterator it = acts.begin(); it != acts.end(); ++it) { Gui::Application::Instance->sendMsgToActiveView("Undo"); if (*it == a) break; @@ -124,7 +124,7 @@ void RedoDialog::onSelected() { QAction* a = static_cast(sender()); QList acts = this->actions(); - for (QList::ConstIterator it = acts.begin(); it != acts.end(); ++it) { + for (QList::Iterator it = acts.begin(); it != acts.end(); ++it) { Gui::Application::Instance->sendMsgToActiveView("Redo"); if (*it == a) break; diff --git a/src/Gui/DockWindowManager.cpp b/src/Gui/DockWindowManager.cpp index d9d077d017..0ca9b195cb 100644 --- a/src/Gui/DockWindowManager.cpp +++ b/src/Gui/DockWindowManager.cpp @@ -171,7 +171,7 @@ QDockWidget* DockWindowManager::addDockWindow(const char* name, QWidget* widget, */ QWidget* DockWindowManager::getDockWindow(const char* name) const { - for (QList::ConstIterator it = d->_dockedWindows.begin(); it != d->_dockedWindows.end(); ++it) { + for (QList::Iterator it = d->_dockedWindows.begin(); it != d->_dockedWindows.end(); ++it) { if ((*it)->objectName() == QLatin1String(name)) return (*it)->widget(); } @@ -185,7 +185,7 @@ QWidget* DockWindowManager::getDockWindow(const char* name) const QList DockWindowManager::getDockWindows() const { QList docked; - for (QList::ConstIterator it = d->_dockedWindows.begin(); it != d->_dockedWindows.end(); ++it) + for (QList::Iterator it = d->_dockedWindows.begin(); it != d->_dockedWindows.end(); ++it) docked.push_back((*it)->widget()); return docked; } @@ -334,7 +334,7 @@ void DockWindowManager::setup(DockWindowItems* items) bool visible = hPref->GetBool(dockName.constData(), it->visibility); if (!dw) { - QMap >::ConstIterator jt = d->_dockWindows.find(it->name); + QMap >::Iterator jt = d->_dockWindows.find(it->name); if (jt != d->_dockWindows.end()) { dw = addDockWindow(jt.value()->objectName().toUtf8(), jt.value(), it->pos); jt.value()->show(); diff --git a/src/Gui/DocumentModel.cpp b/src/Gui/DocumentModel.cpp index e49e24c29a..054087914f 100644 --- a/src/Gui/DocumentModel.cpp +++ b/src/Gui/DocumentModel.cpp @@ -419,7 +419,7 @@ void DocumentModel::slotRelabelDocument(const Gui::Document& Doc) if (row > -1) { QModelIndex parent = createIndex(0,0,d->rootItem); QModelIndex item = index (row, 0, parent); - dataChanged(item, item); + Q_EMIT dataChanged(item, item); } } @@ -429,7 +429,7 @@ void DocumentModel::slotActiveDocument(const Gui::Document& /*Doc*/) QModelIndex parent = createIndex(0,0,d->rootItem); QModelIndex top = index (0, 0, parent); QModelIndex bottom = index (d->rootItem->childCount()-1, 0, parent); - dataChanged(top, bottom); + Q_EMIT dataChanged(top, bottom); } void DocumentModel::slotInEdit(const Gui::ViewProviderDocumentObject& v) @@ -494,7 +494,7 @@ void DocumentModel::slotChangeObject(const Gui::ViewProviderDocumentObject& obj, QModelIndex parent = createIndex(0,0,parentitem); int row = (*it)->row(); QModelIndex item = index (row, 0, parent); - dataChanged(item, item); + Q_EMIT dataChanged(item, item); } } } diff --git a/src/Gui/DownloadItem.cpp b/src/Gui/DownloadItem.cpp index 67c9d13bfe..35fb3ecf97 100644 --- a/src/Gui/DownloadItem.cpp +++ b/src/Gui/DownloadItem.cpp @@ -406,7 +406,7 @@ void DownloadItem::tryAgain() m_output.remove(); m_reply = r; init(); - /*emit*/ statusChanged(); + Q_EMIT statusChanged(); } void DownloadItem::contextMenuEvent (QContextMenuEvent * e) @@ -429,11 +429,11 @@ void DownloadItem::downloadReadyRead() downloadInfoLabel->setText(tr("Error opening saved file: %1") .arg(m_output.errorString())); stopButton->click(); - /*emit*/ statusChanged(); + Q_EMIT statusChanged(); return; } downloadInfoLabel->setToolTip(m_url.toString()); - /*emit*/ statusChanged(); + Q_EMIT statusChanged(); } if (-1 == m_output.write(m_reply->readAll())) { downloadInfoLabel->setText(tr("Error saving: %1") @@ -604,7 +604,7 @@ void DownloadItem::finished() stopButton->hide(); m_output.close(); updateInfoLabel(); - /*emit*/ statusChanged(); + Q_EMIT statusChanged(); } #include "moc_DownloadItem.cpp" diff --git a/src/Gui/DownloadItem.h b/src/Gui/DownloadItem.h index 8b533f11b1..ff3df9d4bb 100644 --- a/src/Gui/DownloadItem.h +++ b/src/Gui/DownloadItem.h @@ -96,8 +96,8 @@ public: NetworkAccessManager(QObject *parent = nullptr); private Q_SLOTS: - void authenticationRequired(QNetworkReply *reply, QAuthenticator *auth); - void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *auth); + void authenticationRequired(QNetworkReply *reply, QAuthenticator *auth); // clazy:exclude=overridden-signal + void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *auth); // clazy:exclude=overridden-signal }; #include "ui_DownloadItem.h" diff --git a/src/Gui/EditorView.cpp b/src/Gui/EditorView.cpp index df20033d5c..34dfc6d692 100644 --- a/src/Gui/EditorView.cpp +++ b/src/Gui/EditorView.cpp @@ -479,7 +479,7 @@ void EditorView::printPdf() void EditorView::setCurrentFileName(const QString &fileName) { d->fileName = fileName; - /*emit*/ changeFileName(d->fileName); + Q_EMIT changeFileName(d->fileName); d->textEdit->document()->setModified(false); QString name; diff --git a/src/Gui/FileDialog.cpp b/src/Gui/FileDialog.cpp index 44a82a4b72..80d15f62ff 100644 --- a/src/Gui/FileDialog.cpp +++ b/src/Gui/FileDialog.cpp @@ -214,7 +214,7 @@ QString FileDialog::getSaveFileName (QWidget * parent, const QString & caption, if (dlg.exec() == QDialog::Accepted) { if (selectedFilter) *selectedFilter = dlg.selectedNameFilter(); - file = dlg.selectedFiles().front(); + file = dlg.selectedFiles().constFirst(); } } else { @@ -291,7 +291,7 @@ QString FileDialog::getOpenFileName(QWidget * parent, const QString & caption, c if (dlg.exec() == QDialog::Accepted) { if (selectedFilter) *selectedFilter = dlg.selectedNameFilter(); - file = dlg.selectedFiles().front(); + file = dlg.selectedFiles().constFirst(); } } else { @@ -469,7 +469,7 @@ void FileOptionsDialog::accept() bool ok=false; // Compare the given suffix with the suffixes of all filters QString filter; - for (QStringList::ConstIterator it = filters.begin(); it != filters.end(); ++it) { + for (QStringList::ConstIterator it = filters.cbegin(); it != filters.cend(); ++it) { if ((*it).contains(ext)) { filter = *it; ok = true; @@ -688,7 +688,7 @@ void FileChooser::editingFinished() QString le_converted = QDir::fromNativeSeparators(lineEdit->text()); lineEdit->setText(le_converted); FileDialog::setWorkingDirectory(le_converted); - fileNameSelected(le_converted); + Q_EMIT fileNameSelected(le_converted); } /** @@ -730,7 +730,7 @@ void FileChooser::chooseFile() fn = QDir::fromNativeSeparators(fn); lineEdit->setText(fn); FileDialog::setWorkingDirectory(fn); - fileNameSelected(fn); + Q_EMIT fileNameSelected(fn); } } @@ -944,8 +944,8 @@ SelectModule::Dict SelectModule::exportHandler(const QStringList& fileNames, con dict[*it] = QString::fromLatin1(filters.begin()->second.c_str()); } - for (QMap::const_iterator it = filetypeHandler.begin(); - it != filetypeHandler.end(); ++it) { + for (QMap::const_iterator it = filetypeHandler.cbegin(); + it != filetypeHandler.cend(); ++it) { if (it.value().size() > 1) { SelectModule dlg(it.key(),it.value(), getMainWindow()); QApplication::beep(); @@ -1006,8 +1006,8 @@ SelectModule::Dict SelectModule::importHandler(const QStringList& fileNames, con dict[*it] = QString::fromLatin1(filters.begin()->second.c_str()); } - for (QMap::const_iterator it = filetypeHandler.begin(); - it != filetypeHandler.end(); ++it) { + for (QMap::const_iterator it = filetypeHandler.cbegin(); + it != filetypeHandler.cend(); ++it) { if (it.value().size() > 1) { SelectModule dlg(it.key(),it.value(), getMainWindow()); QApplication::beep(); diff --git a/src/Gui/GraphvizView.cpp b/src/Gui/GraphvizView.cpp index d75903646d..8af0912aac 100644 --- a/src/Gui/GraphvizView.cpp +++ b/src/Gui/GraphvizView.cpp @@ -87,7 +87,7 @@ public: // causes some problems with Qt5. run(); // Can't use the finished() signal of QThread - emitFinished(); + Q_EMIT emitFinished(); } void run() { diff --git a/src/Gui/InputField.cpp b/src/Gui/InputField.cpp index d03a521d4d..edc8698278 100644 --- a/src/Gui/InputField.cpp +++ b/src/Gui/InputField.cpp @@ -259,7 +259,7 @@ void InputField::newInput(const QString & text) QString errorText = QString::fromLatin1(e.what()); QPixmap pixmap = getValidationIcon(":/icons/button_invalid.svg", QSize(sizeHint().height(),sizeHint().height())); iconLabel->setPixmap(pixmap); - parseError(errorText); + Q_EMIT parseError(errorText); validInput = false; return; } @@ -271,7 +271,7 @@ void InputField::newInput(const QString & text) if(!actUnit.isEmpty() && !res.getUnit().isEmpty() && actUnit != res.getUnit()){ QPixmap pixmap = getValidationIcon(":/icons/button_invalid.svg", QSize(sizeHint().height(),sizeHint().height())); iconLabel->setPixmap(pixmap); - parseError(QString::fromLatin1("Wrong unit")); + Q_EMIT parseError(QString::fromLatin1("Wrong unit")); validInput = false; return; } @@ -297,8 +297,8 @@ void InputField::newInput(const QString & text) actQuantity = res; // signaling - valueChanged(res); - valueChanged(res.getValue()); + Q_EMIT valueChanged(res); + Q_EMIT valueChanged(res.getValue()); } void InputField::pushToHistory(const QString &valueq) @@ -600,7 +600,7 @@ void InputField::selectNumber(void) QChar n = locale().negativeSign(); QChar e = locale().exponential(); - for (QString::iterator it = str.begin(); it != str.end(); ++it) { + for (QString::const_iterator it = str.cbegin(); it != str.cend(); ++it) { if (it->isDigit()) i++; else if (*it == d) diff --git a/src/Gui/InputField.h b/src/Gui/InputField.h index a07a42ecaf..cacbbf41db 100644 --- a/src/Gui/InputField.h +++ b/src/Gui/InputField.h @@ -177,14 +177,14 @@ Q_SIGNALS: * If you want the unfiltered/non-validated input use textChanged(const QString&) * instead: */ - void valueChanged(const Base::Quantity&); + void valueChanged(const Base::Quantity&); // clazy:exclude=overloaded-signal /** gets emitted if the user has entered a VALID input * Valid means the user inputted string obeys all restrictions * like: minimum, maximum and/or the right Unit (if specified). * If you want the unfiltered/non-validated input use textChanged(const QString&) * instead: */ - void valueChanged(double); + void valueChanged(double); // clazy:exclude=overloaded-signal /// signal for an invalid user input (signals a lot while typing!) void parseError(const QString& errorText); diff --git a/src/Gui/Language/Translator.cpp b/src/Gui/Language/Translator.cpp index 3e40fe3341..935532511f 100644 --- a/src/Gui/Language/Translator.cpp +++ b/src/Gui/Language/Translator.cpp @@ -200,7 +200,7 @@ TStringList Translator::supportedLanguages() const { TStringList languages; TStringMap locales = supportedLocales(); - for (auto it : locales) + for (const auto& it : locales) languages.push_back(it.first); return languages; diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index 3b3f62af7e..37617d4b3c 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -682,7 +682,7 @@ void MainWindow::activateWorkbench(const QString& name) } } // emit this signal - workbenchActivated(name); + Q_EMIT workbenchActivated(name); updateActions(true); } @@ -812,7 +812,7 @@ bool MainWindow::eventFilter(QObject* o, QEvent* e) Qt::WindowStates oldstate = static_cast(e)->oldState(); Qt::WindowStates newstate = view->windowState(); if (oldstate != newstate) - windowStateChanged(view); + Q_EMIT windowStateChanged(view); } } @@ -1156,11 +1156,11 @@ void MainWindow::closeEvent (QCloseEvent * e) QList dialogs = this->findChildren(); // It is possible that closing a dialog internally closes further dialogs. Thus, // we have to check the pointer before. - QList< QPointer > dialogs_ptr; + QVector< QPointer > dialogs_ptr; for (QList::iterator it = dialogs.begin(); it != dialogs.end(); ++it) { dialogs_ptr.append(*it); } - for (QList< QPointer >::iterator it = dialogs_ptr.begin(); it != dialogs_ptr.end(); ++it) { + for (QVector< QPointer >::iterator it = dialogs_ptr.begin(); it != dialogs_ptr.end(); ++it) { if (!(*it).isNull()) (*it)->close(); } @@ -1174,7 +1174,7 @@ void MainWindow::closeEvent (QCloseEvent * e) if (Workbench* wb = WorkbenchManager::instance()->active()) wb->removeTaskWatcher(); - /*emit*/ mainWindowClosed(); + Q_EMIT mainWindowClosed(); d->activityTimer->stop(); // https://forum.freecadweb.org/viewtopic.php?f=8&t=67748 diff --git a/src/Gui/MainWindow.h b/src/Gui/MainWindow.h index 95beb58a30..871adf6b93 100644 --- a/src/Gui/MainWindow.h +++ b/src/Gui/MainWindow.h @@ -256,7 +256,9 @@ protected: void closeEvent (QCloseEvent * e); void showEvent (QShowEvent * e); void hideEvent (QHideEvent * e); - void timerEvent (QTimerEvent * ){ timeEvent();} + void timerEvent (QTimerEvent * ) { + Q_EMIT timeEvent(); + } void customEvent(QEvent * e); bool event (QEvent * e); /** diff --git a/src/Gui/ManualAlignment.cpp b/src/Gui/ManualAlignment.cpp index 2cf741abe7..e7bae457e2 100644 --- a/src/Gui/ManualAlignment.cpp +++ b/src/Gui/ManualAlignment.cpp @@ -932,7 +932,7 @@ void ManualAlignment::finish() Gui::getMainWindow()->showMessage(tr("The alignment has finished")); // If an event receiver has been defined send the manual alignment finished event to it - emitFinished(); + Q_EMIT emitFinished(); } /** @@ -950,7 +950,7 @@ void ManualAlignment::cancel() Gui::getMainWindow()->showMessage(tr("The alignment has been canceled")); // If an event receiver has been defined send the manual alignment cancelled event to it - emitCanceled(); + Q_EMIT emitCanceled(); } void ManualAlignment::align() diff --git a/src/Gui/MenuManager.cpp b/src/Gui/MenuManager.cpp index 7d7d191bf4..9b648f818c 100644 --- a/src/Gui/MenuManager.cpp +++ b/src/Gui/MenuManager.cpp @@ -107,7 +107,7 @@ MenuItem* MenuItem::copy() const root->setCommand(command()); QList items = getItems(); - for (QList::ConstIterator it = items.begin(); it != items.end(); ++it) + for (QList::Iterator it = items.begin(); it != items.end(); ++it) { root->appendItem((*it)->copy()); } @@ -225,7 +225,7 @@ void MenuManager::setup(MenuItem* menuItems) const QList items = menuItems->getItems(); QList actions = menuBar->actions(); - for (QList::ConstIterator it = items.begin(); it != items.end(); ++it) + for (QList::Iterator it = items.begin(); it != items.end(); ++it) { // search for the menu action QAction* action = findAction(actions, QString::fromLatin1((*it)->command().c_str())); @@ -277,7 +277,7 @@ void MenuManager::setup(MenuItem* item, QMenu* menu) const CommandManager& mgr = Application::Instance->commandManager(); QList items = item->getItems(); QList actions = menu->actions(); - for (QList::ConstIterator it = items.begin(); it != items.end(); ++it) { + for (QList::Iterator it = items.begin(); it != items.end(); ++it) { // search for the menu item QList used_actions = findActions(actions, QString::fromLatin1((*it)->command().c_str())); if (used_actions.isEmpty()) { diff --git a/src/Gui/NetworkRetriever.cpp b/src/Gui/NetworkRetriever.cpp index e55462bd52..1cf3c895c8 100644 --- a/src/Gui/NetworkRetriever.cpp +++ b/src/Gui/NetworkRetriever.cpp @@ -364,7 +364,7 @@ void NetworkRetriever::wgetFinished(int exitCode, QProcess::ExitStatus status) QByteArray data = wget->readAll(); Base::Console().Warning(data); } - wgetExited(); + Q_EMIT wgetExited(); } /** diff --git a/src/Gui/OnlineDocumentation.cpp b/src/Gui/OnlineDocumentation.cpp index 049f1a15c1..c6f98accbc 100644 --- a/src/Gui/OnlineDocumentation.cpp +++ b/src/Gui/OnlineDocumentation.cpp @@ -238,7 +238,7 @@ QByteArray PythonOnlineHelp::fileNotFound() const QString header = QString::fromLatin1("content-type: %1\r\n").arg(contentType); QString http(QLatin1String("HTTP/1.1 %1 %2\r\n%3\r\n")); - QString httpResponseHeader = http.arg(404).arg(QLatin1String("File not found")).arg(header); + QString httpResponseHeader = http.arg(404).arg(QString::fromLatin1("File not found"), header); QByteArray res = httpResponseHeader.toLatin1(); return res; @@ -267,7 +267,7 @@ QByteArray PythonOnlineHelp::loadFailed(const QString& error) const QString header = QString::fromLatin1("content-type: %1\r\n").arg(contentType); QString http(QLatin1String("HTTP/1.1 %1 %2\r\n%3\r\n")); - QString httpResponseHeader = http.arg(404).arg(QLatin1String("File not found")).arg(header); + QString httpResponseHeader = http.arg(404).arg(QString::fromLatin1("File not found"), header); QByteArray res = httpResponseHeader.toLatin1(); return res; diff --git a/src/Gui/Placement.cpp b/src/Gui/Placement.cpp index ec510ac1ad..8b352ced14 100644 --- a/src/Gui/Placement.cpp +++ b/src/Gui/Placement.cpp @@ -288,17 +288,17 @@ void Placement::applyPlacement(const QString& data, bool incremental) if (incremental) cmd = QString::fromLatin1( "App.getDocument(\"%1\").%2.%3=%4.multiply(App.getDocument(\"%1\").%2.%3)") - .arg(QLatin1String((*it)->getDocument()->getName())) - .arg(QLatin1String((*it)->getNameInDocument())) - .arg(QLatin1String(this->propertyName.c_str())) - .arg(data); + .arg(QString::fromLatin1((*it)->getDocument()->getName()), + QString::fromLatin1((*it)->getNameInDocument()), + QString::fromLatin1(this->propertyName.c_str()), + data); else { cmd = QString::fromLatin1( "App.getDocument(\"%1\").%2.%3=%4") - .arg(QLatin1String((*it)->getDocument()->getName())) - .arg(QLatin1String((*it)->getNameInDocument())) - .arg(QLatin1String(this->propertyName.c_str())) - .arg(data); + .arg(QString::fromLatin1((*it)->getDocument()->getName()), + QString::fromLatin1((*it)->getNameInDocument()), + QString::fromLatin1(this->propertyName.c_str()), + data); } Gui::Command::runCommand(Gui::Command::App, cmd.toLatin1()); @@ -329,7 +329,7 @@ void Placement::onPlacementChanged(int) applyPlacement(plm, incr); QVariant data = QVariant::fromValue(plm); - /*emit*/ placementChanged(data, incr, false); + Q_EMIT placementChanged(data, incr, false); } void Placement::on_centerOfMass_toggled(bool on) @@ -382,7 +382,7 @@ void Placement::on_selectedVertex_clicked() //of the same object the rotation still gets applied twice Gui::Selection().clearSelection(); //reselect original object that was selected when placement dlg first opened - for (auto it : selectionObjects) + for (const auto& it : selectionObjects) Gui::Selection().addSelection(it); if (picked.size() == 1) { @@ -562,7 +562,7 @@ void Placement::reject() applyPlacement(plm, true); QVariant data = QVariant::fromValue(plm); - /*emit*/ placementChanged(data, true, false); + Q_EMIT placementChanged(data, true, false); revertTransformation(); @@ -611,7 +611,7 @@ bool Placement::onApply() applyPlacement(getPlacementString(), incr); QVariant data = QVariant::fromValue(plm); - /*emit*/ placementChanged(data, incr, true); + Q_EMIT placementChanged(data, incr, true); if (ui->applyIncrementalPlacement->isChecked()) { QList sb = this->findChildren(); @@ -658,7 +658,7 @@ void Placement::bindObject() void Placement::directionActivated(int index) { if (ui->directionActivated(this, index)) { - /*emit*/ directionChanged(); + Q_EMIT directionChanged(); } } @@ -889,7 +889,7 @@ void TaskPlacement::setPlacement(const Base::Placement& p) void TaskPlacement::slotPlacementChanged(const QVariant & p, bool incr, bool data) { - /*emit*/ placementChanged(p, incr, data); + Q_EMIT placementChanged(p, incr, data); } bool TaskPlacement::accept() diff --git a/src/Gui/ProgressDialog.cpp b/src/Gui/ProgressDialog.cpp index 06bdf13382..40d06c2b5a 100644 --- a/src/Gui/ProgressDialog.cpp +++ b/src/Gui/ProgressDialog.cpp @@ -219,7 +219,7 @@ void SequencerDialog::showRemainingTime() QTime time( 0,0, 0); time = time.addSecs( rest/1000 ); QString remain = Gui::ProgressDialog::tr("Remaining: %1").arg(time.toString()); - QString status = QString::fromLatin1("%1\t[%2]").arg(txt).arg(remain); + QString status = QString::fromLatin1("%1\t[%2]").arg(txt, remain); if (thr != currentThread) { QMetaObject::invokeMethod(d->dlg, "setLabelText", diff --git a/src/Gui/PythonConsole.cpp b/src/Gui/PythonConsole.cpp index 589dae0f13..8317833eb4 100644 --- a/src/Gui/PythonConsole.cpp +++ b/src/Gui/PythonConsole.cpp @@ -508,7 +508,7 @@ void PythonConsole::OnChange(Base::Subject &rCaller, const char* sR #endif } else { - QMap::ConstIterator it = d->colormap.find(QString::fromLatin1(sReason)); + QMap::Iterator it = d->colormap.find(QString::fromLatin1(sReason)); if (it != d->colormap.end()) { QColor color = it.value(); unsigned int col = (color.red() << 24) | (color.green() << 16) | (color.blue() << 8); @@ -1030,7 +1030,7 @@ bool PythonConsole::canInsertFromMimeData (const QMimeData * source) const return true; if (source->hasUrls()) { QList uri = source->urls(); - for (QList::ConstIterator it = uri.begin(); it != uri.end(); ++it) { + for (QList::Iterator it = uri.begin(); it != uri.end(); ++it) { QFileInfo info((*it).toLocalFile()); if (info.exists() && info.isFile()) { QString ext = info.suffix().toLower(); @@ -1055,7 +1055,7 @@ void PythonConsole::insertFromMimeData (const QMimeData * source) bool existingFile = false; if (source->hasUrls()) { QList uri = source->urls(); - for (QList::ConstIterator it = uri.begin(); it != uri.end(); ++it) { + for (QList::Iterator it = uri.begin(); it != uri.end(); ++it) { // get the file name and check the extension QFileInfo info((*it).toLocalFile()); QString ext = info.suffix().toLower(); @@ -1481,7 +1481,7 @@ void PythonConsoleHighlighter::colorChanged(const QString& type, const QColor& c ConsoleHistory::ConsoleHistory() : _scratchBegin(0) { - _it = _history.end(); + _it = _history.cend(); } ConsoleHistory::~ConsoleHistory() @@ -1490,12 +1490,12 @@ ConsoleHistory::~ConsoleHistory() void ConsoleHistory::first() { - _it = _history.begin(); + _it = _history.cbegin(); } bool ConsoleHistory::more() { - return (_it != _history.end()); + return (_it != _history.cend()); } /** @@ -1508,10 +1508,10 @@ bool ConsoleHistory::next() bool wentNext = false; // if we didn't reach history's end ... - if (_it != _history.end()) + if (_it != _history.cend()) { // we go forward until we find an item matching the prefix. - for (++_it; _it != _history.end(); ++_it) + for (++_it; _it != _history.cend(); ++_it) { if (!_it->isEmpty() && _it->startsWith( _prefix )) { break; } @@ -1534,11 +1534,11 @@ bool ConsoleHistory::prev( const QString &prefix ) bool wentPrev = false; // store prefix if it's the first history access - if (_it == _history.end()) + if (_it == _history.cend()) { _prefix = prefix; } // while we didn't go back or reach history's begin ... - while (!wentPrev && _it != _history.begin()) + while (!wentPrev && _it != _history.cbegin()) { // go back in history and check if item matches prefix // Skip empty items @@ -1564,7 +1564,7 @@ void ConsoleHistory::append( const QString& item ) _history.append( item ); // reset iterator to make the next history // access begin with the latest item. - _it = _history.end(); + _it = _history.cend(); } const QStringList& ConsoleHistory::values() const @@ -1577,7 +1577,7 @@ const QStringList& ConsoleHistory::values() const */ void ConsoleHistory::restart( void ) { - _it = _history.end(); + _it = _history.cend(); } /** diff --git a/src/Gui/PythonDebugger.cpp b/src/Gui/PythonDebugger.cpp index 42aa980bf8..7e731a9dd6 100644 --- a/src/Gui/PythonDebugger.cpp +++ b/src/Gui/PythonDebugger.cpp @@ -509,22 +509,22 @@ bool PythonDebugger::stop() void PythonDebugger::tryStop() { d->trystop = true; - signalNextStep(); + Q_EMIT signalNextStep(); } void PythonDebugger::stepOver() { - signalNextStep(); + Q_EMIT signalNextStep(); } void PythonDebugger::stepInto() { - signalNextStep(); + Q_EMIT signalNextStep(); } void PythonDebugger::stepRun() { - signalNextStep(); + Q_EMIT signalNextStep(); } void PythonDebugger::showDebugMarker(const QString& fn, int line) diff --git a/src/Gui/QuantitySpinBox.cpp b/src/Gui/QuantitySpinBox.cpp index 096b7d4b01..e54c236743 100644 --- a/src/Gui/QuantitySpinBox.cpp +++ b/src/Gui/QuantitySpinBox.cpp @@ -599,8 +599,8 @@ void QuantitySpinBox::updateFromCache(bool notify, bool updateUnit /* = true */) // signaling if (notify) { d->pendingEmit = false; - valueChanged(res); - valueChanged(res.getValue()); + Q_EMIT valueChanged(res); + Q_EMIT valueChanged(res.getValue()); textChanged(text); } } @@ -956,7 +956,7 @@ void QuantitySpinBox::selectNumber() QChar g = locale().groupSeparator(); QChar n = locale().negativeSign(); - for (QString::iterator it = str.begin(); it != str.end(); ++it) { + for (QString::const_iterator it = str.cbegin(); it != str.cend(); ++it) { if (it->isDigit()) i++; else if (*it == d) diff --git a/src/Gui/QuantitySpinBox.h b/src/Gui/QuantitySpinBox.h index 8cdd06eaea..2ea41dc361 100644 --- a/src/Gui/QuantitySpinBox.h +++ b/src/Gui/QuantitySpinBox.h @@ -167,12 +167,12 @@ Q_SIGNALS: * Valid means the user inputted string obeys all restrictions * like: minimum, maximum and/or the right Unit (if specified). */ - void valueChanged(const Base::Quantity&); + void valueChanged(const Base::Quantity&); // clazy:exclude=overloaded-signal /** Gets emitted if the user has entered a VALID input * Valid means the user inputted string obeys all restrictions * like: minimum, maximum and/or the right Unit (if specified). */ - void valueChanged(double); + void valueChanged(double); // clazy:exclude=overloaded-signal /** * The new value is passed in \a text with unit. */ diff --git a/src/Gui/SpinBox.cpp b/src/Gui/SpinBox.cpp index 6866dbddcd..39fdf910b2 100644 --- a/src/Gui/SpinBox.cpp +++ b/src/Gui/SpinBox.cpp @@ -352,7 +352,7 @@ void UIntSpinBox::setValue(uint value) void UIntSpinBox::valueChange(int value) { - valueChanged(d->mapToUInt(value)); + Q_EMIT valueChanged(d->mapToUInt(value)); } uint UIntSpinBox::minimum() const diff --git a/src/Gui/SpinBox.h b/src/Gui/SpinBox.h index 976e0549d1..144d505030 100644 --- a/src/Gui/SpinBox.h +++ b/src/Gui/SpinBox.h @@ -134,7 +134,7 @@ public: void paintEvent(QPaintEvent *event); Q_SIGNALS: - void valueChanged( uint value ); + void valueChanged( uint value ); // clazy:exclude=overloaded-signal public Q_SLOTS: void setValue( uint value ); diff --git a/src/Gui/TaskView/TaskSelectLinkProperty.cpp b/src/Gui/TaskView/TaskSelectLinkProperty.cpp index 376c34e074..f15e9e7534 100644 --- a/src/Gui/TaskView/TaskSelectLinkProperty.cpp +++ b/src/Gui/TaskView/TaskSelectLinkProperty.cpp @@ -188,11 +188,11 @@ void TaskSelectLinkProperty::checkSelectionStatus(void) if (Filter->match()) { palette.setBrush(QPalette::Base,QColor(200,250,200)); - emitSelectionFit(); + Q_EMIT emitSelectionFit(); } else { palette.setBrush(QPalette::Base,QColor(250,200,200)); - emitSelectionMisfit(); + Q_EMIT emitSelectionMisfit(); } //ui->listWidget->setAutoFillBackground(true); ui->listWidget->setPalette(palette); diff --git a/src/Gui/TextEdit.cpp b/src/Gui/TextEdit.cpp index f47ef2f87b..923e2cf7ec 100644 --- a/src/Gui/TextEdit.cpp +++ b/src/Gui/TextEdit.cpp @@ -450,7 +450,7 @@ void TextEditor::OnChange(Base::Subject &rCaller,const char* sReaso lineNumberArea->setFont(font); } else { - QMap::ConstIterator it = d->colormap.find(QString::fromLatin1(sReason)); + QMap::Iterator it = d->colormap.find(QString::fromLatin1(sReason)); if (it != d->colormap.end()) { QColor color = it.value(); unsigned int col = (color.red() << 24) | (color.green() << 16) | (color.blue() << 8); @@ -579,7 +579,7 @@ bool CompletionList::eventFilter(QObject * watched, QEvent * event) hide(); return false; } else if (ke->key() == Qt::Key_Return || ke->key() == Qt::Key_Enter) { - itemActivated(currentItem()); + Q_EMIT itemActivated(currentItem()); return true; } } else if (event->type() == QEvent::FocusOut) { diff --git a/src/Gui/Thumbnail.cpp b/src/Gui/Thumbnail.cpp index d90fae75bf..50709df7ac 100644 --- a/src/Gui/Thumbnail.cpp +++ b/src/Gui/Thumbnail.cpp @@ -115,7 +115,7 @@ void Thumbnail::SaveDocFile (Base::Writer &writer) const if (!px.isNull()) { // according to specification add some meta-information to the image - uint mt = QDateTime::currentDateTime().toTime_t(); + uint mt = QDateTime::currentDateTimeUtc().toTime_t(); QString mtime = QString::fromLatin1("%1").arg(mt); img.setText(QLatin1String("Software"), qApp->applicationName()); img.setText(QLatin1String("Thumb::Mimetype"), QLatin1String("application/x-extension-fcstd")); diff --git a/src/Gui/ToolBarManager.cpp b/src/Gui/ToolBarManager.cpp index ef9e90872c..4f99f6d88d 100644 --- a/src/Gui/ToolBarManager.cpp +++ b/src/Gui/ToolBarManager.cpp @@ -71,7 +71,7 @@ ToolBarItem* ToolBarItem::findItem(const std::string& name) if ( _name == name ) { return this; } else { - for ( QList::ConstIterator it = _items.begin(); it != _items.end(); ++it ) { + for ( QList::Iterator it = _items.begin(); it != _items.end(); ++it ) { if ( (*it)->_name == name ) { return *it; } @@ -87,7 +87,7 @@ ToolBarItem* ToolBarItem::copy() const root->setCommand( command() ); QList items = getItems(); - for ( QList::ConstIterator it = items.begin(); it != items.end(); ++it ) { + for ( QList::Iterator it = items.begin(); it != items.end(); ++it ) { root->appendItem( (*it)->copy() ); } @@ -190,7 +190,7 @@ void ToolBarManager::setup(ToolBarItem* toolBarItems) ->GetGroup("Preferences")->GetGroup("MainWindow")->GetBool("ToolBarNameAsToolTip",true); QList items = toolBarItems->getItems(); QList toolbars = toolBars(); - for (QList::ConstIterator it = items.begin(); it != items.end(); ++it) { + for (QList::Iterator it = items.begin(); it != items.end(); ++it) { // search for the toolbar QString name = QString::fromUtf8((*it)->command().c_str()); this->toolbarNames << name; @@ -270,7 +270,7 @@ void ToolBarManager::setup(ToolBarItem* item, QToolBar* toolbar) const CommandManager& mgr = Application::Instance->commandManager(); QList items = item->getItems(); QList actions = toolbar->actions(); - for (QList::ConstIterator it = items.begin(); it != items.end(); ++it) { + for (QList::Iterator it = items.begin(); it != items.end(); ++it) { // search for the action item QAction* action = findAction(actions, QString::fromLatin1((*it)->command().c_str())); if (!action) { @@ -279,7 +279,7 @@ void ToolBarManager::setup(ToolBarItem* item, QToolBar* toolbar) const } else { // Check if action was added successfully if (mgr.addTo((*it)->command().c_str(), toolbar)) - action = toolbar->actions().last(); + action = toolbar->actions().constLast(); } // set the tool button user data @@ -378,7 +378,7 @@ QList ToolBarManager::toolBars() const QWidget* mw = getMainWindow(); QList tb; QList bars = getMainWindow()->findChildren(); - for (QList::ConstIterator it = bars.begin(); it != bars.end(); ++it) { + for (QList::Iterator it = bars.begin(); it != bars.end(); ++it) { if ((*it)->parentWidget() == mw) tb.push_back(*it); } diff --git a/src/Gui/ToolBoxManager.cpp b/src/Gui/ToolBoxManager.cpp index b14dcd3105..aa9e3ac549 100644 --- a/src/Gui/ToolBoxManager.cpp +++ b/src/Gui/ToolBoxManager.cpp @@ -83,7 +83,7 @@ void ToolBoxManager::setup( ToolBarItem* toolBar ) const CommandManager& mgr = Application::Instance->commandManager(); QList items = toolBar->getItems(); - for ( QList::ConstIterator item = items.begin(); item != items.end(); ++item ) + for ( QList::Iterator item = items.begin(); item != items.end(); ++item ) { QToolBar* bar = new QToolBar(); bar->setOrientation(Qt::Vertical); @@ -94,7 +94,7 @@ void ToolBoxManager::setup( ToolBarItem* toolBar ) const _toolBox->addItem( bar, bar->windowTitle() ); QList subitems = (*item)->getItems(); - for ( QList::ConstIterator subitem = subitems.begin(); subitem != subitems.end(); ++subitem ) + for ( QList::Iterator subitem = subitems.begin(); subitem != subitems.end(); ++subitem ) { if ( (*subitem)->command() == "Separator" ) { //bar->addSeparator(); diff --git a/src/Gui/Transform.cpp b/src/Gui/Transform.cpp index 9654d3fe8f..444e87b166 100644 --- a/src/Gui/Transform.cpp +++ b/src/Gui/Transform.cpp @@ -378,7 +378,7 @@ void Transform::on_applyButton_clicked() void Transform::directionActivated(int index) { if (ui->directionActivated(this, index)) { - /*emit*/ directionChanged(); + Q_EMIT directionChanged(); } } diff --git a/src/Gui/Tree.cpp b/src/Gui/Tree.cpp index d283d36be0..869b511e32 100644 --- a/src/Gui/Tree.cpp +++ b/src/Gui/Tree.cpp @@ -915,7 +915,7 @@ void TreeWidget::contextMenuEvent(QContextMenuEvent* e) objitem->object()->setupContextMenu(&editMenu, this, SLOT(onStartEditing())); QList editAct = editMenu.actions(); if (!editAct.isEmpty()) { - QAction* topact = contextMenu.actions().front(); + QAction* topact = contextMenu.actions().constFirst(); for (QList::iterator it = editAct.begin(); it != editAct.end(); ++it) contextMenu.insertAction(topact, *it); QAction* first = editAct.front(); @@ -1326,7 +1326,7 @@ void TreeWidget::selectAllLinks(App::DocumentObject* obj) { void TreeWidget::onSearchObjects() { - emitSearchObjects(); + Q_EMIT emitSearchObjects(); } void TreeWidget::onActivateDocument(QAction* active) @@ -3282,7 +3282,7 @@ const char* DocumentItem::getTreeName() const { for(auto _item : _it->second->items) { #define FOREACH_ITEM_ALL(_item) \ - for(auto _v : ObjectMap) {\ + for(const auto& _v : ObjectMap) {\ for(auto _item : _v.second->items) { #define END_FOREACH_ITEM }} diff --git a/src/Gui/ViewProviderGeoFeatureGroupExtension.h b/src/Gui/ViewProviderGeoFeatureGroupExtension.h index 8a09fd2246..0a9171b8a8 100644 --- a/src/Gui/ViewProviderGeoFeatureGroupExtension.h +++ b/src/Gui/ViewProviderGeoFeatureGroupExtension.h @@ -52,11 +52,11 @@ public: /// Show the object in the view: suppresses behavior of DocumentObjectGroup virtual void extensionShow(void) override { - ViewProviderExtension::extensionShow(); + ViewProviderExtension::extensionShow(); // clazy:exclude=skipped-base-method } /// Hide the object in the view: suppresses behavior of DocumentObjectGroup virtual void extensionHide(void) override { - ViewProviderExtension::extensionHide(); + ViewProviderExtension::extensionHide(); // clazy:exclude=skipped-base-method } virtual void extensionUpdateData(const App::Property*) override; diff --git a/src/Gui/Widgets.cpp b/src/Gui/Widgets.cpp index f866331e15..aedf846d95 100644 --- a/src/Gui/Widgets.cpp +++ b/src/Gui/Widgets.cpp @@ -89,7 +89,7 @@ void CommandIconView::startDrag (Qt::DropActions supportedActions) QPixmap pixmap; dataStream << items.count(); - for (QList::ConstIterator it = items.begin(); it != items.end(); ++it) { + for (QList::Iterator it = items.begin(); it != items.end(); ++it) { if (it == items.begin()) pixmap = ((*it)->data(Qt::UserRole)).value(); dataStream << (*it)->text(); @@ -113,7 +113,7 @@ void CommandIconView::startDrag (Qt::DropActions supportedActions) void CommandIconView::onSelectionChanged(QListWidgetItem * item, QListWidgetItem *) { if (item) - emitSelectionChanged(item->toolTip()); + Q_EMIT emitSelectionChanged(item->toolTip()); } // ------------------------------------------------------------------------------ @@ -825,12 +825,12 @@ void ColorButton::onChooseColor() QColor c = cd.selectedColor(); if (c.isValid()) { setColor(c); - changed(); + Q_EMIT changed(); } } else if (d->autoChange) { setColor(currentColor); - changed(); + Q_EMIT changed(); } } else { @@ -853,13 +853,13 @@ void ColorButton::onChooseColor() void ColorButton::onColorChosen(const QColor& c) { setColor(c); - changed(); + Q_EMIT changed(); } void ColorButton::onRejected() { setColor(d->old); - changed(); + Q_EMIT changed(); } // ------------------------------------------------------------------------------ @@ -1117,7 +1117,7 @@ void LabelButton::setValue(const QVariant& val) { _val = val; showValue(_val); - valueChanged(_val); + Q_EMIT valueChanged(_val); } void LabelButton::showValue(const QVariant& data) diff --git a/src/Gui/propertyeditor/PropertyItem.cpp b/src/Gui/propertyeditor/PropertyItem.cpp index cc5278610a..31eecf44a8 100644 --- a/src/Gui/propertyeditor/PropertyItem.cpp +++ b/src/Gui/propertyeditor/PropertyItem.cpp @@ -4374,7 +4374,7 @@ void LinkLabel::onLinkChanged() { auto links = dlg->currentLinks(); if(links != dlg->originalLinks()) { link = QVariant::fromValue(links); - /*emit*/ linkChanged(link); + Q_EMIT linkChanged(link); updatePropertyLink(); } } diff --git a/src/Gui/propertyeditor/PropertyItemDelegate.cpp b/src/Gui/propertyeditor/PropertyItemDelegate.cpp index 3f7be6fce7..f0288c3972 100644 --- a/src/Gui/propertyeditor/PropertyItemDelegate.cpp +++ b/src/Gui/propertyeditor/PropertyItemDelegate.cpp @@ -237,7 +237,7 @@ void PropertyItemDelegate::valueChanged() QWidget* editor = qobject_cast(sender()); if (editor) { Base::FlagToggler<> flag(changed); - commitData(editor); + Q_EMIT commitData(editor); } } diff --git a/src/Gui/propertyeditor/PropertyModel.cpp b/src/Gui/propertyeditor/PropertyModel.cpp index 6f91b9b4dc..1b6e837b04 100644 --- a/src/Gui/propertyeditor/PropertyModel.cpp +++ b/src/Gui/propertyeditor/PropertyModel.cpp @@ -436,7 +436,7 @@ void PropertyModel::updateProperty(const App::Property& prop) QModelIndex parent = this->index(item->parent()->row(), 0, QModelIndex()); item->assignProperty(&prop); QModelIndex data = this->index(item->row(), column, parent); - dataChanged(data, data); + Q_EMIT dataChanged(data, data); updateChildren(item, column, data); } @@ -492,7 +492,7 @@ void PropertyModel::updateChildren(PropertyItem* item, int column, const QModelI if (numChild > 0) { QModelIndex topLeft = this->index(0, column, parent); QModelIndex bottomRight = this->index(numChild, column, parent); - dataChanged(topLeft, bottomRight); + Q_EMIT dataChanged(topLeft, bottomRight); #if 0 // It seems we don't have to inform grand children for (int row=0; rowchild(row);