mirror of
https://gitlab.com/smart-pattern/valentina.git
synced 2024-09-19 15:24:03 +02:00
Declare variables inside the loop.
This commit is contained in:
parent
21f3a5dc78
commit
c696ba0e1a
|
@ -2611,8 +2611,7 @@ void TMainWindow::ExportToIndividual()
|
|||
VMeasurements individualMeasurements(m_mUnit, tmpData.data());
|
||||
|
||||
const QMap<int, QSharedPointer<VMeasurement>> orderedTable = OrderedMeasurements();
|
||||
QMap<int, QSharedPointer<VMeasurement>>::const_iterator iMap;
|
||||
for (iMap = orderedTable.constBegin(); iMap != orderedTable.constEnd(); ++iMap)
|
||||
for (auto iMap = orderedTable.constBegin(); iMap != orderedTable.constEnd(); ++iMap)
|
||||
{
|
||||
const QSharedPointer<VMeasurement> &meash = iMap.value();
|
||||
individualMeasurements.AddEmpty(meash->GetName());
|
||||
|
@ -4680,8 +4679,7 @@ auto TMainWindow::OrderedMeasurements() const -> QMap<int, QSharedPointer<VMeasu
|
|||
{
|
||||
const QMap<QString, QSharedPointer<VMeasurement>> table = m_data->DataMeasurementsWithSeparators();
|
||||
QMap<int, QSharedPointer<VMeasurement>> orderedTable;
|
||||
QMap<QString, QSharedPointer<VMeasurement>>::const_iterator iterMap;
|
||||
for (iterMap = table.constBegin(); iterMap != table.constEnd(); ++iterMap)
|
||||
for (auto iterMap = table.constBegin(); iterMap != table.constEnd(); ++iterMap)
|
||||
{
|
||||
const QSharedPointer<VMeasurement> &meash = iterMap.value();
|
||||
orderedTable.insert(meash->Index(), meash);
|
||||
|
|
|
@ -1401,10 +1401,9 @@ void DialogIncrements::FillIncrementsTable(QTableWidget *table,
|
|||
table->blockSignals(true);
|
||||
table->clearContents();
|
||||
|
||||
QMap<QString, QSharedPointer<VIncrement>>::const_iterator i;
|
||||
QMap<quint32, QString> map;
|
||||
// Sorting QHash by id
|
||||
for (i = increments.constBegin(); i != increments.constEnd(); ++i)
|
||||
for (auto i = increments.constBegin(); i != increments.constEnd(); ++i)
|
||||
{
|
||||
const QSharedPointer<VIncrement> &incr = i.value();
|
||||
if (takePreviewCalculations == incr->IsPreviewCalculation())
|
||||
|
|
|
@ -1950,10 +1950,9 @@ void MainWindow::ExportToCSVData(const QString &fileName, bool withHeader, int m
|
|||
|
||||
auto SavePreviewCalculation = [¤tRow, &csv, increments](bool save)
|
||||
{
|
||||
QMap<QString, QSharedPointer<VIncrement>>::const_iterator i;
|
||||
QMap<quint32, QString> map;
|
||||
// Sorting QHash by id
|
||||
for (i = increments.constBegin(); i != increments.constEnd(); ++i)
|
||||
for (auto i = increments.constBegin(); i != increments.constEnd(); ++i)
|
||||
{
|
||||
const QSharedPointer<VIncrement> &incr = i.value();
|
||||
if (incr->IsPreviewCalculation() == save)
|
||||
|
|
|
@ -905,8 +905,7 @@ auto MainWindowsNoGUI::PrepareDetailsForLayout(const QVector<DetailForLayout> &d
|
|||
layoutDetails.reserve(details.size());
|
||||
const QFuture<VLayoutPiece> future = futureWatcher.future();
|
||||
|
||||
QFuture<VLayoutPiece>::const_iterator i;
|
||||
for (i = future.constBegin(); i != future.constEnd(); ++i)
|
||||
for (auto i = future.constBegin(); i != future.constEnd(); ++i)
|
||||
{
|
||||
layoutDetails.append(*i);
|
||||
}
|
||||
|
|
|
@ -1910,8 +1910,6 @@ void QmuParserBase::Eval(qreal *results, int nBulkSize) const
|
|||
{
|
||||
CreateRPN();
|
||||
|
||||
int i = 0;
|
||||
|
||||
#ifdef QMUP_USE_OPENMP
|
||||
// #define DEBUG_OMP_STUFF
|
||||
#ifdef DEBUG_OMP_STUFF
|
||||
|
@ -1924,7 +1922,7 @@ void QmuParserBase::Eval(qreal *results, int nBulkSize) const
|
|||
omp_set_num_threads(nMaxThreads);
|
||||
|
||||
#pragma omp parallel for schedule(static, nBulkSize / nMaxThreads) private(nThreadID)
|
||||
for (i = 0; i < nBulkSize; ++i)
|
||||
for (int i = 0; i < nBulkSize; ++i)
|
||||
{
|
||||
int nThreadID = omp_get_thread_num();
|
||||
results[i] = ParseCmdCodeBulk(i, nThreadID);
|
||||
|
@ -1953,7 +1951,7 @@ void QmuParserBase::Eval(qreal *results, int nBulkSize) const
|
|||
#endif
|
||||
|
||||
#else
|
||||
for (i = 0; i < nBulkSize; ++i)
|
||||
for (int i = 0; i < nBulkSize; ++i)
|
||||
{
|
||||
results[i] = ParseCmdCodeBulk(i, 0);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -234,8 +234,7 @@ auto DRW_Converter::toUtf8(const std::string &s) -> std::string
|
|||
{
|
||||
std::string result;
|
||||
unsigned int j = 0;
|
||||
unsigned int i = 0;
|
||||
for (i = 0; i < s.length(); i++)
|
||||
for (unsigned int i = 0; i < s.length(); i++)
|
||||
{
|
||||
auto c = static_cast<unsigned char>(s.at(i));
|
||||
if (c < 0x80)
|
||||
|
|
|
@ -620,10 +620,9 @@ template <class T> inline auto VAbstractPiece::CheckLoops(QVector<T> points) ->
|
|||
}
|
||||
|
||||
bool loopFound = false;
|
||||
qint32 i;
|
||||
const int maxLoops = 10000; // limit number of loops to be removed
|
||||
|
||||
for (i = 0; i < maxLoops; ++i)
|
||||
for (qint32 i = 0; i < maxLoops; ++i)
|
||||
{
|
||||
points = CheckLoop(points, loopFound);
|
||||
if (not loopFound)
|
||||
|
@ -646,8 +645,7 @@ template <class T> inline auto VAbstractPiece::CheckLoop(const QVector<T> &point
|
|||
QVector<T> ekvPoints;
|
||||
ekvPoints.reserve(points.size());
|
||||
|
||||
qint32 i;
|
||||
for (i = 0; i < points.size(); ++i)
|
||||
for (qint32 i = 0; i < points.size(); ++i)
|
||||
{
|
||||
/*Last three points no need to check.*/
|
||||
/*Triangle can not contain a loop*/
|
||||
|
|
|
@ -601,9 +601,8 @@ auto QxtCsvModel::toCSV(QIODevice *dest, QString &error, bool withHeader, QChar
|
|||
-> bool
|
||||
{
|
||||
const QxtCsvModelPrivate &d_ptr = qxt_d();
|
||||
int row, col, rows, cols;
|
||||
rows = rowCount();
|
||||
cols = columnCount();
|
||||
int rows = rowCount();
|
||||
int cols = columnCount();
|
||||
QString data;
|
||||
if (not dest->isOpen() && not dest->open(QIODevice::WriteOnly | QIODevice::Truncate))
|
||||
{
|
||||
|
@ -624,7 +623,7 @@ auto QxtCsvModel::toCSV(QIODevice *dest, QString &error, bool withHeader, QChar
|
|||
if (withHeader)
|
||||
{
|
||||
data = QString();
|
||||
for (col = 0; col < cols; ++col)
|
||||
for (int col = 0; col < cols; ++col)
|
||||
{
|
||||
if (col > 0)
|
||||
{
|
||||
|
@ -634,11 +633,11 @@ auto QxtCsvModel::toCSV(QIODevice *dest, QString &error, bool withHeader, QChar
|
|||
}
|
||||
stream << data << Qt::endl;
|
||||
}
|
||||
for (row = 0; row < rows; ++row)
|
||||
for (int row = 0; row < rows; ++row)
|
||||
{
|
||||
const QStringList &rowData = d_ptr.csvData[row];
|
||||
data = QString();
|
||||
for (col = 0; col < cols; ++col)
|
||||
for (int col = 0; col < cols; ++col)
|
||||
{
|
||||
if (col > 0)
|
||||
{
|
||||
|
|
|
@ -163,7 +163,6 @@ void PathArc(QPainterPath &path, qreal rx, qreal ry, qreal x_axis_rotation, int
|
|||
qreal x0, y0, x1, y1, xc, yc;
|
||||
qreal d, sfactor, sfactor_sq;
|
||||
qreal th0, th1, th_arc;
|
||||
int i, n_segs;
|
||||
qreal dx, dy, dx1, dy1, Px, Py, check;
|
||||
rx = qAbs(rx);
|
||||
ry = qAbs(ry);
|
||||
|
@ -223,8 +222,8 @@ void PathArc(QPainterPath &path, qreal rx, qreal ry, qreal x_axis_rotation, int
|
|||
{
|
||||
th_arc -= 2 * V_PI;
|
||||
}
|
||||
n_segs = qCeil(qAbs(th_arc / (V_PI * 0.5 + 0.001)));
|
||||
for (i = 0; i < n_segs; i++)
|
||||
int n_segs = qCeil(qAbs(th_arc / (V_PI * 0.5 + 0.001)));
|
||||
for (int i = 0; i < n_segs; i++)
|
||||
{
|
||||
PathArcSegment(path, xc, yc, th0 + i * th_arc / n_segs, th0 + (i + 1) * th_arc / n_segs, rx, ry,
|
||||
x_axis_rotation);
|
||||
|
|
|
@ -178,14 +178,13 @@ static void halfedge_free(halfedge_t *d)
|
|||
void del_free_halfedges(delaunay_t *del);
|
||||
void del_free_halfedges(delaunay_t *del)
|
||||
{
|
||||
quint32 i;
|
||||
halfedge_t *d, *sig;
|
||||
|
||||
/* if there is nothing to do */
|
||||
if (del->points == nullptr)
|
||||
return;
|
||||
|
||||
for (i = 0; i <= (del->end_point - del->start_point); i++)
|
||||
for (quint32 i = 0; i <= (del->end_point - del->start_point); i++)
|
||||
{
|
||||
/* free all the halfedges around the point */
|
||||
d = del->points[i]->he;
|
||||
|
@ -985,7 +984,6 @@ static void build_halfedge_face(delaunay_t *del, halfedge_t *d)
|
|||
void del_build_faces(delaunay_t *del);
|
||||
void del_build_faces(delaunay_t *del)
|
||||
{
|
||||
quint32 i;
|
||||
halfedge_t *curr;
|
||||
|
||||
del->num_faces = 0;
|
||||
|
@ -994,7 +992,7 @@ void del_build_faces(delaunay_t *del)
|
|||
/* build external face first */
|
||||
build_halfedge_face(del, del->rightmost_he->pair);
|
||||
|
||||
for (i = del->start_point; i <= del->end_point; i++)
|
||||
for (quint32 i = del->start_point; i <= del->end_point; i++)
|
||||
{
|
||||
curr = del->points[i]->he;
|
||||
|
||||
|
|
|
@ -446,7 +446,6 @@ auto scale_expansion_zeroelim(int elen, qreal *e, qreal b, qreal *h) -> int /* e
|
|||
qreal hh;
|
||||
INEXACT qreal product1;
|
||||
qreal product0;
|
||||
int eindex, hindex;
|
||||
qreal enow;
|
||||
INEXACT qreal bvirt;
|
||||
qreal avirt, bround, around;
|
||||
|
@ -457,12 +456,12 @@ auto scale_expansion_zeroelim(int elen, qreal *e, qreal b, qreal *h) -> int /* e
|
|||
|
||||
Split(b, bhi, blo);
|
||||
Two_Product_Presplit(e[0], b, bhi, blo, Q, hh);
|
||||
hindex = 0;
|
||||
int hindex = 0;
|
||||
if (hh != 0)
|
||||
{
|
||||
h[hindex++] = hh;
|
||||
}
|
||||
for (eindex = 1; eindex < elen; eindex++)
|
||||
for (int eindex = 1; eindex < elen; eindex++)
|
||||
{
|
||||
enow = e[eindex];
|
||||
Two_Product_Presplit(enow, b, bhi, blo, product1, product0);
|
||||
|
@ -495,10 +494,9 @@ auto scale_expansion_zeroelim(int elen, qreal *e, qreal b, qreal *h) -> int /* e
|
|||
auto estimate(int elen, qreal *e) -> qreal
|
||||
{
|
||||
qreal Q;
|
||||
int eindex;
|
||||
|
||||
Q = e[0];
|
||||
for (eindex = 1; eindex < elen; eindex++)
|
||||
for (int eindex = 1; eindex < elen; eindex++)
|
||||
{
|
||||
Q += e[eindex];
|
||||
}
|
||||
|
|
|
@ -428,8 +428,7 @@ void VContainer::ClearVariables(const QVector<VarType> &types)
|
|||
}
|
||||
else
|
||||
{
|
||||
QHash<QString, QSharedPointer<VInternalVariable>>::iterator i;
|
||||
for (i = d->variables.begin(); i != d->variables.end();)
|
||||
for (auto i = d->variables.begin(); i != d->variables.end();)
|
||||
{
|
||||
if (types.contains(i.value()->GetType()))
|
||||
{
|
||||
|
@ -712,8 +711,7 @@ template <typename T> auto VContainer::DataVar(const VarType &type) const -> QMa
|
|||
{
|
||||
QMap<QString, QSharedPointer<T>> map;
|
||||
// Sorting QHash by id
|
||||
QHash<QString, QSharedPointer<VInternalVariable>>::const_iterator i;
|
||||
for (i = d->variables.constBegin(); i != d->variables.constEnd(); ++i)
|
||||
for (auto i = d->variables.constBegin(); i != d->variables.constEnd(); ++i)
|
||||
{
|
||||
if (i.value()->GetType() == type)
|
||||
{
|
||||
|
|
|
@ -27,14 +27,14 @@
|
|||
|
||||
#include "../vproperty_p.h"
|
||||
|
||||
VPE::VObjectProperty::VObjectProperty(const QString& name)
|
||||
: VProperty(name,
|
||||
VPE::VObjectProperty::VObjectProperty(const QString &name)
|
||||
: VProperty(name,
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QMetaType::UInt),
|
||||
QMetaType::UInt),
|
||||
#else
|
||||
QVariant::UInt),
|
||||
QVariant::UInt),
|
||||
#endif
|
||||
objects()
|
||||
objects()
|
||||
{
|
||||
VProperty::d_ptr->VariantValue = 0;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
|
@ -58,7 +58,7 @@ auto VPE::VObjectProperty::data(int column, int role) const -> QVariant
|
|||
{
|
||||
return VProperty::d_ptr->VariantValue;
|
||||
}
|
||||
|
||||
|
||||
if (column == DPC_Data && Qt::EditRole == role)
|
||||
{
|
||||
return tmpEditor->currentIndex();
|
||||
|
@ -78,7 +78,7 @@ auto VPE::VObjectProperty::createEditor(QWidget *parent, const QStyleOptionViewI
|
|||
FillList(tmpEditor, objects);
|
||||
tmpEditor->setCurrentIndex(tmpEditor->findData(VProperty::d_ptr->VariantValue.toUInt()));
|
||||
connect(tmpEditor, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&VObjectProperty::currentIndexChanged);
|
||||
&VObjectProperty::currentIndexChanged);
|
||||
|
||||
VProperty::d_ptr->editor = tmpEditor;
|
||||
return VProperty::d_ptr->editor;
|
||||
|
@ -137,7 +137,7 @@ auto VPE::VObjectProperty::getObjects() const -> QMap<QString, quint32>
|
|||
}
|
||||
|
||||
//! Sets the value of the property
|
||||
void VPE::VObjectProperty::setValue(const QVariant& value)
|
||||
void VPE::VObjectProperty::setValue(const QVariant &value)
|
||||
{
|
||||
VProperty::d_ptr->VariantValue = value;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
|
@ -166,15 +166,14 @@ void VPE::VObjectProperty::currentIndexChanged(int index)
|
|||
{
|
||||
Q_UNUSED(index)
|
||||
auto *event = new UserChangeEvent();
|
||||
QCoreApplication::postEvent ( VProperty::d_ptr->editor, event );
|
||||
QCoreApplication::postEvent(VProperty::d_ptr->editor, event);
|
||||
}
|
||||
|
||||
void VPE::VObjectProperty::FillList(QComboBox *box, const QMap<QString, quint32> &list) const
|
||||
{
|
||||
box->clear();
|
||||
|
||||
QMap<QString, quint32>::const_iterator i;
|
||||
for (i = list.constBegin(); i != list.constEnd(); ++i)
|
||||
for (auto i = list.constBegin(); i != list.constEnd(); ++i)
|
||||
{
|
||||
box->addItem(i.key(), i.value());
|
||||
}
|
||||
|
|
|
@ -203,9 +203,8 @@ void DialogTool::FillComboBoxSplines(QComboBox *box) const
|
|||
box->blockSignals(true);
|
||||
|
||||
const auto *const objs = data->CalculationGObjects();
|
||||
QHash<quint32, QSharedPointer<VGObject>>::const_iterator i;
|
||||
QMap<QString, quint32> list;
|
||||
for (i = objs->constBegin(); i != objs->constEnd(); ++i)
|
||||
for (auto i = objs->constBegin(); i != objs->constEnd(); ++i)
|
||||
{
|
||||
if (i.key() != toolId && IsSpline(i.value()))
|
||||
{
|
||||
|
@ -224,9 +223,8 @@ void DialogTool::FillComboBoxSplinesPath(QComboBox *box) const
|
|||
box->blockSignals(true);
|
||||
|
||||
const auto *const objs = data->CalculationGObjects();
|
||||
QHash<quint32, QSharedPointer<VGObject>>::const_iterator i;
|
||||
QMap<QString, quint32> list;
|
||||
for (i = objs->constBegin(); i != objs->constEnd(); ++i)
|
||||
for (auto i = objs->constBegin(); i != objs->constEnd(); ++i)
|
||||
{
|
||||
if (i.key() != toolId && IsSplinePath(i.value()))
|
||||
{
|
||||
|
@ -244,8 +242,7 @@ void DialogTool::FillComboBoxCurves(QComboBox *box) const
|
|||
SCASSERT(box != nullptr)
|
||||
const auto *const objs = data->CalculationGObjects();
|
||||
QMap<QString, quint32> list;
|
||||
QHash<quint32, QSharedPointer<VGObject>>::const_iterator i;
|
||||
for (i = objs->constBegin(); i != objs->constEnd(); ++i)
|
||||
for (auto i = objs->constBegin(); i != objs->constEnd(); ++i)
|
||||
{
|
||||
if (i.key() != toolId)
|
||||
{
|
||||
|
@ -780,9 +777,8 @@ void DialogTool::FillCombo(QComboBox *box, GOType gType, FillComboBox rule, cons
|
|||
box->blockSignals(true);
|
||||
|
||||
const QHash<quint32, QSharedPointer<VGObject>> *objs = data->CalculationGObjects();
|
||||
QHash<quint32, QSharedPointer<VGObject>>::const_iterator i;
|
||||
QMap<QString, quint32> list;
|
||||
for (i = objs->constBegin(); i != objs->constEnd(); ++i)
|
||||
for (auto i = objs->constBegin(); i != objs->constEnd(); ++i)
|
||||
{
|
||||
if (rule == FillComboBox::NoChildren)
|
||||
{
|
||||
|
|
|
@ -331,8 +331,7 @@ auto VAbstractTool::PointsList() const -> QMap<QString, quint32>
|
|||
{
|
||||
const QHash<quint32, QSharedPointer<VGObject>> *objs = data.CalculationGObjects();
|
||||
QMap<QString, quint32> list;
|
||||
QHash<quint32, QSharedPointer<VGObject>>::const_iterator i;
|
||||
for (i = objs->constBegin(); i != objs->constEnd(); ++i)
|
||||
for (auto i = objs->constBegin(); i != objs->constEnd(); ++i)
|
||||
{
|
||||
if (i.key() != m_id)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue