Refactoring. Replacing all Q_FOREACH/foreach loops with the c++ range-based
loops. --HG-- branch : develop
This commit is contained in:
parent
3252130f36
commit
6b6a2632a9
|
@ -41,6 +41,8 @@ win32 {
|
||||||
../../../dist/win/msvcr120.dll
|
../../../dist/win/msvcr120.dll
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFINES += QT_NO_FOREACH
|
||||||
|
|
||||||
macx{
|
macx{
|
||||||
# QTBUG-31034 qmake doesn't allow override QMAKE_CXX
|
# QTBUG-31034 qmake doesn't allow override QMAKE_CXX
|
||||||
CONFIG+=no_ccache
|
CONFIG+=no_ccache
|
||||||
|
|
|
@ -139,8 +139,8 @@ VPE::VProperty *VFormulaProperty::clone(bool include_children, VProperty *contai
|
||||||
|
|
||||||
if (!include_children)
|
if (!include_children)
|
||||||
{
|
{
|
||||||
QList<VProperty*> tmpChildren = container->getChildren();
|
const QList<VProperty*> tmpChildren = container->getChildren();
|
||||||
foreach (VProperty* tmpChild, tmpChildren)
|
for (auto tmpChild : tmpChildren)
|
||||||
{
|
{
|
||||||
container->removeChild(tmpChild);
|
container->removeChild(tmpChild);
|
||||||
delete tmpChild;
|
delete tmpChild;
|
||||||
|
|
|
@ -95,7 +95,7 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (auto& v, InitFormats())
|
for (auto &v : InitFormats())
|
||||||
{
|
{
|
||||||
ui->comboBoxFormat->addItem(v.first, QVariant(static_cast<int>(v.second)));
|
ui->comboBoxFormat->addItem(v.first, QVariant(static_cast<int>(v.second)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ void VAbstractLayoutDialog::InitTemplates(QComboBox *comboBoxTemplates)
|
||||||
const QString pdi = QString("(%1ppi)").arg(PrintDPI);
|
const QString pdi = QString("(%1ppi)").arg(PrintDPI);
|
||||||
|
|
||||||
auto cntr = static_cast<VIndexType>(PaperSizeTemplate::A0);
|
auto cntr = static_cast<VIndexType>(PaperSizeTemplate::A0);
|
||||||
foreach(const auto& v, pageFormatNames)
|
for(const auto& v : pageFormatNames)
|
||||||
{
|
{
|
||||||
if (cntr <= static_cast<int>(PaperSizeTemplate::Legal))
|
if (cntr <= static_cast<int>(PaperSizeTemplate::Legal))
|
||||||
{
|
{
|
||||||
|
|
|
@ -260,7 +260,7 @@ QStringList VAbstractPattern::ListMeasurements() const
|
||||||
QSet<QString> measurements;
|
QSet<QString> measurements;
|
||||||
QSet<QString> others = futureIncrements.result().toSet();
|
QSet<QString> others = futureIncrements.result().toSet();
|
||||||
|
|
||||||
foreach (const QString &token, tokens)
|
for (const auto &token : tokens)
|
||||||
{
|
{
|
||||||
if (token == QChar('-') || measurements.contains(token) || others.contains(token))
|
if (token == QChar('-') || measurements.contains(token) || others.contains(token))
|
||||||
{
|
{
|
||||||
|
|
|
@ -207,7 +207,7 @@ void VVITConverter::ConvertMeasurementsToV0_3_0()
|
||||||
|
|
||||||
// This has the same effect as a .values(), just isn't as elegant
|
// This has the same effect as a .values(), just isn't as elegant
|
||||||
const QList<QString> list = names.values( keys.at(i) );
|
const QList<QString> list = names.values( keys.at(i) );
|
||||||
foreach(const QString &val, list )
|
for(const auto &val : list)
|
||||||
{
|
{
|
||||||
const QDomNodeList nodeList = this->elementsByTagName(val);
|
const QDomNodeList nodeList = this->elementsByTagName(val);
|
||||||
if (nodeList.isEmpty())
|
if (nodeList.isEmpty())
|
||||||
|
|
|
@ -222,7 +222,7 @@ void VVSTConverter::ConvertMeasurementsToV0_4_0()
|
||||||
|
|
||||||
// This has the same effect as a .values(), just isn't as elegant
|
// This has the same effect as a .values(), just isn't as elegant
|
||||||
const QList<QString> list = names.values( keys.at(i) );
|
const QList<QString> list = names.values( keys.at(i) );
|
||||||
foreach(const QString &val, list )
|
for(const auto &val : list)
|
||||||
{
|
{
|
||||||
const QDomNodeList nodeList = this->elementsByTagName(val);
|
const QDomNodeList nodeList = this->elementsByTagName(val);
|
||||||
if (nodeList.isEmpty())
|
if (nodeList.isEmpty())
|
||||||
|
|
|
@ -681,32 +681,29 @@ void VDxfEngine::ExportAAMADraw(dx_ifaceBlock *detailBlock, const VLayoutPiece &
|
||||||
if (not detail.IsHideMainPath())
|
if (not detail.IsHideMainPath())
|
||||||
{
|
{
|
||||||
QVector<QPointF> poly = detail.GetContourPoints();
|
QVector<QPointF> poly = detail.GetContourPoints();
|
||||||
DRW_Entity *e = AAMAPolygon(poly, "8", true);
|
if (DRW_Entity *e = AAMAPolygon(poly, "8", true))
|
||||||
if (e)
|
|
||||||
{
|
{
|
||||||
detailBlock->ent.push_back(e);
|
detailBlock->ent.push_back(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<QVector<QPointF>> drawIntCut = detail.InternalPathsForCut(false);
|
const QVector<QVector<QPointF>> drawIntCut = detail.InternalPathsForCut(false);
|
||||||
for(int j = 0; j < drawIntCut.size(); ++j)
|
for(auto &intCut : drawIntCut)
|
||||||
{
|
{
|
||||||
DRW_Entity *e = AAMAPolygon(drawIntCut.at(j), "8", false);
|
if (DRW_Entity *e = AAMAPolygon(intCut, "8", false))
|
||||||
if (e)
|
|
||||||
{
|
{
|
||||||
detailBlock->ent.push_back(e);
|
detailBlock->ent.push_back(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const QVector<VLayoutPlaceLabel> labels = detail.GetPlaceLabels();
|
const QVector<VLayoutPlaceLabel> labels = detail.GetPlaceLabels();
|
||||||
foreach(const VLayoutPlaceLabel &label, labels)
|
for(auto &label : labels)
|
||||||
{
|
{
|
||||||
if (label.type != PlaceLabelType::Doubletree && label.type != PlaceLabelType::Button)
|
if (label.type != PlaceLabelType::Doubletree && label.type != PlaceLabelType::Button)
|
||||||
{
|
{
|
||||||
foreach(const QPolygonF &p, label.shape)
|
for(auto &p : qAsConst(label.shape))
|
||||||
{
|
{
|
||||||
DRW_Entity *e = AAMAPolygon(p, "8", false);
|
if (DRW_Entity *e = AAMAPolygon(p, "8", false))
|
||||||
if (e)
|
|
||||||
{
|
{
|
||||||
detailBlock->ent.push_back(e);
|
detailBlock->ent.push_back(e);
|
||||||
}
|
}
|
||||||
|
@ -719,10 +716,9 @@ void VDxfEngine::ExportAAMADraw(dx_ifaceBlock *detailBlock, const VLayoutPiece &
|
||||||
void VDxfEngine::ExportAAMAIntcut(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail)
|
void VDxfEngine::ExportAAMAIntcut(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail)
|
||||||
{
|
{
|
||||||
QVector<QVector<QPointF>> drawIntCut = detail.InternalPathsForCut(true);
|
QVector<QVector<QPointF>> drawIntCut = detail.InternalPathsForCut(true);
|
||||||
for(int j = 0; j < drawIntCut.size(); ++j)
|
for(auto &intCut : drawIntCut)
|
||||||
{
|
{
|
||||||
DRW_Entity *e = AAMAPolygon(drawIntCut.at(j), "11", false);
|
if (DRW_Entity *e = AAMAPolygon(intCut, "11", false))
|
||||||
if (e)
|
|
||||||
{
|
{
|
||||||
detailBlock->ent.push_back(e);
|
detailBlock->ent.push_back(e);
|
||||||
}
|
}
|
||||||
|
@ -751,8 +747,7 @@ void VDxfEngine::ExportAAMAGrainline(dx_ifaceBlock *detailBlock, const VLayoutPi
|
||||||
const QVector<QPointF> grainline = detail.GetGrainline();
|
const QVector<QPointF> grainline = detail.GetGrainline();
|
||||||
if (grainline.count() > 1)
|
if (grainline.count() > 1)
|
||||||
{
|
{
|
||||||
DRW_Entity *e = AAMALine(QLineF(grainline.first(), grainline.last()), "7");
|
if (DRW_Entity *e = AAMALine(QLineF(grainline.first(), grainline.last()), "7"))
|
||||||
if (e)
|
|
||||||
{
|
{
|
||||||
detailBlock->ent.push_back(e);
|
detailBlock->ent.push_back(e);
|
||||||
}
|
}
|
||||||
|
@ -795,7 +790,7 @@ void VDxfEngine::ExportAAMADrill(dx_ifaceBlock *detailBlock, const VLayoutPiece
|
||||||
{
|
{
|
||||||
const QVector<VLayoutPlaceLabel> labels = detail.GetPlaceLabels();
|
const QVector<VLayoutPlaceLabel> labels = detail.GetPlaceLabels();
|
||||||
|
|
||||||
foreach(const VLayoutPlaceLabel &label, labels)
|
for(auto &label : labels)
|
||||||
{
|
{
|
||||||
if (label.type == PlaceLabelType::Doubletree || label.type == PlaceLabelType::Button)
|
if (label.type == PlaceLabelType::Doubletree || label.type == PlaceLabelType::Button)
|
||||||
{
|
{
|
||||||
|
|
|
@ -658,13 +658,13 @@ bool VMeasurements::IsDefinedKnownNamesValid() const
|
||||||
QStringList names = AllGroupNames();
|
QStringList names = AllGroupNames();
|
||||||
|
|
||||||
QSet<QString> set;
|
QSet<QString> set;
|
||||||
foreach (const QString &var, names)
|
for (const auto &var : names)
|
||||||
{
|
{
|
||||||
set.insert(var);
|
set.insert(var);
|
||||||
}
|
}
|
||||||
|
|
||||||
names = ListKnown();
|
names = ListKnown();
|
||||||
foreach (const QString &var, names)
|
for (const auto &var : qAsConst(names))
|
||||||
{
|
{
|
||||||
if (not set.contains(var))
|
if (not set.contains(var))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1017,7 +1017,7 @@ bool VAbstractPiece::IsEkvPointOnLine(const VSAPoint &iPoint, const VSAPoint &pr
|
||||||
QPainterPath VAbstractPiece::PlaceLabelImgPath(const PlaceLabelImg &img)
|
QPainterPath VAbstractPiece::PlaceLabelImgPath(const PlaceLabelImg &img)
|
||||||
{
|
{
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
foreach(const QPolygonF &p, img)
|
for (auto &p : img)
|
||||||
{
|
{
|
||||||
if (not p.isEmpty())
|
if (not p.isEmpty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -470,12 +470,12 @@ template <>
|
||||||
QVector<VLayoutPlaceLabel> VLayoutPiece::Map<VLayoutPlaceLabel>(const QVector<VLayoutPlaceLabel> &points) const
|
QVector<VLayoutPlaceLabel> VLayoutPiece::Map<VLayoutPlaceLabel>(const QVector<VLayoutPlaceLabel> &points) const
|
||||||
{
|
{
|
||||||
QVector<VLayoutPlaceLabel> p;
|
QVector<VLayoutPlaceLabel> p;
|
||||||
foreach (const VLayoutPlaceLabel &label, points)
|
for (auto &label : points)
|
||||||
{
|
{
|
||||||
VLayoutPlaceLabel mappedLabel;
|
VLayoutPlaceLabel mappedLabel;
|
||||||
mappedLabel.type = label.type;
|
mappedLabel.type = label.type;
|
||||||
mappedLabel.center = d->matrix.map(label.center);
|
mappedLabel.center = d->matrix.map(label.center);
|
||||||
foreach (const QPolygonF &p, label.shape)
|
for (const auto &p : label.shape)
|
||||||
{
|
{
|
||||||
mappedLabel.shape.append(d->matrix.map(p));
|
mappedLabel.shape.append(d->matrix.map(p));
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,8 @@ DialogExportToCSV::DialogExportToCSV(QWidget *parent)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
foreach (int mib, QTextCodec::availableMibs())
|
const QList<int> mibs = QTextCodec::availableMibs();
|
||||||
|
for (auto mib : mibs)
|
||||||
{
|
{
|
||||||
ui->comboBoxCodec->addItem(QTextCodec::codecForMib(mib)->name(), mib);
|
ui->comboBoxCodec->addItem(QTextCodec::codecForMib(mib)->name(), mib);
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,7 @@ void VTableSearch::Find(const QString &term)
|
||||||
|
|
||||||
if (not searchList.isEmpty())
|
if (not searchList.isEmpty())
|
||||||
{
|
{
|
||||||
foreach(QTableWidgetItem *item, searchList)
|
for (auto item : qAsConst(searchList))
|
||||||
{
|
{
|
||||||
item->setBackground(Qt::yellow);
|
item->setBackground(Qt::yellow);
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ void VTableSearch::RemoveRow(int row)
|
||||||
|
|
||||||
if (row <= indexRow)
|
if (row <= indexRow)
|
||||||
{
|
{
|
||||||
foreach(QTableWidgetItem *item, searchList)
|
for (auto item : qAsConst(searchList))
|
||||||
{
|
{
|
||||||
if (item->row() == row)
|
if (item->row() == row)
|
||||||
{
|
{
|
||||||
|
@ -180,7 +180,7 @@ void VTableSearch::AddRow(int row)
|
||||||
|
|
||||||
if (row <= indexRow)
|
if (row <= indexRow)
|
||||||
{
|
{
|
||||||
foreach(QTableWidgetItem *item, searchList)
|
for (auto item : qAsConst(searchList))
|
||||||
{
|
{
|
||||||
if (item->row() == row)
|
if (item->row() == row)
|
||||||
{
|
{
|
||||||
|
@ -202,7 +202,7 @@ void VTableSearch::RefreshList(const QString &term)
|
||||||
|
|
||||||
searchList = table->findItems(term, Qt::MatchContains);
|
searchList = table->findItems(term, Qt::MatchContains);
|
||||||
|
|
||||||
foreach(QTableWidgetItem *item, searchList)
|
for (auto item : qAsConst(searchList))
|
||||||
{
|
{
|
||||||
item->setBackground(Qt::yellow);
|
item->setBackground(Qt::yellow);
|
||||||
}
|
}
|
||||||
|
|
|
@ -681,22 +681,22 @@ QList<quint32> VPiece::Dependencies() const
|
||||||
{
|
{
|
||||||
QList<quint32> list = d->m_path.Dependencies();
|
QList<quint32> list = d->m_path.Dependencies();
|
||||||
|
|
||||||
foreach (const CustomSARecord &record, d->m_customSARecords)
|
for (auto &record : d->m_customSARecords)
|
||||||
{
|
{
|
||||||
list.append(record.path);
|
list.append(record.path);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (const quint32 &value, d->m_internalPaths)
|
for (auto &value : d->m_internalPaths)
|
||||||
{
|
{
|
||||||
list.append(value);
|
list.append(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (const quint32 &value, d->m_pins)
|
for (auto &value : d->m_pins)
|
||||||
{
|
{
|
||||||
list.append(value);
|
list.append(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (const quint32 &value, d->m_placeLabels)
|
for (auto &value : d->m_placeLabels)
|
||||||
{
|
{
|
||||||
list.append(value);
|
list.append(value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -505,7 +505,7 @@ VSAPoint VPiecePath::EndSegment(const VContainer *data, const QVector<VPieceNode
|
||||||
QList<quint32> VPiecePath::Dependencies() const
|
QList<quint32> VPiecePath::Dependencies() const
|
||||||
{
|
{
|
||||||
QList<quint32> list;
|
QList<quint32> list;
|
||||||
foreach (const VPieceNode &node, d->m_nodes)
|
for (auto &node : d->m_nodes)
|
||||||
{
|
{
|
||||||
list.append(node.GetId());
|
list.append(node.GetId());
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,7 +222,9 @@ QPushButton *CheckableMessageBox::addButton(const QString &text, QDialogButtonBo
|
||||||
|
|
||||||
QDialogButtonBox::StandardButton CheckableMessageBox::defaultButton() const
|
QDialogButtonBox::StandardButton CheckableMessageBox::defaultButton() const
|
||||||
{
|
{
|
||||||
foreach (QAbstractButton *b, d->buttonBox->buttons())
|
const QList<QAbstractButton *> buttons = d->buttonBox->buttons();
|
||||||
|
for (auto b : buttons)
|
||||||
|
{
|
||||||
if (QPushButton *pb = qobject_cast<QPushButton *>(b))
|
if (QPushButton *pb = qobject_cast<QPushButton *>(b))
|
||||||
{
|
{
|
||||||
if (pb->isDefault())
|
if (pb->isDefault())
|
||||||
|
@ -230,6 +232,7 @@ QDialogButtonBox::StandardButton CheckableMessageBox::defaultButton() const
|
||||||
return d->buttonBox->standardButton(pb);
|
return d->buttonBox->standardButton(pb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return QDialogButtonBox::NoButton;
|
return QDialogButtonBox::NoButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -429,7 +432,7 @@ bool CheckableMessageBox::hasSuppressedQuestions(QSettings *settings)
|
||||||
//Q_ASSERT(settings, return false);
|
//Q_ASSERT(settings, return false);
|
||||||
bool hasSuppressed = false;
|
bool hasSuppressed = false;
|
||||||
settings->beginGroup(QLatin1String(kDoNotAskAgainKey));
|
settings->beginGroup(QLatin1String(kDoNotAskAgainKey));
|
||||||
foreach (const QString &subKey, settings->childKeys())
|
for (auto &subKey : settings->childKeys())
|
||||||
{
|
{
|
||||||
if (settings->value(subKey, false).toBool())
|
if (settings->value(subKey, false).toBool())
|
||||||
{
|
{
|
||||||
|
|
|
@ -115,8 +115,8 @@ VPE::VProperty* VPE::QVector3DProperty::clone(bool include_children, VProperty*
|
||||||
|
|
||||||
if (!include_children)
|
if (!include_children)
|
||||||
{
|
{
|
||||||
QList<VProperty*> tmpChildren = container->getChildren();
|
const QList<VProperty*> tmpChildren = container->getChildren();
|
||||||
foreach (VProperty* tmpChild, tmpChildren)
|
for (auto tmpChild : tmpChildren)
|
||||||
{
|
{
|
||||||
container->removeChild(tmpChild);
|
container->removeChild(tmpChild);
|
||||||
delete tmpChild;
|
delete tmpChild;
|
||||||
|
|
|
@ -245,7 +245,7 @@ bool VPE::VFileEditWidget::checkFileFilter(const QString& file) const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(QString tmpFilter, FilterList)
|
for (auto &tmpFilter : FilterList)
|
||||||
{
|
{
|
||||||
QRegExp tmpRegExpFilter(tmpFilter, Qt::CaseInsensitive, QRegExp::Wildcard);
|
QRegExp tmpRegExpFilter(tmpFilter, Qt::CaseInsensitive, QRegExp::Wildcard);
|
||||||
if (tmpRegExpFilter.exactMatch(file))
|
if (tmpRegExpFilter.exactMatch(file))
|
||||||
|
|
|
@ -114,8 +114,8 @@ VPE::VProperty *VPE::VPointFProperty::clone(bool include_children, VProperty *co
|
||||||
|
|
||||||
if (!include_children)
|
if (!include_children)
|
||||||
{
|
{
|
||||||
QList<VProperty*> tmpChildren = container->getChildren();
|
const QList<VProperty*> tmpChildren = container->getChildren();
|
||||||
foreach(VProperty* tmpChild, tmpChildren)
|
for(auto tmpChild : tmpChildren)
|
||||||
{
|
{
|
||||||
container->removeChild(tmpChild);
|
container->removeChild(tmpChild);
|
||||||
delete tmpChild;
|
delete tmpChild;
|
||||||
|
|
|
@ -350,9 +350,11 @@ QMap<QString, QVariant> VPE::VProperty::getSettings() const
|
||||||
{
|
{
|
||||||
QMap<QString, QVariant> tmpResult;
|
QMap<QString, QVariant> tmpResult;
|
||||||
|
|
||||||
QStringList tmpKeyList = getSettingKeys();
|
const QStringList tmpKeyList = getSettingKeys();
|
||||||
foreach(const QString& tmpKey, tmpKeyList)
|
for(auto &tmpKey : tmpKeyList)
|
||||||
|
{
|
||||||
tmpResult.insert(tmpKey, getSetting(tmpKey));
|
tmpResult.insert(tmpKey, getSetting(tmpKey));
|
||||||
|
}
|
||||||
|
|
||||||
return tmpResult;
|
return tmpResult;
|
||||||
}
|
}
|
||||||
|
@ -392,9 +394,12 @@ VPE::VProperty* VPE::VProperty::clone(bool include_children, VProperty* containe
|
||||||
|
|
||||||
if (include_children)
|
if (include_children)
|
||||||
{
|
{
|
||||||
foreach(VProperty* tmpChild, d_ptr->Children)
|
const QList<VProperty*> children = d_ptr->Children;
|
||||||
|
for (auto tmpChild : children)
|
||||||
|
{
|
||||||
container->addChild(tmpChild->clone(true));
|
container->addChild(tmpChild->clone(true));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,9 +213,9 @@ void VPE::VPropertyFormView::connectPropertyFormWidget(VPropertyFormWidget *widg
|
||||||
|
|
||||||
connect(widget, &VPropertyFormWidget::propertyDataSubmitted, this, &VPropertyFormView::dataSubmitted,
|
connect(widget, &VPropertyFormWidget::propertyDataSubmitted, this, &VPropertyFormView::dataSubmitted,
|
||||||
Qt::UniqueConnection);
|
Qt::UniqueConnection);
|
||||||
QList<VPropertyFormWidget*> tmpList = widget->getChildPropertyFormWidgets();
|
const QList<VPropertyFormWidget*> tmpList = widget->getChildPropertyFormWidgets();
|
||||||
|
|
||||||
foreach(VPropertyFormWidget* tmpEditorWidget, tmpList)
|
for (auto tmpEditorWidget : tmpList)
|
||||||
{
|
{
|
||||||
connectPropertyFormWidget(tmpEditorWidget);
|
connectPropertyFormWidget(tmpEditorWidget);
|
||||||
}
|
}
|
||||||
|
|
|
@ -268,8 +268,8 @@ void VPE::VPropertyFormWidget::setCommitBehaviour(bool auto_commit)
|
||||||
{
|
{
|
||||||
d_ptr->UpdateEditors = auto_commit;
|
d_ptr->UpdateEditors = auto_commit;
|
||||||
|
|
||||||
QList<VPropertyFormWidget*> tmpChildFormWidgets = getChildPropertyFormWidgets();
|
const QList<VPropertyFormWidget*> tmpChildFormWidgets = getChildPropertyFormWidgets();
|
||||||
foreach(VPropertyFormWidget* tmpChild, tmpChildFormWidgets)
|
for (auto tmpChild : tmpChildFormWidgets)
|
||||||
{
|
{
|
||||||
if (tmpChild)
|
if (tmpChild)
|
||||||
{
|
{
|
||||||
|
@ -281,7 +281,7 @@ void VPE::VPropertyFormWidget::setCommitBehaviour(bool auto_commit)
|
||||||
QList<VPE::VPropertyFormWidget *> VPE::VPropertyFormWidget::getChildPropertyFormWidgets() const
|
QList<VPE::VPropertyFormWidget *> VPE::VPropertyFormWidget::getChildPropertyFormWidgets() const
|
||||||
{
|
{
|
||||||
QList<VPropertyFormWidget *> tmpResult;
|
QList<VPropertyFormWidget *> tmpResult;
|
||||||
foreach(const VPropertyFormWidgetPrivate::SEditorWidget& tmpEditorWidget, d_ptr->EditorWidgets)
|
for (auto &tmpEditorWidget : d_ptr->EditorWidgets)
|
||||||
{
|
{
|
||||||
if (tmpEditorWidget.FormWidget)
|
if (tmpEditorWidget.FormWidget)
|
||||||
{
|
{
|
||||||
|
|
|
@ -204,9 +204,11 @@ VPE::VPropertySet* VPE::VPropertySet::clone() const
|
||||||
{
|
{
|
||||||
VPropertySet* tmpResult = new VPropertySet();
|
VPropertySet* tmpResult = new VPropertySet();
|
||||||
|
|
||||||
foreach(VProperty* tmpProperty, d_ptr->RootProperties)
|
const QList<VProperty*> rootProperties = d_ptr->RootProperties;
|
||||||
|
for (auto tmpProperty : rootProperties)
|
||||||
|
{
|
||||||
cloneProperty(tmpProperty, nullptr, tmpResult);
|
cloneProperty(tmpProperty, nullptr, tmpResult);
|
||||||
|
}
|
||||||
|
|
||||||
return tmpResult;
|
return tmpResult;
|
||||||
}
|
}
|
||||||
|
@ -219,7 +221,7 @@ bool VPE::VPropertySet::hasProperty(VProperty *property, VProperty *parent) cons
|
||||||
}
|
}
|
||||||
|
|
||||||
const QList<VProperty*>& tmpChildrenList = (parent != nullptr ? parent->getChildren() : d_ptr->RootProperties);
|
const QList<VProperty*>& tmpChildrenList = (parent != nullptr ? parent->getChildren() : d_ptr->RootProperties);
|
||||||
foreach(VProperty* tmpProp, tmpChildrenList)
|
for(auto tmpProp : tmpChildrenList)
|
||||||
{
|
{
|
||||||
if (tmpProp && (tmpProp == property || hasProperty(property, tmpProp)))
|
if (tmpProp && (tmpProp == property || hasProperty(property, tmpProp)))
|
||||||
{
|
{
|
||||||
|
@ -253,13 +255,17 @@ void VPE::VPropertySet::cloneProperty(VProperty* property_to_clone, VProperty *p
|
||||||
void VPE::VPropertySet::removePropertyFromSet(VProperty *prop)
|
void VPE::VPropertySet::removePropertyFromSet(VProperty *prop)
|
||||||
{
|
{
|
||||||
// Remove all the children
|
// Remove all the children
|
||||||
foreach(VProperty* tmpChild, prop->getChildren())
|
const QList<VPE::VProperty*>& children = prop->getChildren();
|
||||||
|
for (auto tmpChild : children)
|
||||||
|
{
|
||||||
removeProperty(tmpChild);
|
removeProperty(tmpChild);
|
||||||
|
}
|
||||||
|
|
||||||
|
const QList<QString> tmpKeys = d_ptr->Properties.keys(prop);
|
||||||
QList<QString> tmpKeys = d_ptr->Properties.keys(prop);
|
for (auto &tmpID : tmpKeys)
|
||||||
foreach(const QString& tmpID, tmpKeys)
|
{
|
||||||
d_ptr->Properties.remove(tmpID);
|
d_ptr->Properties.remove(tmpID);
|
||||||
|
}
|
||||||
|
|
||||||
// Remove from list
|
// Remove from list
|
||||||
d_ptr->RootProperties.removeAll(prop);
|
d_ptr->RootProperties.removeAll(prop);
|
||||||
|
|
|
@ -61,7 +61,7 @@ void VPE::VSerializedProperty::initChildren(const VProperty *property, const VPr
|
||||||
if (property && set)
|
if (property && set)
|
||||||
{
|
{
|
||||||
const QList<VProperty*>& tmpChildren = property->getChildren();
|
const QList<VProperty*>& tmpChildren = property->getChildren();
|
||||||
foreach(const VProperty* tmpChild, tmpChildren)
|
for (auto tmpChild : tmpChildren)
|
||||||
{
|
{
|
||||||
QString tmpChildID = set->getPropertyID(property);
|
QString tmpChildID = set->getPropertyID(property);
|
||||||
Children.append(VSerializedProperty(tmpChild, tmpChildID, set));
|
Children.append(VSerializedProperty(tmpChild, tmpChildID, set));
|
||||||
|
|
|
@ -163,9 +163,9 @@ bool AbstractTest::CopyRecursively(const QString &srcFilePath, const QString &tg
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
QDir sourceDir(srcFilePath);
|
QDir sourceDir(srcFilePath);
|
||||||
QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden |
|
const QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot |
|
||||||
QDir::System);
|
QDir::Hidden | QDir::System);
|
||||||
foreach (const QString &fileName, fileNames)
|
for (auto &fileName : fileNames)
|
||||||
{
|
{
|
||||||
const QString newSrcFilePath = srcFilePath + QDir::separator() + fileName;
|
const QString newSrcFilePath = srcFilePath + QDir::separator() + fileName;
|
||||||
const QString newTgtFilePath = tgtFilePath + QDir::separator() + fileName;
|
const QString newTgtFilePath = tgtFilePath + QDir::separator() + fileName;
|
||||||
|
|
|
@ -106,7 +106,7 @@ QPointF GetOriginPoint(const QVector<quint32> objects, const VContainer *data, q
|
||||||
originObjects.append(data->GeometricObject<VAbstractCurve>(id)->GetPoints());
|
originObjects.append(data->GeometricObject<VAbstractCurve>(id)->GetPoints());
|
||||||
#else
|
#else
|
||||||
const QVector<QPointF> points = data->GeometricObject<VAbstractCurve>(id)->GetPoints();
|
const QVector<QPointF> points = data->GeometricObject<VAbstractCurve>(id)->GetPoints();
|
||||||
foreach (const QPointF &point, points)
|
for (auto &point : points)
|
||||||
{
|
{
|
||||||
originObjects.append(point);
|
originObjects.append(point);
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,7 +174,7 @@ void VAbstractSpline::AllowHover(bool enabled)
|
||||||
// Manually handle hover events. Need for setting cursor for not selectable paths.
|
// Manually handle hover events. Need for setting cursor for not selectable paths.
|
||||||
m_acceptHoverEvents = enabled;
|
m_acceptHoverEvents = enabled;
|
||||||
|
|
||||||
foreach (auto *point, controlPoints)
|
for (auto point : qAsConst(controlPoints))
|
||||||
{
|
{
|
||||||
point->setAcceptHoverEvents(enabled);
|
point->setAcceptHoverEvents(enabled);
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ void VAbstractSpline::AllowSelecting(bool enabled)
|
||||||
{
|
{
|
||||||
setFlag(QGraphicsItem::ItemIsSelectable, enabled);
|
setFlag(QGraphicsItem::ItemIsSelectable, enabled);
|
||||||
|
|
||||||
foreach (auto *point, controlPoints)
|
for (auto point : qAsConst(controlPoints))
|
||||||
{
|
{
|
||||||
point->setFlag(QGraphicsItem::ItemIsSelectable, enabled);
|
point->setFlag(QGraphicsItem::ItemIsSelectable, enabled);
|
||||||
}
|
}
|
||||||
|
@ -424,7 +424,7 @@ void VAbstractSpline::CurveSelected(bool selected)
|
||||||
{
|
{
|
||||||
setSelected(selected);
|
setSelected(selected);
|
||||||
|
|
||||||
foreach (auto *point, controlPoints)
|
for (auto point : qAsConst(controlPoints))
|
||||||
{
|
{
|
||||||
point->blockSignals(true);
|
point->blockSignals(true);
|
||||||
point->setSelected(selected);
|
point->setSelected(selected);
|
||||||
|
|
|
@ -294,7 +294,7 @@ void VToolSpline::EnableToolMove(bool move)
|
||||||
{
|
{
|
||||||
this->setFlag(QGraphicsItem::ItemIsMovable, move);
|
this->setFlag(QGraphicsItem::ItemIsMovable, move);
|
||||||
|
|
||||||
foreach (auto *point, controlPoints)
|
for (auto point : qAsConst(controlPoints))
|
||||||
{
|
{
|
||||||
point->setFlag(QGraphicsItem::ItemIsMovable, move);
|
point->setFlag(QGraphicsItem::ItemIsMovable, move);
|
||||||
}
|
}
|
||||||
|
@ -562,7 +562,7 @@ bool VToolSpline::IsMovable() const
|
||||||
void VToolSpline::RefreshCtrlPoints()
|
void VToolSpline::RefreshCtrlPoints()
|
||||||
{
|
{
|
||||||
// Very important to disable control points. Without it the pogram can't move the curve.
|
// Very important to disable control points. Without it the pogram can't move the curve.
|
||||||
foreach (auto *point, controlPoints)
|
for (auto point : qAsConst(controlPoints))
|
||||||
{
|
{
|
||||||
point->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false);
|
point->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false);
|
||||||
}
|
}
|
||||||
|
@ -595,7 +595,7 @@ void VToolSpline::RefreshCtrlPoints()
|
||||||
controlPoints[0]->blockSignals(false);
|
controlPoints[0]->blockSignals(false);
|
||||||
controlPoints[1]->blockSignals(false);
|
controlPoints[1]->blockSignals(false);
|
||||||
|
|
||||||
foreach (auto *point, controlPoints)
|
for (auto point : qAsConst(controlPoints))
|
||||||
{
|
{
|
||||||
point->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
point->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -293,7 +293,7 @@ void VToolSplinePath::EnableToolMove(bool move)
|
||||||
{
|
{
|
||||||
this->setFlag(QGraphicsItem::ItemIsMovable, move);
|
this->setFlag(QGraphicsItem::ItemIsMovable, move);
|
||||||
|
|
||||||
foreach (auto *point, controlPoints)
|
for (auto point : qAsConst(controlPoints))
|
||||||
{
|
{
|
||||||
point->setFlag(QGraphicsItem::ItemIsMovable, move);
|
point->setFlag(QGraphicsItem::ItemIsMovable, move);
|
||||||
}
|
}
|
||||||
|
@ -727,7 +727,7 @@ bool VToolSplinePath::IsMovable(int index) const
|
||||||
void VToolSplinePath::RefreshCtrlPoints()
|
void VToolSplinePath::RefreshCtrlPoints()
|
||||||
{
|
{
|
||||||
// Very important to disable control points. Without it the pogram can't move the curve.
|
// Very important to disable control points. Without it the pogram can't move the curve.
|
||||||
foreach (auto *point, controlPoints)
|
for (auto point : qAsConst(controlPoints))
|
||||||
{
|
{
|
||||||
point->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false);
|
point->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false);
|
||||||
}
|
}
|
||||||
|
@ -765,7 +765,7 @@ void VToolSplinePath::RefreshCtrlPoints()
|
||||||
controlPoints[j-1]->blockSignals(false);
|
controlPoints[j-1]->blockSignals(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (auto *point, controlPoints)
|
for (auto point : qAsConst(controlPoints))
|
||||||
{
|
{
|
||||||
point->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
point->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1442,7 +1442,7 @@ void VToolSeamAllowance::SaveDialogChange(const QString &undoText)
|
||||||
{
|
{
|
||||||
qApp->getUndoStack()->beginMacro(undoText.isEmpty() ? saveCommand->text(): undoText);
|
qApp->getUndoStack()->beginMacro(undoText.isEmpty() ? saveCommand->text(): undoText);
|
||||||
|
|
||||||
foreach (QUndoCommand* command, undocommands)
|
for (auto command : undocommands)
|
||||||
{
|
{
|
||||||
qApp->getUndoStack()->push(command);
|
qApp->getUndoStack()->push(command);
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ QSize FancyTabBar::TabSizeHint(bool minimum) const
|
||||||
if (words.size() > 1)
|
if (words.size() > 1)
|
||||||
{
|
{
|
||||||
QString sentence;
|
QString sentence;
|
||||||
foreach(const QString & word, words)
|
for (auto &word : words)
|
||||||
{
|
{
|
||||||
sentence = sentence.isEmpty() ? sentence = word : sentence + QLatin1Char(' ') + word;
|
sentence = sentence.isEmpty() ? sentence = word : sentence + QLatin1Char(' ') + word;
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,8 @@ void StyleHelper::setBaseColor(const QColor &newcolor)
|
||||||
if (color.isValid() && color != m_baseColor)
|
if (color.isValid() && color != m_baseColor)
|
||||||
{
|
{
|
||||||
m_baseColor = color;
|
m_baseColor = color;
|
||||||
foreach (QWidget *w, QApplication::topLevelWidgets())
|
const QWidgetList widgets = QApplication::topLevelWidgets();
|
||||||
|
for (auto w : widgets)
|
||||||
{
|
{
|
||||||
w->update();
|
w->update();
|
||||||
}
|
}
|
||||||
|
|
|
@ -209,7 +209,7 @@ void VMainGraphicsScene::InitOrigins()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VMainGraphicsScene::SetOriginsVisible(bool visible)
|
void VMainGraphicsScene::SetOriginsVisible(bool visible)
|
||||||
{
|
{
|
||||||
foreach (QGraphicsItem *item, origins)
|
for (auto item : qAsConst(origins))
|
||||||
{
|
{
|
||||||
item->setVisible(visible);
|
item->setVisible(visible);
|
||||||
}
|
}
|
||||||
|
@ -225,7 +225,8 @@ QPointF VMainGraphicsScene::getScenePos() const
|
||||||
QRectF VMainGraphicsScene::VisibleItemsBoundingRect() const
|
QRectF VMainGraphicsScene::VisibleItemsBoundingRect() const
|
||||||
{
|
{
|
||||||
QRectF rect;
|
QRectF rect;
|
||||||
foreach(QGraphicsItem *item, items())
|
const QList<QGraphicsItem *> qItems = items();
|
||||||
|
for (auto item : qItems)
|
||||||
{
|
{
|
||||||
if(not item->isVisible())
|
if(not item->isVisible())
|
||||||
{
|
{
|
||||||
|
|
|
@ -692,7 +692,8 @@ void VMainGraphicsView::NewSceneRect(QGraphicsScene *sc, QGraphicsView *view, QG
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QRectF rect = item->sceneBoundingRect();
|
QRectF rect = item->sceneBoundingRect();
|
||||||
foreach(QGraphicsItem *child, item->childItems())
|
const QList<QGraphicsItem *> children = item->childItems();
|
||||||
|
for (auto child : children)
|
||||||
{
|
{
|
||||||
if(child->isVisible())
|
if(child->isVisible())
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,16 +51,16 @@ int main(int argc, char** argv)
|
||||||
ASSERT_TEST(new TST_TSTranslation());
|
ASSERT_TEST(new TST_TSTranslation());
|
||||||
|
|
||||||
const QStringList locales = SupportedLocales();
|
const QStringList locales = SupportedLocales();
|
||||||
for(int l = 0, sz = locales.size(); l < sz; ++l)
|
for(auto &locale : locales)
|
||||||
{
|
{
|
||||||
for(quint32 s = 0; s < TST_MeasurementRegExp::systemCounts; ++s)
|
for(quint32 s = 0; s < TST_MeasurementRegExp::systemCounts; ++s)
|
||||||
{
|
{
|
||||||
ASSERT_TEST(new TST_MeasurementRegExp(s, locales.at(l)));
|
ASSERT_TEST(new TST_MeasurementRegExp(s, locale));
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_TEST(new TST_TSLocaleTranslation(locales.at(l)));
|
ASSERT_TEST(new TST_TSLocaleTranslation(locale));
|
||||||
ASSERT_TEST(new TST_BuitInRegExp(locales.at(l)));
|
ASSERT_TEST(new TST_BuitInRegExp(locale));
|
||||||
ASSERT_TEST(new TST_QmuParserErrorMsg(locales.at(l)));
|
ASSERT_TEST(new TST_QmuParserErrorMsg(locale));
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
|
|
|
@ -183,11 +183,11 @@ void TST_BuitInRegExp::TestCheckInternalVaribleRegExp_data()
|
||||||
QTest::addColumn<QString>("var");
|
QTest::addColumn<QString>("var");
|
||||||
QTest::addColumn<QString>("originalName");
|
QTest::addColumn<QString>("originalName");
|
||||||
|
|
||||||
foreach(const QString &var, builInVariables)
|
for (auto &var : qAsConst(builInVariables))
|
||||||
{
|
{
|
||||||
const QString tag = QString("Locale: '%1'. Var '%2'").arg(m_locale, var);
|
const QString tag = QString("Locale: '%1'. Var '%2'").arg(m_locale, var);
|
||||||
const QStringList originalNames = AllNames();
|
const QStringList originalNames = AllNames();
|
||||||
foreach(const QString &str, originalNames)
|
for (auto &str : originalNames)
|
||||||
{
|
{
|
||||||
QTest::newRow(qUtf8Printable(tag)) << var << str;
|
QTest::newRow(qUtf8Printable(tag)) << var << str;
|
||||||
}
|
}
|
||||||
|
@ -254,7 +254,7 @@ void TST_BuitInRegExp::PrepareData()
|
||||||
|
|
||||||
QTest::addColumn<QString>("originalName");
|
QTest::addColumn<QString>("originalName");
|
||||||
|
|
||||||
foreach(const QString &str, originalNames)
|
for (auto &str : originalNames)
|
||||||
{
|
{
|
||||||
const QString tag = QString("Locale: '%1'. Name '%2'").arg(m_locale, str);
|
const QString tag = QString("Locale: '%1'. Name '%2'").arg(m_locale, str);
|
||||||
QTest::newRow(qUtf8Printable(tag)) << str;
|
QTest::newRow(qUtf8Printable(tag)) << str;
|
||||||
|
|
|
@ -170,7 +170,7 @@ void TST_MeasurementRegExp::PrepareData()
|
||||||
|
|
||||||
QTest::addColumn<QString>("originalName");
|
QTest::addColumn<QString>("originalName");
|
||||||
|
|
||||||
foreach(const QString &str, originalNames)
|
for (auto &str : originalNames)
|
||||||
{
|
{
|
||||||
const QString tag = QString("System: '%1', locale: '%2'. Name '%3'").arg(m_system, m_locale, str);
|
const QString tag = QString("System: '%1', locale: '%2'. Name '%3'").arg(m_system, m_locale, str);
|
||||||
QTest::newRow(qUtf8Printable(tag)) << str;
|
QTest::newRow(qUtf8Printable(tag)) << str;
|
||||||
|
|
|
@ -169,7 +169,7 @@ void TST_NameRegExp::TestOriginalMeasurementNamesRegExp_data()
|
||||||
QTest::addColumn<QString>("str");
|
QTest::addColumn<QString>("str");
|
||||||
|
|
||||||
const QStringList originalNames = AllGroupNames();
|
const QStringList originalNames = AllGroupNames();
|
||||||
foreach(const QString &str, originalNames)
|
for (auto &str : originalNames)
|
||||||
{
|
{
|
||||||
const QString name = QString("Measurement '%1'").arg(str);
|
const QString name = QString("Measurement '%1'").arg(str);
|
||||||
QTest::newRow(qUtf8Printable(name)) << str;
|
QTest::newRow(qUtf8Printable(name)) << str;
|
||||||
|
|
|
@ -48,7 +48,7 @@ void TST_VCommandLine::UniqueKeys()
|
||||||
const QStringList options = AllKeys();
|
const QStringList options = AllKeys();
|
||||||
QSet<QString> unique;
|
QSet<QString> unique;
|
||||||
|
|
||||||
foreach(const QString &str, options)
|
for (auto &str : options)
|
||||||
{
|
{
|
||||||
const QString message = QString("Options '%1' is not unique!").arg(str);
|
const QString message = QString("Options '%1' is not unique!").arg(str);
|
||||||
QVERIFY2(not unique.contains(str), qUtf8Printable(message));
|
QVERIFY2(not unique.contains(str), qUtf8Printable(message));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user