Refactoring. Use C++11 range-based loop.
--HG-- branch : develop
This commit is contained in:
parent
6b6a2632a9
commit
0e3a9533af
|
@ -438,9 +438,9 @@ void DialogMDataBase::InitGroup(QTreeWidgetItem **group, const QString &groupNam
|
|||
const QStringList &list)
|
||||
{
|
||||
*group = AddGroup(groupName);
|
||||
for (int i=0; i < mList.size(); ++i)
|
||||
for (auto &m : mList)
|
||||
{
|
||||
AddMeasurement(*group, mList.at(i), list);
|
||||
AddMeasurement(*group, m, list);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -252,11 +252,7 @@ MApplication::MApplication(int &argc, char **argv)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
MApplication::~MApplication()
|
||||
{
|
||||
for (int i = 0; i < mainWindows.size(); ++i)
|
||||
{
|
||||
TMainWindow *window = mainWindows.at(i);
|
||||
delete window;
|
||||
}
|
||||
qDeleteAll(mainWindows);
|
||||
|
||||
delete trVars;
|
||||
if (not dataBase.isNull())
|
||||
|
@ -368,9 +364,9 @@ QList<TMainWindow *> MApplication::MainWindows()
|
|||
{
|
||||
Clean();
|
||||
QList<TMainWindow*> list;
|
||||
for (int i = 0; i < mainWindows.count(); ++i)
|
||||
for (auto &w : mainWindows)
|
||||
{
|
||||
list.append(mainWindows.at(i));
|
||||
list.append(w);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
@ -536,10 +532,10 @@ void MApplication::RetranslateGroups()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void MApplication::RetranslateTables()
|
||||
{
|
||||
QList<TMainWindow*> list = MainWindows();
|
||||
for (int i=0; i < list.size(); ++i)
|
||||
const QList<TMainWindow*> list = MainWindows();
|
||||
for (auto w : list)
|
||||
{
|
||||
list.at(i)->RetranslateTable();
|
||||
w->RetranslateTable();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -689,10 +685,10 @@ void MApplication::ParseCommandLine(const SocketConnection &connection, const QS
|
|||
parser.showHelp(V_EX_USAGE);
|
||||
}
|
||||
|
||||
for (int i = 0; i < args.size(); ++i)
|
||||
for (auto &arg : args)
|
||||
{
|
||||
NewMainWindow();
|
||||
if (not MainWindow()->LoadFile(args.at(i)))
|
||||
if (not MainWindow()->LoadFile(arg))
|
||||
{
|
||||
if (testMode)
|
||||
{
|
||||
|
|
|
@ -226,12 +226,12 @@ bool TMainWindow::LoadFile(const QString &path)
|
|||
}
|
||||
|
||||
// Check if file already opened
|
||||
QList<TMainWindow*>list = qApp->MainWindows();
|
||||
for (int i = 0; i < list.size(); ++i)
|
||||
const QList<TMainWindow*> list = qApp->MainWindows();
|
||||
for (auto w : list)
|
||||
{
|
||||
if (list.at(i)->CurrentFile() == path)
|
||||
if (w->CurrentFile() == path)
|
||||
{
|
||||
list.at(i)->activateWindow();
|
||||
w->activateWindow();
|
||||
close();
|
||||
return false;
|
||||
}
|
||||
|
@ -1347,15 +1347,15 @@ void TMainWindow::AddKnown()
|
|||
if (ui->tableWidget->currentRow() == -1)
|
||||
{
|
||||
currentRow = ui->tableWidget->rowCount() + list.size() - 1;
|
||||
for (int i = 0; i < list.size(); ++i)
|
||||
for (auto &name : list)
|
||||
{
|
||||
if (mType == MeasurementsType::Individual)
|
||||
{
|
||||
m->AddEmpty(list.at(i), qApp->TrVars()->MFormula(list.at(i)));
|
||||
m->AddEmpty(name, qApp->TrVars()->MFormula(name));
|
||||
}
|
||||
else
|
||||
{
|
||||
m->AddEmpty(list.at(i));
|
||||
m->AddEmpty(name);
|
||||
}
|
||||
|
||||
search->AddRow(currentRow);
|
||||
|
@ -1366,18 +1366,18 @@ void TMainWindow::AddKnown()
|
|||
currentRow = ui->tableWidget->currentRow() + list.size();
|
||||
const QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName);
|
||||
QString after = nameField->data(Qt::UserRole).toString();
|
||||
for (int i = 0; i < list.size(); ++i)
|
||||
for (auto &name : list)
|
||||
{
|
||||
if (mType == MeasurementsType::Individual)
|
||||
{
|
||||
m->AddEmptyAfter(after, list.at(i), qApp->TrVars()->MFormula(list.at(i)));
|
||||
m->AddEmptyAfter(after, name, qApp->TrVars()->MFormula(name));
|
||||
}
|
||||
else
|
||||
{
|
||||
m->AddEmptyAfter(after, list.at(i));
|
||||
m->AddEmptyAfter(after, name);
|
||||
}
|
||||
search->AddRow(currentRow);
|
||||
after = list.at(i);
|
||||
after = name;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1441,9 +1441,9 @@ void TMainWindow::ImportFromPattern()
|
|||
if (ui->tableWidget->currentRow() == -1)
|
||||
{
|
||||
currentRow = ui->tableWidget->rowCount() + measurements.size() - 1;
|
||||
for (int i = 0; i < measurements.size(); ++i)
|
||||
for (auto &mName : measurements)
|
||||
{
|
||||
m->AddEmpty(measurements.at(i));
|
||||
m->AddEmpty(mName);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1451,10 +1451,10 @@ void TMainWindow::ImportFromPattern()
|
|||
currentRow = ui->tableWidget->currentRow() + measurements.size();
|
||||
const QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName);
|
||||
QString after = nameField->data(Qt::UserRole).toString();
|
||||
for (int i = 0; i < measurements.size(); ++i)
|
||||
for (auto &mName : measurements)
|
||||
{
|
||||
m->AddEmptyAfter(after, measurements.at(i));
|
||||
after = measurements.at(i);
|
||||
m->AddEmptyAfter(after, mName);
|
||||
after = mName;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2836,12 +2836,12 @@ bool TMainWindow::LoadFromExistingFile(const QString &path)
|
|||
}
|
||||
|
||||
// Check if file already opened
|
||||
QList<TMainWindow*>list = qApp->MainWindows();
|
||||
for (int i = 0; i < list.size(); ++i)
|
||||
const QList<TMainWindow*> list = qApp->MainWindows();
|
||||
for (auto w : list)
|
||||
{
|
||||
if (list.at(i)->CurrentFile() == path)
|
||||
if (w->CurrentFile() == path)
|
||||
{
|
||||
list.at(i)->activateWindow();
|
||||
w->activateWindow();
|
||||
close();
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -513,9 +513,8 @@ void VApplication::ClearOldLogs() const
|
|||
if (allFiles.isEmpty() == false)
|
||||
{
|
||||
qCDebug(vApp, "Clearing old logs");
|
||||
for (int i = 0, sz = allFiles.size(); i < sz; ++i)
|
||||
for (auto &fn : allFiles)
|
||||
{
|
||||
auto fn = allFiles.at(i);
|
||||
QFileInfo info(fn);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
const QDateTime created = info.birthTime();
|
||||
|
|
|
@ -765,9 +765,9 @@ void VToolOptionsPropertyBrowser::SetOperationSuffix(const QString &suffix)
|
|||
|
||||
QRegularExpression rx(NameRegExp());
|
||||
const QStringList uniqueNames = VContainer::AllUniqueNames();
|
||||
for (int i=0; i < uniqueNames.size(); ++i)
|
||||
for (auto &uniqueName : uniqueNames)
|
||||
{
|
||||
const QString name = uniqueNames.at(i) + suffix;
|
||||
const QString name = uniqueName + suffix;
|
||||
if (not rx.match(name).hasMatch() || not VContainer::IsUnique(name))
|
||||
{
|
||||
idToProperty[AttrSuffix]->setValue(item->Suffix());
|
||||
|
|
|
@ -179,10 +179,9 @@ void PreferencesConfigurationPage::changeEvent(QEvent *event)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void PreferencesConfigurationPage::SetLabelComboBox(const QStringList &list)
|
||||
{
|
||||
for (int i = 0; i < list.size(); ++i)
|
||||
for (auto &name : list)
|
||||
{
|
||||
QLocale loc = QLocale(list.at(i));
|
||||
ui->labelCombo->addItem(loc.nativeLanguageName(), list.at(i));
|
||||
ui->labelCombo->addItem(QLocale(name).nativeLanguageName(), name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -165,14 +165,14 @@ void DialogDateTimeFormats::SetFormatLines(const QStringList &predefined, const
|
|||
|
||||
int row = -1;
|
||||
|
||||
for (int i=0; i<predefined.size(); ++i)
|
||||
for (auto &item : predefined)
|
||||
{
|
||||
ui->listWidget->insertItem(++row, AddListLine(predefined.at(i)));
|
||||
ui->listWidget->insertItem(++row, AddListLine(item));
|
||||
}
|
||||
|
||||
for (int i=0; i<userDefined.size(); ++i)
|
||||
for (auto &item : userDefined)
|
||||
{
|
||||
ui->listWidget->insertItem(++row, AddListLine(userDefined.at(i)));
|
||||
ui->listWidget->insertItem(++row, AddListLine(item));
|
||||
}
|
||||
|
||||
ui->listWidget->blockSignals(false);
|
||||
|
|
|
@ -727,9 +727,9 @@ void DialogIncrements::RefreshPattern()
|
|||
if (hasChanges)
|
||||
{
|
||||
QVector<VFormulaField> expressions = doc->ListExpressions();
|
||||
for (int i = 0; i < renameList.size(); ++i)
|
||||
for (auto &item : renameList)
|
||||
{
|
||||
doc->ReplaceNameInFormula(expressions, renameList.at(i).first, renameList.at(i).second);
|
||||
doc->ReplaceNameInFormula(expressions, item.first, item.second);
|
||||
}
|
||||
renameList.clear();
|
||||
|
||||
|
|
|
@ -62,12 +62,11 @@ void DialogKnownMaterials::SetList(const QStringList &list)
|
|||
|
||||
int row = -1;
|
||||
|
||||
for (int i=0; i<list.size(); ++i)
|
||||
for (auto &m : list)
|
||||
{
|
||||
if (not list.at(i).isEmpty())
|
||||
if (not m.isEmpty())
|
||||
{
|
||||
QListWidgetItem *item = new QListWidgetItem(list.at(i));
|
||||
ui->listWidget->insertItem(++row, item);
|
||||
ui->listWidget->insertItem(++row, new QListWidgetItem(m));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4624,29 +4624,29 @@ QStringList MainWindow::GetUnlokedRestoreFileList() const
|
|||
QStringList files = qApp->ValentinaSettings()->GetRestoreFileList();
|
||||
if (files.size() > 0)
|
||||
{
|
||||
for (int i = 0; i < files.size(); ++i)
|
||||
for (auto &file : files)
|
||||
{
|
||||
// Seeking file that realy need reopen
|
||||
VLockGuard<char> tmp(files.at(i));
|
||||
VLockGuard<char> tmp(file);
|
||||
if (tmp.IsLocked())
|
||||
{
|
||||
restoreFiles.append(files.at(i));
|
||||
restoreFiles.append(file);
|
||||
}
|
||||
}
|
||||
|
||||
// Clearing list after filtering
|
||||
for (int i = 0; i < restoreFiles.size(); ++i)
|
||||
for (auto &file : restoreFiles)
|
||||
{
|
||||
files.removeAll(restoreFiles.at(i));
|
||||
files.removeAll(file);
|
||||
}
|
||||
|
||||
// Clear all files that do not exist.
|
||||
QStringList filtered;
|
||||
for (int i = 0; i < files.size(); ++i)
|
||||
for (auto &file : files)
|
||||
{
|
||||
if (QFileInfo::exists(files.at(i)))
|
||||
if (QFileInfo::exists(file))
|
||||
{
|
||||
filtered.append(files.at(i));
|
||||
filtered.append(file);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4852,21 +4852,21 @@ void MainWindow::ReopenFilesAfterCrash(QStringList &args)
|
|||
{
|
||||
qCDebug(vMainWindow, "User said Yes.");
|
||||
|
||||
for (int i = 0; i < restoreFiles.size(); ++i)
|
||||
for (auto &file : restoreFiles)
|
||||
{
|
||||
QString error;
|
||||
if (VDomDocument::SafeCopy(restoreFiles.at(i) + *autosavePrefix, restoreFiles.at(i), error))
|
||||
if (VDomDocument::SafeCopy(file + *autosavePrefix, file, error))
|
||||
{
|
||||
QFile autoFile(restoreFiles.at(i) + *autosavePrefix);
|
||||
QFile autoFile(file + *autosavePrefix);
|
||||
autoFile.remove();
|
||||
LoadPattern(restoreFiles.at(i));
|
||||
args.removeAll(restoreFiles.at(i));// Do not open file twice after we restore him.
|
||||
LoadPattern(file);
|
||||
args.removeAll(file);// Do not open file twice after we restore him.
|
||||
}
|
||||
else
|
||||
{
|
||||
qCDebug(vMainWindow, "Could not copy %s%s to %s %s",
|
||||
qUtf8Printable(restoreFiles.at(i)), qUtf8Printable(*autosavePrefix),
|
||||
qUtf8Printable(restoreFiles.at(i)), qUtf8Printable(error));
|
||||
qUtf8Printable(file), qUtf8Printable(*autosavePrefix),
|
||||
qUtf8Printable(file), qUtf8Printable(error));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5369,9 +5369,9 @@ void MainWindow::ProcessCMD()
|
|||
{
|
||||
ReopenFilesAfterCrash(args);
|
||||
|
||||
for (int i=0, sz = args.size(); i < sz; ++i)
|
||||
for (auto &arg : args)
|
||||
{
|
||||
LoadPattern(args.at(i));
|
||||
LoadPattern(arg);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -372,9 +372,8 @@ void MainWindowsNoGUI::ExportDetailsAsFlatLayout(const QVector<VLayoutPiece> &li
|
|||
QScopedPointer<QGraphicsScene> scene(new QGraphicsScene());
|
||||
|
||||
QList<QGraphicsItem *> list;
|
||||
for (int i=0; i < listDetails.count(); ++i)
|
||||
for (auto piece : listDetails)
|
||||
{
|
||||
VLayoutPiece piece = listDetails.at(i);
|
||||
QGraphicsItem *item = piece.GetItem(m_dialogSaveLayout->IsTextAsPaths());
|
||||
qreal diff = 0;
|
||||
if (piece.IsForceFlipping())
|
||||
|
@ -396,9 +395,9 @@ void MainWindowsNoGUI::ExportDetailsAsFlatLayout(const QVector<VLayoutPiece> &li
|
|||
list.append(item);
|
||||
}
|
||||
|
||||
for (int i=0; i < list.size(); ++i)
|
||||
for (auto item : list)
|
||||
{
|
||||
scene->addItem(list.at(i));
|
||||
scene->addItem(item);
|
||||
}
|
||||
|
||||
QList<QGraphicsItem *> papers;// Blank sheets
|
||||
|
@ -410,9 +409,9 @@ void MainWindowsNoGUI::ExportDetailsAsFlatLayout(const QVector<VLayoutPiece> &li
|
|||
QTransform matrix;
|
||||
matrix = matrix.translate(-mx, -my);
|
||||
|
||||
for (int i=0; i < list.size(); ++i)
|
||||
for (auto item : list)
|
||||
{
|
||||
list.at(i)->setTransform(matrix);
|
||||
item->setTransform(matrix);
|
||||
}
|
||||
|
||||
rect = scene->itemsBoundingRect().toRect();
|
||||
|
@ -537,9 +536,9 @@ void MainWindowsNoGUI::ExportDetailsAsApparelLayout(QVector<VLayoutPiece> listDe
|
|||
list.append(item);
|
||||
}
|
||||
|
||||
for (int i=0; i < list.size(); ++i)
|
||||
for (auto item : list)
|
||||
{
|
||||
scene->addItem(list.at(i));
|
||||
scene->addItem(item);
|
||||
}
|
||||
|
||||
QRect rect = scene->itemsBoundingRect().toRect();
|
||||
|
@ -550,9 +549,9 @@ void MainWindowsNoGUI::ExportDetailsAsApparelLayout(QVector<VLayoutPiece> listDe
|
|||
QTransform matrix;
|
||||
matrix = matrix.translate(-mx, -my);
|
||||
|
||||
for (int i=0; i < list.size(); ++i)
|
||||
for (auto item : list)
|
||||
{
|
||||
list.at(i)->setTransform(matrix);
|
||||
item->setTransform(matrix);
|
||||
}
|
||||
|
||||
rect = scene->itemsBoundingRect().toRect();
|
||||
|
@ -853,11 +852,10 @@ QList<QGraphicsItem *> MainWindowsNoGUI::CreateShadows(const QList<QGraphicsItem
|
|||
{
|
||||
QList<QGraphicsItem *> shadows;
|
||||
|
||||
for (int i=0; i< papers.size(); ++i)
|
||||
for (auto paper : papers)
|
||||
{
|
||||
qreal x1=0, y1=0, x2=0, y2=0;
|
||||
QGraphicsRectItem *item = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
||||
if (item)
|
||||
if (QGraphicsRectItem *item = qgraphicsitem_cast<QGraphicsRectItem *>(paper))
|
||||
{
|
||||
item->rect().getCoords(&x1, &y1, &x2, &y2);
|
||||
QGraphicsRectItem *shadowPaper = new QGraphicsRectItem(QRectF(x1+4, y1+4, x2+4, y2+4));
|
||||
|
@ -886,10 +884,10 @@ QList<QGraphicsScene *> MainWindowsNoGUI::CreateScenes(const QList<QGraphicsItem
|
|||
scene->addItem(shadows.at(i));
|
||||
scene->addItem(papers.at(i));
|
||||
|
||||
QList<QGraphicsItem *> paperDetails = details.at(i);
|
||||
for (int i=0; i < paperDetails.size(); ++i)
|
||||
const QList<QGraphicsItem *> paperDetails = details.at(i);
|
||||
for (auto &detail : paperDetails)
|
||||
{
|
||||
scene->addItem(paperDetails.at(i));
|
||||
scene->addItem(detail);
|
||||
}
|
||||
|
||||
scenes.append(scene);
|
||||
|
@ -1182,18 +1180,16 @@ void MainWindowsNoGUI::RestorePaper(int index) const
|
|||
void MainWindowsNoGUI::PrepareTextForDXF(const QString &placeholder,
|
||||
const QList<QList<QGraphicsItem *> > &details) const
|
||||
{
|
||||
for (int i = 0; i < details.size(); ++i)
|
||||
for (auto &paperItems : details)
|
||||
{
|
||||
const QList<QGraphicsItem *> &paperItems = details.at(i);
|
||||
for (int j = 0; j < paperItems.size(); ++j)
|
||||
for (auto item : paperItems)
|
||||
{
|
||||
QList<QGraphicsItem *> pieceChildren = paperItems.at(j)->childItems();
|
||||
for (int k = 0; k < pieceChildren.size(); ++k)
|
||||
QList<QGraphicsItem *> pieceChildren = item->childItems();
|
||||
for (auto child : pieceChildren)
|
||||
{
|
||||
QGraphicsItem *item = pieceChildren.at(k);
|
||||
if (item->type() == QGraphicsSimpleTextItem::Type)
|
||||
if (child->type() == QGraphicsSimpleTextItem::Type)
|
||||
{
|
||||
if(QGraphicsSimpleTextItem *textItem = qgraphicsitem_cast<QGraphicsSimpleTextItem *>(item))
|
||||
if(QGraphicsSimpleTextItem *textItem = qgraphicsitem_cast<QGraphicsSimpleTextItem *>(child))
|
||||
{
|
||||
textItem->setText(textItem->text() + placeholder);
|
||||
}
|
||||
|
@ -1215,18 +1211,16 @@ void MainWindowsNoGUI::PrepareTextForDXF(const QString &placeholder,
|
|||
void MainWindowsNoGUI::RestoreTextAfterDXF(const QString &placeholder,
|
||||
const QList<QList<QGraphicsItem *> > &details) const
|
||||
{
|
||||
for (int i = 0; i < details.size(); ++i)
|
||||
for (auto &paperItems : details)
|
||||
{
|
||||
const QList<QGraphicsItem *> &paperItems = details.at(i);
|
||||
for (int j = 0; j < paperItems.size(); ++j)
|
||||
for (auto item : paperItems)
|
||||
{
|
||||
QList<QGraphicsItem *> pieceChildren = paperItems.at(i)->childItems();
|
||||
for (int k = 0; k < pieceChildren.size(); ++k)
|
||||
QList<QGraphicsItem *> pieceChildren = item->childItems();
|
||||
for (auto child : pieceChildren)
|
||||
{
|
||||
QGraphicsItem *item = pieceChildren.at(k);
|
||||
if (item->type() == QGraphicsSimpleTextItem::Type)
|
||||
if (child->type() == QGraphicsSimpleTextItem::Type)
|
||||
{
|
||||
if(QGraphicsSimpleTextItem *textItem = qgraphicsitem_cast<QGraphicsSimpleTextItem *>(item))
|
||||
if(QGraphicsSimpleTextItem *textItem = qgraphicsitem_cast<QGraphicsSimpleTextItem *>(child))
|
||||
{
|
||||
QString text = textItem->text();
|
||||
text.replace(placeholder, QString());
|
||||
|
@ -1432,8 +1426,7 @@ bool MainWindowsNoGUI::IsLayoutGrayscale() const
|
|||
|
||||
for (int i=0; i < scenes.size(); ++i)
|
||||
{
|
||||
auto *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
||||
if (paper)
|
||||
if (auto *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i)))
|
||||
{
|
||||
// Hide shadow and paper border
|
||||
PreparePaper(i);
|
||||
|
@ -1513,9 +1506,9 @@ bool MainWindowsNoGUI::isPagesUniform() const
|
|||
{
|
||||
auto *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(0));
|
||||
SCASSERT(paper != nullptr)
|
||||
for (int i=1; i < papers.size(); ++i)
|
||||
for (auto paperItem : papers)
|
||||
{
|
||||
auto *p = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
||||
auto *p = qgraphicsitem_cast<QGraphicsRectItem *>(paperItem);
|
||||
SCASSERT(p != nullptr)
|
||||
if (paper->rect() != p->rect())
|
||||
{
|
||||
|
|
|
@ -209,9 +209,9 @@ QMap<QString, QIcon> LineStylesPics()
|
|||
QMap<QString, QIcon> map;
|
||||
const QStringList styles = StylesList();
|
||||
|
||||
for (int i=0; i < styles.size(); ++i)
|
||||
for (auto &s : styles)
|
||||
{
|
||||
const Qt::PenStyle style = LineStyleToPenStyle(styles.at(i));
|
||||
const Qt::PenStyle style = LineStyleToPenStyle(s);
|
||||
QPixmap pix(80, 14);
|
||||
pix.fill(Qt::white);
|
||||
|
||||
|
@ -222,7 +222,7 @@ QMap<QString, QIcon> LineStylesPics()
|
|||
painter.setPen(pen);
|
||||
painter.drawLine(2, 7, 78, 7);
|
||||
|
||||
map.insert(styles.at(i), QIcon(pix));
|
||||
map.insert(s, QIcon(pix));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
|
|
@ -2023,13 +2023,13 @@ QVector<VFormulaField> VAbstractPattern::ListFinalMeasurementsExpressions() cons
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VAbstractPattern::IsVariable(const QString &token) const
|
||||
{
|
||||
for (int i = 0; i < builInVariables.size(); ++i)
|
||||
for (auto &var : builInVariables)
|
||||
{
|
||||
if (token.indexOf( builInVariables.at(i) ) == 0)
|
||||
if (token.indexOf( var ) == 0)
|
||||
{
|
||||
if (builInVariables.at(i) == currentLength || builInVariables.at(i) == currentSeamAllowance)
|
||||
if (var == currentLength || var == currentSeamAllowance)
|
||||
{
|
||||
return token == builInVariables.at(i);
|
||||
return token == var;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2049,9 +2049,9 @@ bool VAbstractPattern::IsVariable(const QString &token) const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VAbstractPattern::IsFunction(const QString &token) const
|
||||
{
|
||||
for (int i = 0; i < builInFunctions.size(); ++i)
|
||||
for (auto &fn : builInFunctions)
|
||||
{
|
||||
if (token.indexOf( builInFunctions.at(i) ) == 0)
|
||||
if (token.indexOf(fn) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -2176,13 +2176,13 @@ void VAbstractPattern::SetFMeasurements(QDomElement &element, const QVector<VFin
|
|||
{
|
||||
if (not element.isNull())
|
||||
{
|
||||
for (int i=0; i < measurements.size(); ++i)
|
||||
for (auto &m : measurements)
|
||||
{
|
||||
QDomElement tagFMeasurement = createElement(TagFMeasurement);
|
||||
|
||||
SetAttribute(tagFMeasurement, AttrName, measurements.at(i).name);
|
||||
SetAttribute(tagFMeasurement, AttrFormula, measurements.at(i).formula);
|
||||
SetAttribute(tagFMeasurement, AttrDescription, measurements.at(i).description);
|
||||
SetAttribute(tagFMeasurement, AttrName, m.name);
|
||||
SetAttribute(tagFMeasurement, AttrFormula, m.formula);
|
||||
SetAttribute(tagFMeasurement, AttrDescription, m.description);
|
||||
|
||||
element.appendChild(tagFMeasurement);
|
||||
}
|
||||
|
|
|
@ -972,15 +972,15 @@ void VDomDocument::SetLabelTemplate(QDomElement &element, const QVector<VLabelTe
|
|||
{
|
||||
if (not element.isNull())
|
||||
{
|
||||
for (int i=0; i < lines.size(); ++i)
|
||||
for (auto &line : lines)
|
||||
{
|
||||
QDomElement tagLine = createElement(TagLine);
|
||||
|
||||
SetAttribute(tagLine, AttrText, lines.at(i).line);
|
||||
SetAttribute(tagLine, AttrBold, lines.at(i).bold);
|
||||
SetAttribute(tagLine, AttrItalic, lines.at(i).italic);
|
||||
SetAttribute(tagLine, AttrAlignment, lines.at(i).alignment);
|
||||
SetAttribute(tagLine, AttrFSIncrement, lines.at(i).fontSizeIncrement);
|
||||
SetAttribute(tagLine, AttrText, line.line);
|
||||
SetAttribute(tagLine, AttrBold, line.bold);
|
||||
SetAttribute(tagLine, AttrItalic, line.italic);
|
||||
SetAttribute(tagLine, AttrAlignment, line.alignment);
|
||||
SetAttribute(tagLine, AttrFSIncrement, line.fontSizeIncrement);
|
||||
|
||||
element.appendChild(tagLine);
|
||||
}
|
||||
|
|
|
@ -1661,10 +1661,10 @@ void VPatternConverter::SaveChildrenToolUnionToV0_2_4(quint32 id, const QVector<
|
|||
|
||||
QDomElement tagChildren = createElement(*strChildren);
|
||||
|
||||
for (int i=0; i<children.size(); ++i)
|
||||
for (auto child : children)
|
||||
{
|
||||
QDomElement tagChild = createElement(*strChild);
|
||||
tagChild.appendChild(createTextNode(QString().setNum(children.at(i))));
|
||||
tagChild.appendChild(createTextNode(QString().setNum(child)));
|
||||
tagChildren.appendChild(tagChild);
|
||||
}
|
||||
|
||||
|
@ -2565,10 +2565,10 @@ void VPatternConverter::TagUnionDetailsToV0_4_0()
|
|||
|
||||
RemoveAllChildren(toolDOM);
|
||||
|
||||
for (int i = 0; i < nodes.size(); ++i)
|
||||
for (auto &node : nodes)
|
||||
{
|
||||
QDomElement tagDet = createElement(*strDet);
|
||||
tagDet.appendChild(nodes.at(i));
|
||||
tagDet.appendChild(node);
|
||||
toolDOM.appendChild(tagDet);
|
||||
}
|
||||
toolDOM.appendChild(tagChildrenNodes);
|
||||
|
|
|
@ -201,12 +201,12 @@ void VVITConverter::ConvertMeasurementsToV0_3_0()
|
|||
|
||||
const QMultiMap<QString, QString> names = OldNamesToNewNames_InV0_3_0();
|
||||
const QList<QString> keys = names.uniqueKeys();
|
||||
for (int i = 0; i < keys.size(); ++i)
|
||||
for (auto &key : keys)
|
||||
{
|
||||
qreal resValue = 0;
|
||||
|
||||
// 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( key );
|
||||
for(const auto &val : list)
|
||||
{
|
||||
const QDomNodeList nodeList = this->elementsByTagName(val);
|
||||
|
@ -223,7 +223,7 @@ void VVITConverter::ConvertMeasurementsToV0_3_0()
|
|||
}
|
||||
}
|
||||
|
||||
bm.appendChild(AddMV0_3_0(keys.at(i), resValue));
|
||||
bm.appendChild(AddMV0_3_0(key, resValue));
|
||||
}
|
||||
|
||||
QDomElement rootElement = this->documentElement();
|
||||
|
|
|
@ -214,14 +214,14 @@ void VVSTConverter::ConvertMeasurementsToV0_4_0()
|
|||
|
||||
const QMultiMap<QString, QString> names = OldNamesToNewNames_InV0_3_0();
|
||||
const QList<QString> keys = names.uniqueKeys();
|
||||
for (int i = 0; i < keys.size(); ++i)
|
||||
for (auto &key : keys)
|
||||
{
|
||||
qreal resValue = 0;
|
||||
qreal resSizeIncrease = 0;
|
||||
qreal resHeightIncrease = 0;
|
||||
|
||||
// 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( key );
|
||||
for(const auto &val : list)
|
||||
{
|
||||
const QDomNodeList nodeList = this->elementsByTagName(val);
|
||||
|
@ -243,7 +243,7 @@ void VVSTConverter::ConvertMeasurementsToV0_4_0()
|
|||
}
|
||||
}
|
||||
|
||||
bm.appendChild(AddMV0_4_0(keys.at(i), resValue, resSizeIncrease, resHeightIncrease));
|
||||
bm.appendChild(AddMV0_4_0(key, resValue, resSizeIncrease, resHeightIncrease));
|
||||
}
|
||||
|
||||
QDomElement rootElement = this->documentElement();
|
||||
|
|
|
@ -145,9 +145,9 @@ void QmuFormulaBase::SetSepForEval()
|
|||
void QmuFormulaBase::RemoveAll(QMap<int, QString> &map, const QString &val)
|
||||
{
|
||||
const QList<int> listKeys = map.keys(val);//Take all keys that contain token.
|
||||
for (int i = 0; i < listKeys.size(); ++i)
|
||||
for (auto key : listKeys)
|
||||
{
|
||||
map.remove(listKeys.at(i));
|
||||
map.remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -143,9 +143,8 @@ void VDxfEngine::drawPath(const QPainterPath &path)
|
|||
{
|
||||
const QList<QPolygonF> subpaths = path.toSubpathPolygons(matrix);
|
||||
|
||||
for (int j=0; j < subpaths.size(); ++j)
|
||||
for (auto polygon : subpaths)
|
||||
{
|
||||
const QPolygonF polygon = subpaths.at(j);
|
||||
if (polygon.isEmpty())
|
||||
{
|
||||
continue;
|
||||
|
@ -166,10 +165,10 @@ void VDxfEngine::drawPath(const QPainterPath &path)
|
|||
|
||||
poly->flags |= 0x80; // plinegen
|
||||
|
||||
for (int i=0; i < polygon.count(); ++i)
|
||||
for (auto p : polygon)
|
||||
{
|
||||
poly->addVertex(DRW_Vertex2D(FromPixel(polygon.at(i).x(), varInsunits),
|
||||
FromPixel(getSize().height() - polygon.at(i).y(), varInsunits), 0));
|
||||
poly->addVertex(DRW_Vertex2D(FromPixel(p.x(), varInsunits),
|
||||
FromPixel(getSize().height() - p.y(), varInsunits), 0));
|
||||
}
|
||||
|
||||
input->AddEntity(poly);
|
||||
|
@ -188,10 +187,10 @@ void VDxfEngine::drawPath(const QPainterPath &path)
|
|||
|
||||
poly->flags |= 0x80; // plinegen
|
||||
|
||||
for (int i=0; i < polygon.count(); ++i)
|
||||
for (auto p : polygon)
|
||||
{
|
||||
poly->addVertex(DRW_Vertex(FromPixel(polygon.at(i).x(), varInsunits),
|
||||
FromPixel(getSize().height() - polygon.at(i).y(), varInsunits), 0, 0));
|
||||
poly->addVertex(DRW_Vertex(FromPixel(p.x(), varInsunits),
|
||||
FromPixel(getSize().height() - p.y(), varInsunits), 0, 0));
|
||||
}
|
||||
|
||||
input->AddEntity(poly);
|
||||
|
@ -770,9 +769,9 @@ void VDxfEngine::ExportAAMAText(dx_ifaceBlock *detailBlock, const VLayoutPiece &
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VDxfEngine::ExportAAMAGlobalText(const QSharedPointer<dx_iface> &input, const QVector<VLayoutPiece> &details)
|
||||
{
|
||||
for(int i = 0; i < details.size(); ++i)
|
||||
for(auto &detail : details)
|
||||
{
|
||||
const QStringList strings = details.at(i).GetPatternText();
|
||||
const QStringList strings = detail.GetPatternText();
|
||||
if (not strings.isEmpty())
|
||||
{
|
||||
for (int j = 0; j < strings.size(); ++j)
|
||||
|
@ -870,10 +869,10 @@ P *VDxfEngine::CreateAAMAPolygon(const QVector<QPointF> &polygon, const QString
|
|||
}
|
||||
}
|
||||
|
||||
for (int i=0; i < polygon.count(); ++i)
|
||||
for (auto p : polygon)
|
||||
{
|
||||
poly->addVertex(V(FromPixel(polygon.at(i).x(), varInsunits),
|
||||
FromPixel(getSize().height() - polygon.at(i).y(), varInsunits)));
|
||||
poly->addVertex(V(FromPixel(p.x(), varInsunits),
|
||||
FromPixel(getSize().height() - p.y(), varInsunits)));
|
||||
}
|
||||
|
||||
return poly;
|
||||
|
|
|
@ -376,9 +376,8 @@ QPainterPath VAbstractCurve::ShowDirection(const QVector<DirectionArrow> &arrows
|
|||
{
|
||||
QPainterPath path;
|
||||
|
||||
for (int i = 0; i < arrows.size(); ++i)
|
||||
for (auto arrow : arrows)
|
||||
{
|
||||
const DirectionArrow arrow = arrows.at(i);
|
||||
if (not arrow.first.isNull() && not arrow.second.isNull())
|
||||
{
|
||||
QPainterPath arrowPath;
|
||||
|
|
|
@ -527,9 +527,8 @@ qreal VSpline::ParamT (const QPointF &pBt) const
|
|||
|
||||
// In morst case we will have 6 result in interval [0; 1].
|
||||
// Here we try find closest to our point.
|
||||
for (int i=0; i< ts.size(); ++i)
|
||||
for (auto t : qAsConst(ts))
|
||||
{
|
||||
const qreal t = ts.at(i);
|
||||
const QPointF p0 = static_cast<QPointF>(GetP1());
|
||||
const QPointF p1 = static_cast<QPointF>(GetP2());
|
||||
const QPointF p2 = static_cast<QPointF>(GetP3());
|
||||
|
|
|
@ -208,9 +208,9 @@ LayoutErrors VLayoutGenerator::State() const
|
|||
QList<QGraphicsItem *> VLayoutGenerator::GetPapersItems() const
|
||||
{
|
||||
QList<QGraphicsItem *> list;
|
||||
for (int i=0; i < papers.count(); ++i)
|
||||
for (auto &paper : papers)
|
||||
{
|
||||
list.append(papers.at(i).GetPaperItem(autoCrop, IsTestAsPaths()));
|
||||
list.append(paper.GetPaperItem(autoCrop, IsTestAsPaths()));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
@ -219,9 +219,9 @@ QList<QGraphicsItem *> VLayoutGenerator::GetPapersItems() const
|
|||
QList<QList<QGraphicsItem *> > VLayoutGenerator::GetAllDetailsItems() const
|
||||
{
|
||||
QList<QList<QGraphicsItem *> > list;
|
||||
for (int i=0; i < papers.count(); ++i)
|
||||
for (auto &paper : papers)
|
||||
{
|
||||
list.append(papers.at(i).GetItemDetails(IsTestAsPaths()));
|
||||
list.append(paper.GetItemDetails(IsTestAsPaths()));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
@ -230,9 +230,9 @@ QList<QList<QGraphicsItem *> > VLayoutGenerator::GetAllDetailsItems() const
|
|||
QVector<QVector<VLayoutPiece> > VLayoutGenerator::GetAllDetails() const
|
||||
{
|
||||
QVector<QVector<VLayoutPiece> > list;
|
||||
for (int i=0; i < papers.count(); ++i)
|
||||
for (auto &paper : papers)
|
||||
{
|
||||
list.append(papers.at(i).GetDetails());
|
||||
list.append(paper.GetDetails());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
@ -458,9 +458,8 @@ QList<VLayoutPiece> VLayoutGenerator::MoveDetails(qreal length, const QVector<VL
|
|||
}
|
||||
|
||||
QList<VLayoutPiece> newDetails;
|
||||
for (int i = 0; i < details.size(); ++i)
|
||||
for (auto d : details)
|
||||
{
|
||||
VLayoutPiece d = details.at(i);
|
||||
d.Translate(0, length);
|
||||
newDetails.append(d);
|
||||
}
|
||||
|
|
|
@ -275,9 +275,9 @@ bool VLayoutPaper::AddToSheet(const VLayoutPiece &detail, std::atomic_bool &stop
|
|||
return false;
|
||||
}
|
||||
|
||||
for (int i=0; i < threads.size(); ++i)
|
||||
for (auto thread : threads)
|
||||
{
|
||||
bestResult.NewResult(threads.at(i)->getBestResult());
|
||||
bestResult.NewResult(thread->getBestResult());
|
||||
}
|
||||
|
||||
qDeleteAll(threads.begin(), threads.end());
|
||||
|
@ -322,9 +322,9 @@ QGraphicsRectItem *VLayoutPaper::GetPaperItem(bool autoCrop, bool textAsPaths) c
|
|||
{
|
||||
QScopedPointer<QGraphicsScene> scene(new QGraphicsScene());
|
||||
QList<QGraphicsItem *> list = GetItemDetails(textAsPaths);
|
||||
for (int i=0; i < list.size(); ++i)
|
||||
for (auto item : list)
|
||||
{
|
||||
scene->addItem(list.at(i));
|
||||
scene->addItem(item);
|
||||
}
|
||||
const int height = scene->itemsBoundingRect().toRect().height();
|
||||
if (d->globalContour.GetHeight() > height) //-V807
|
||||
|
@ -349,9 +349,9 @@ QGraphicsRectItem *VLayoutPaper::GetPaperItem(bool autoCrop, bool textAsPaths) c
|
|||
QList<QGraphicsItem *> VLayoutPaper::GetItemDetails(bool textAsPaths) const
|
||||
{
|
||||
QList<QGraphicsItem *> list;
|
||||
for (int i=0; i < d->details.count(); ++i)
|
||||
for (auto &detail : d->details)
|
||||
{
|
||||
list.append(d->details.at(i).GetItem(textAsPaths));
|
||||
list.append(detail.GetItem(textAsPaths));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
@ -372,9 +372,9 @@ void VLayoutPaper::SetDetails(const QList<VLayoutPiece> &details)
|
|||
QRectF VLayoutPaper::DetailsBoundingRect() const
|
||||
{
|
||||
QRectF rec;
|
||||
for (int i=0; i < d->details.count(); ++i)
|
||||
for (auto &detail : d->details)
|
||||
{
|
||||
rec = rec.united(d->details.at(i).DetailBoundingRect());
|
||||
rec = rec.united(detail.DetailBoundingRect());
|
||||
}
|
||||
|
||||
return rec;
|
||||
|
|
|
@ -66,9 +66,9 @@ QVector<VLayoutPiecePath> ConvertInternalPaths(const VPiece &piece, const VConta
|
|||
|
||||
QVector<VLayoutPiecePath> paths;
|
||||
const QVector<quint32> pathsId = piece.GetInternalPaths();
|
||||
for (int i = 0; i < pathsId.size(); ++i)
|
||||
for (auto id : pathsId)
|
||||
{
|
||||
const VPiecePath path = pattern->GetPiecePath(pathsId.at(i));
|
||||
const VPiecePath path = pattern->GetPiecePath(id);
|
||||
if (path.GetType() == PiecePathType::InternalPath && path.IsVisible(pattern->DataVariables()))
|
||||
{
|
||||
paths.append(VLayoutPiecePath(path.PathPoints(pattern), path.IsCutPath(), path.GetPenType()));
|
||||
|
@ -246,28 +246,28 @@ bool IsItemContained(const QRectF &parentBoundingRect, const QVector<QPointF> &s
|
|||
// single point differences
|
||||
bool bInside = true;
|
||||
|
||||
for (int i = 0; i < shape.size(); ++i)
|
||||
for (auto p : shape)
|
||||
{
|
||||
qreal dPtX = 0;
|
||||
qreal dPtY = 0;
|
||||
if (not parentBoundingRect.contains(shape.at(i)))
|
||||
if (not parentBoundingRect.contains(p))
|
||||
{
|
||||
if (shape.at(i).x() < parentBoundingRect.left())
|
||||
if (p.x() < parentBoundingRect.left())
|
||||
{
|
||||
dPtX = parentBoundingRect.left() - shape.at(i).x();
|
||||
dPtX = parentBoundingRect.left() - p.x();
|
||||
}
|
||||
else if (shape.at(i).x() > parentBoundingRect.right())
|
||||
else if (p.x() > parentBoundingRect.right())
|
||||
{
|
||||
dPtX = parentBoundingRect.right() - shape.at(i).x();
|
||||
dPtX = parentBoundingRect.right() - p.x();
|
||||
}
|
||||
|
||||
if (shape.at(i).y() < parentBoundingRect.top())
|
||||
if (p.y() < parentBoundingRect.top())
|
||||
{
|
||||
dPtY = parentBoundingRect.top() - shape.at(i).y();
|
||||
dPtY = parentBoundingRect.top() - p.y();
|
||||
}
|
||||
else if (shape.at(i).y() > parentBoundingRect.bottom())
|
||||
else if (p.y() > parentBoundingRect.bottom())
|
||||
{
|
||||
dPtY = parentBoundingRect.bottom() - shape.at(i).y();
|
||||
dPtY = parentBoundingRect.bottom() - p.y();
|
||||
}
|
||||
|
||||
if (fabs(dPtX) > fabs(dX))
|
||||
|
@ -448,9 +448,9 @@ template <class T>
|
|||
QVector<T> VLayoutPiece::Map(const QVector<T> &points) const
|
||||
{
|
||||
QVector<T> p;
|
||||
for (int i = 0; i < points.size(); ++i)
|
||||
for (auto point : points)
|
||||
{
|
||||
p.append(d->matrix.map(points.at(i)));
|
||||
p.append(d->matrix.map(point));
|
||||
}
|
||||
|
||||
if (d->mirror)
|
||||
|
@ -949,11 +949,11 @@ QVector<QVector<QPointF> > VLayoutPiece::InternalPathsForCut(bool cut) const
|
|||
{
|
||||
QVector<QVector<QPointF> > paths;
|
||||
|
||||
for (int i=0;i < d->m_internalPaths.count(); ++i)
|
||||
for (auto &path : d->m_internalPaths)
|
||||
{
|
||||
if (d->m_internalPaths.at(i).IsCutPath() == cut)
|
||||
if (path.IsCutPath() == cut)
|
||||
{
|
||||
paths.append(Map(d->m_internalPaths.at(i).Points()));
|
||||
paths.append(Map(path.Points()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1051,20 +1051,20 @@ QGraphicsItem *VLayoutPiece::GetItem(bool textAsPaths) const
|
|||
{
|
||||
QGraphicsPathItem *item = GetMainItem();
|
||||
|
||||
for (int i = 0; i < d->m_internalPaths.count(); ++i)
|
||||
for (auto &path : d->m_internalPaths)
|
||||
{
|
||||
QGraphicsPathItem* pathItem = new QGraphicsPathItem(item);
|
||||
pathItem->setPath(d->matrix.map(d->m_internalPaths.at(i).GetPainterPath()));
|
||||
pathItem->setPath(d->matrix.map(path.GetPainterPath()));
|
||||
|
||||
QPen pen = pathItem->pen();
|
||||
pen.setStyle(d->m_internalPaths.at(i).PenStyle());
|
||||
pen.setStyle(path.PenStyle());
|
||||
pathItem->setPen(pen);
|
||||
}
|
||||
|
||||
for (int i = 0; i < d->m_placeLabels.count(); ++i)
|
||||
for (auto &label : d->m_placeLabels)
|
||||
{
|
||||
QGraphicsPathItem* pathItem = new QGraphicsPathItem(item);
|
||||
pathItem->setPath(d->matrix.map(PlaceLabelImgPath(d->m_placeLabels.at(i).shape)));
|
||||
pathItem->setPath(d->matrix.map(PlaceLabelImgPath(label.shape)));
|
||||
}
|
||||
|
||||
CreateLabelStrings(item, d->detailLabel, d->m_tmDetail, textAsPaths);
|
||||
|
@ -1199,9 +1199,9 @@ void VLayoutPiece::CreateGrainlineItem(QGraphicsItem *parent) const
|
|||
|
||||
QVector<QPointF> gPoints = GetGrainline();
|
||||
path.moveTo(gPoints.at(0));
|
||||
for (int i = 1; i < gPoints.count(); ++i)
|
||||
for (auto p : gPoints)
|
||||
{
|
||||
path.lineTo(gPoints.at(i));
|
||||
path.lineTo(p);
|
||||
}
|
||||
item->setPath(path);
|
||||
}
|
||||
|
|
|
@ -571,9 +571,9 @@ QPainterPath VPosition::DrawDetails(const QVector<VLayoutPiece> &details)
|
|||
path.setFillRule(Qt::WindingFill);
|
||||
if (details.count() > 0)
|
||||
{
|
||||
for (int i = 0; i < details.size(); ++i)
|
||||
for (auto &detail : details)
|
||||
{
|
||||
path.addPath(details.at(i).ContourPath());
|
||||
path.addPath(detail.ContourPath());
|
||||
}
|
||||
}
|
||||
return path;
|
||||
|
|
|
@ -180,16 +180,16 @@ QList<TextLine> PrepareLines(const QVector<VLabelTemplateLine> &lines)
|
|||
{
|
||||
QList<TextLine> textLines;
|
||||
|
||||
for (int i=0; i < lines.size(); ++i)
|
||||
for (auto &line : lines)
|
||||
{
|
||||
if (not lines.at(i).line.isEmpty())
|
||||
if (not line.line.isEmpty())
|
||||
{
|
||||
TextLine tl;
|
||||
tl.m_qsText = lines.at(i).line;
|
||||
tl.m_eAlign = static_cast<Qt::Alignment>(lines.at(i).alignment);
|
||||
tl.m_iFontSize = lines.at(i).fontSizeIncrement;
|
||||
tl.bold = lines.at(i).bold;
|
||||
tl.italic = lines.at(i).italic;
|
||||
tl.m_qsText = line.line;
|
||||
tl.m_eAlign = static_cast<Qt::Alignment>(line.alignment);
|
||||
tl.m_iFontSize = line.fontSizeIncrement;
|
||||
tl.bold = line.bold;
|
||||
tl.italic = line.italic;
|
||||
|
||||
textLines << tl;
|
||||
}
|
||||
|
|
|
@ -817,11 +817,9 @@ void InitLanguages(QComboBox *combobox)
|
|||
bool englishUS = false;
|
||||
const QString en_US = QStringLiteral("en_US");
|
||||
|
||||
for (int i = 0; i < fileNames.size(); ++i)
|
||||
for (auto locale : fileNames)
|
||||
{
|
||||
// get locale extracted by filename
|
||||
QString locale;
|
||||
locale = fileNames.at(i); // "valentina_de_De.qm"
|
||||
// get locale extracted by filename "valentina_de_De.qm"
|
||||
locale.truncate(locale.lastIndexOf('.')); // "valentina_de_De"
|
||||
locale.remove(0, locale.indexOf('_') + 1); // "de_De"
|
||||
|
||||
|
|
|
@ -105,9 +105,9 @@ qreal lineWidthCached = 0;
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QStringList ClearFormats(const QStringList &predefinedFormats, QStringList formats)
|
||||
{
|
||||
for (int i = 0; i < predefinedFormats.size(); ++i)
|
||||
for (auto &f : predefinedFormats)
|
||||
{
|
||||
formats.removeAll(predefinedFormats.at(i));
|
||||
formats.removeAll(f);
|
||||
}
|
||||
return formats;
|
||||
}
|
||||
|
@ -550,11 +550,11 @@ QStringList VCommonSettings::GetRecentFileList() const
|
|||
const QStringList files = value(*settingGeneralRecentFileList).toStringList();
|
||||
QStringList cleared;
|
||||
|
||||
for (int i = 0; i < files.size(); ++i)
|
||||
for (auto &f : files)
|
||||
{
|
||||
if (QFileInfo::exists(files.at(i)))
|
||||
if (QFileInfo::exists(f))
|
||||
{
|
||||
cleared.append(files.at(i));
|
||||
cleared.append(f);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -172,12 +172,12 @@ void VObjEngine::drawPath(const QPainterPath &path)
|
|||
|
||||
quint32 num_points = 0;
|
||||
|
||||
for (int i=0; i < polygon.count(); i++)
|
||||
for (auto &p : polygon)
|
||||
{
|
||||
if ( num_points < MAX_POINTS )
|
||||
{
|
||||
points[num_points].x = polygon.at(i).x();
|
||||
points[num_points].y = polygon.at(i).y();
|
||||
points[num_points].x = p.x();
|
||||
points[num_points].y = p.y();
|
||||
num_points++;
|
||||
}
|
||||
}
|
||||
|
@ -326,12 +326,12 @@ QPolygonF VObjEngine::MakePointsUnique(const QPolygonF &polygon) const
|
|||
{
|
||||
QVector<QPointF> set;
|
||||
QPolygonF uniquePolygon;
|
||||
for (int i=0; i < polygon.count(); i++)
|
||||
for (auto p : polygon)
|
||||
{
|
||||
if (set.contains(polygon.at(i)) == false)
|
||||
if (set.contains(p) == false)
|
||||
{
|
||||
set.append(polygon.at(i));
|
||||
uniquePolygon.append(polygon.at(i));
|
||||
set.append(p);
|
||||
uniquePolygon.append(p);
|
||||
}
|
||||
}
|
||||
return uniquePolygon;
|
||||
|
|
|
@ -671,9 +671,9 @@ QStringList ListNumbers(const VTranslateMeasurements *trM, const QStringList &li
|
|||
SCASSERT(trM != nullptr)
|
||||
|
||||
QStringList numbers;
|
||||
for (int i=0; i < listMeasurements.size(); ++i)
|
||||
for (auto &m : listMeasurements)
|
||||
{
|
||||
numbers.append(trM->MNumber(listMeasurements.at(i)));
|
||||
numbers.append(trM->MNumber(m));
|
||||
}
|
||||
return numbers;
|
||||
}
|
||||
|
|
|
@ -159,9 +159,9 @@ void InitPMSystems(QComboBox *systemCombo)
|
|||
{
|
||||
const QStringList listSystems = ListPMSystems();
|
||||
QMap<QString, QString> systems;
|
||||
for (int i = 0; i < listSystems.size()-1; ++i)
|
||||
for (auto &sys : listSystems)
|
||||
{
|
||||
systems.insert(qApp->TrVars()->PMSystemName(listSystems.at(i)) + " ("+listSystems.at(i)+")", listSystems.at(i));
|
||||
systems.insert(qApp->TrVars()->PMSystemName(sys) + QLatin1String(" (") + sys + QLatin1String(")"), sys);
|
||||
}
|
||||
|
||||
// * The default option (blank field or 'None') should appear at the top of the list.
|
||||
|
|
|
@ -224,9 +224,8 @@ QVector<VPieceNode> VNodeDetail::Convert(const VContainer *data, const QVector<V
|
|||
}
|
||||
|
||||
VPiecePath path;
|
||||
for (int i = 0; i < nodes.size(); ++i)
|
||||
for (auto &node : nodes)
|
||||
{
|
||||
const VNodeDetail &node = nodes.at(i);
|
||||
path.Append(VPieceNode(node.getId(), node.getTypeTool(), node.getReverse()));
|
||||
}
|
||||
|
||||
|
|
|
@ -256,9 +256,8 @@ bool IsPassmarksPossible(const QVector<VPieceNode> &path)
|
|||
int countPointNodes = 0;
|
||||
int countOthers = 0;
|
||||
|
||||
for (int i = 0; i< path.size(); ++i)
|
||||
for (auto &node : path)
|
||||
{
|
||||
const VPieceNode &node = path.at(i);
|
||||
if (node.IsExcluded())
|
||||
{
|
||||
continue;// skip node
|
||||
|
@ -895,9 +894,8 @@ QVector<VPieceNode> VPiece::GetUnitedPath(const VContainer *data) const
|
|||
QVector<CustomSARecord> VPiece::GetValidRecords() const
|
||||
{
|
||||
QVector<CustomSARecord> records;
|
||||
for (int i = 0; i < d->m_customSARecords.size(); ++i)
|
||||
for (auto &record : d->m_customSARecords)
|
||||
{
|
||||
const CustomSARecord &record = d->m_customSARecords.at(i);
|
||||
const int indexStartPoint = d->m_path.indexOfNode(record.startPoint);
|
||||
const int indexEndPoint = d->m_path.indexOfNode(record.endPoint);
|
||||
|
||||
|
@ -948,13 +946,13 @@ QVector<CustomSARecord> VPiece::FilterRecords(QVector<CustomSARecord> records) c
|
|||
records.remove(startIndex);
|
||||
|
||||
QVector<CustomSARecord> secondRound;
|
||||
for (int i = 0; i < records.size(); ++i)
|
||||
for (auto &record : records)
|
||||
{
|
||||
const int indexStartPoint = d->m_path.indexOfNode(records.at(i).startPoint);
|
||||
const int indexStartPoint = d->m_path.indexOfNode(record.startPoint);
|
||||
const int indexEndPoint = d->m_path.indexOfNode(filter.endPoint);
|
||||
if (indexStartPoint > indexEndPoint)
|
||||
{
|
||||
secondRound.append(records.at(i));
|
||||
secondRound.append(record);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1149,12 +1147,12 @@ bool VPiece::IsPassmarkVisible(const QVector<VPieceNode> &path, int passmarkInde
|
|||
return true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < records.size(); ++i)
|
||||
for (auto &record : records)
|
||||
{
|
||||
if (records.at(i).includeType == PiecePathIncludeType::AsCustomSA)
|
||||
if (record.includeType == PiecePathIncludeType::AsCustomSA)
|
||||
{
|
||||
const int indexStartPoint = VPiecePath::indexOfNode(path, records.at(i).startPoint);
|
||||
const int indexEndPoint = VPiecePath::indexOfNode(path, records.at(i).endPoint);
|
||||
const int indexStartPoint = VPiecePath::indexOfNode(path, record.startPoint);
|
||||
const int indexEndPoint = VPiecePath::indexOfNode(path, record.endPoint);
|
||||
if (passmarkIndex > indexStartPoint && passmarkIndex < indexEndPoint)
|
||||
{
|
||||
return false;
|
||||
|
|
|
@ -581,9 +581,9 @@ void VPiecePath::NodeOnEdge(quint32 index, VPieceNode &p1, VPieceNode &p2) const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VPiecePath::Contains(quint32 id) const
|
||||
{
|
||||
for (int i = 0; i < d->m_nodes.size(); ++i)
|
||||
for (auto &node : d->m_nodes)
|
||||
{
|
||||
if (d->m_nodes.at(i).GetId() == id)
|
||||
if (node.GetId() == id)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -676,11 +676,11 @@ int VPiecePath::Edge(quint32 p1, quint32 p2) const
|
|||
QVector<VPieceNode> VPiecePath::ListNodePoint() const
|
||||
{
|
||||
QVector<VPieceNode> list;
|
||||
for (int i = 0; i < d->m_nodes.size(); ++i) //-V807
|
||||
for (auto &node : d->m_nodes) //-V807
|
||||
{
|
||||
if (d->m_nodes.at(i).GetTypeTool() == Tool::NodePoint)
|
||||
if (node.GetTypeTool() == Tool::NodePoint)
|
||||
{
|
||||
list.append(d->m_nodes.at(i));
|
||||
list.append(node);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
|
|
|
@ -574,16 +574,16 @@ void DialogEditLabel::SetTemplate(const QVector<VLabelTemplateLine> &lines)
|
|||
|
||||
int row = -1;
|
||||
|
||||
for (int i=0; i<lines.size(); ++i)
|
||||
for (auto &line : lines)
|
||||
{
|
||||
QListWidgetItem *item = new QListWidgetItem(qApp->TrVars()->PlaceholderToUserText(lines.at(i).line));
|
||||
item->setTextAlignment(lines.at(i).alignment);
|
||||
item->setData(Qt::UserRole, lines.at(i).fontSizeIncrement);
|
||||
QListWidgetItem *item = new QListWidgetItem(qApp->TrVars()->PlaceholderToUserText(line.line));
|
||||
item->setTextAlignment(line.alignment);
|
||||
item->setData(Qt::UserRole, line.fontSizeIncrement);
|
||||
|
||||
QFont font = item->font();
|
||||
font.setBold(lines.at(i).bold);
|
||||
font.setItalic(lines.at(i).italic);
|
||||
font.setPointSize(font.pointSize() + lines.at(i).fontSizeIncrement);
|
||||
font.setBold(line.bold);
|
||||
font.setItalic(line.italic);
|
||||
font.setPointSize(font.pointSize() + line.fontSizeIncrement);
|
||||
item->setFont(font);
|
||||
|
||||
ui->listWidgetEdit->insertItem(++row, item);
|
||||
|
@ -622,16 +622,16 @@ void DialogEditLabel::InitPreviewLines(const QVector<VLabelTemplateLine> &lines)
|
|||
|
||||
int row = -1;
|
||||
|
||||
for (int i=0; i<lines.size(); ++i)
|
||||
for (auto &line : lines)
|
||||
{
|
||||
QListWidgetItem *item = new QListWidgetItem(ReplacePlaceholders(lines.at(i).line));
|
||||
item->setTextAlignment(lines.at(i).alignment);
|
||||
item->setData(Qt::UserRole, lines.at(i).fontSizeIncrement);
|
||||
QListWidgetItem *item = new QListWidgetItem(ReplacePlaceholders(line.line));
|
||||
item->setTextAlignment(line.alignment);
|
||||
item->setData(Qt::UserRole, line.fontSizeIncrement);
|
||||
|
||||
QFont font = item->font();
|
||||
font.setBold(lines.at(i).bold);
|
||||
font.setItalic(lines.at(i).italic);
|
||||
font.setPointSize(font.pointSize() + lines.at(i).fontSizeIncrement);
|
||||
font.setBold(line.bold);
|
||||
font.setItalic(line.italic);
|
||||
font.setPointSize(font.pointSize() + line.fontSizeIncrement);
|
||||
item->setFont(font);
|
||||
|
||||
ui->listWidgetPreview->insertItem(++row, item);
|
||||
|
|
|
@ -254,9 +254,9 @@ void DialogFlippingByAxis::SuffixChanged()
|
|||
{
|
||||
QRegularExpression rx(NameRegExp());
|
||||
const QStringList uniqueNames = VContainer::AllUniqueNames();
|
||||
for (int i=0; i < uniqueNames.size(); ++i)
|
||||
for (auto &uniqueName : uniqueNames)
|
||||
{
|
||||
const QString name = uniqueNames.at(i) + suffix;
|
||||
const QString name = uniqueName + suffix;
|
||||
if (not rx.match(name).hasMatch() || not data->IsUnique(name))
|
||||
{
|
||||
flagName = false;
|
||||
|
|
|
@ -281,9 +281,9 @@ void DialogFlippingByLine::SuffixChanged()
|
|||
{
|
||||
QRegularExpression rx(NameRegExp());
|
||||
const QStringList uniqueNames = VContainer::AllUniqueNames();
|
||||
for (int i=0; i < uniqueNames.size(); ++i)
|
||||
for (auto &uniqueName : uniqueNames)
|
||||
{
|
||||
const QString name = uniqueNames.at(i) + suffix;
|
||||
const QString name = uniqueName + suffix;
|
||||
if (not rx.match(name).hasMatch() || not data->IsUnique(name))
|
||||
{
|
||||
flagName = false;
|
||||
|
|
|
@ -474,9 +474,9 @@ void DialogMove::SuffixChanged()
|
|||
{
|
||||
QRegularExpression rx(NameRegExp());
|
||||
const QStringList uniqueNames = VContainer::AllUniqueNames();
|
||||
for (int i=0; i < uniqueNames.size(); ++i)
|
||||
for (auto &uniqueName : uniqueNames)
|
||||
{
|
||||
const QString name = uniqueNames.at(i) + suffix;
|
||||
const QString name = uniqueName + suffix;
|
||||
if (not rx.match(name).hasMatch() || not data->IsUnique(name))
|
||||
{
|
||||
flagName = false;
|
||||
|
|
|
@ -336,9 +336,9 @@ void DialogRotation::SuffixChanged()
|
|||
{
|
||||
QRegularExpression rx(NameRegExp());
|
||||
const QStringList uniqueNames = VContainer::AllUniqueNames();
|
||||
for (int i=0; i < uniqueNames.size(); ++i)
|
||||
for (auto &uniqueName : uniqueNames)
|
||||
{
|
||||
const QString name = uniqueNames.at(i) + suffix;
|
||||
const QString name = uniqueName + suffix;
|
||||
if (not rx.match(name).hasMatch() || not data->IsUnique(name))
|
||||
{
|
||||
flagName = false;
|
||||
|
|
|
@ -218,9 +218,9 @@ void DialogTool::FillComboBoxPiecesList(QComboBox *box, const QVector<quint32> &
|
|||
SCASSERT(box != nullptr)
|
||||
box->blockSignals(true);
|
||||
box->clear();
|
||||
for (int i=0; i < list.size(); ++i)
|
||||
for (auto id : list)
|
||||
{
|
||||
box->addItem(data->GetPiece(list.at(i)).GetName(), list.at(i));
|
||||
box->addItem(data->GetPiece(id).GetName(), id);
|
||||
}
|
||||
box->blockSignals(false);
|
||||
box->setCurrentIndex(-1); // Force a user to choose
|
||||
|
|
|
@ -1022,9 +1022,8 @@ void DialogPiecePath::InitPassmarksList()
|
|||
|
||||
const QVector<VPieceNode> nodes = GetListInternals<VPieceNode>(ui->listWidget);
|
||||
|
||||
for (int i = 0; i < nodes.size(); ++i)
|
||||
for (auto &node : nodes)
|
||||
{
|
||||
const VPieceNode node = nodes.at(i);
|
||||
if (node.GetTypeTool() == Tool::NodePoint && node.IsPassmark())
|
||||
{
|
||||
const QString name = GetNodeName(node);
|
||||
|
|
|
@ -223,9 +223,9 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
|
|||
uiTabPaths->checkBoxHideMainPath->setChecked(piece.IsHideMainPath());
|
||||
uiTabPaths->listWidgetCustomSA->blockSignals(true);
|
||||
uiTabPaths->listWidgetCustomSA->clear();
|
||||
for (int i = 0; i < piece.GetCustomSARecords().size(); ++i)
|
||||
QVector<CustomSARecord> records = piece.GetCustomSARecords();
|
||||
for (auto record : records)
|
||||
{
|
||||
const CustomSARecord &record = piece.GetCustomSARecords().at(i);
|
||||
if (record.path > NULL_ID)
|
||||
{
|
||||
const QString name = GetPathName(record.path, record.reverse);
|
||||
|
@ -240,9 +240,9 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
|
|||
uiTabPaths->listWidgetCustomSA->blockSignals(false);
|
||||
|
||||
uiTabPaths->listWidgetInternalPaths->clear();
|
||||
for (int i = 0; i < piece.GetInternalPaths().size(); ++i)
|
||||
const QVector<quint32> paths = piece.GetInternalPaths();
|
||||
for (auto path : paths)
|
||||
{
|
||||
const quint32 path = piece.GetInternalPaths().at(i);
|
||||
if (path > NULL_ID)
|
||||
{
|
||||
const QString name = GetPathName(path);
|
||||
|
@ -277,17 +277,19 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
|
|||
};
|
||||
|
||||
uiTabPins->listWidgetPins->clear();
|
||||
for (int i = 0; i < piece.GetPins().size(); ++i)
|
||||
const QVector<quint32> pins = piece.GetPins();
|
||||
for (auto pin : pins)
|
||||
{
|
||||
NewSpecialPoint(uiTabPins->listWidgetPins, piece.GetPins().at(i));
|
||||
NewSpecialPoint(uiTabPins->listWidgetPins, pin);
|
||||
}
|
||||
|
||||
InitAllPinComboboxes();
|
||||
|
||||
uiTabPlaceLabels->listWidgetPlaceLabels->clear();
|
||||
for (int i = 0; i < piece.GetPlaceLabels().size(); ++i)
|
||||
const QVector<quint32> labels = piece.GetPlaceLabels();
|
||||
for (auto label : labels)
|
||||
{
|
||||
NewSpecialPoint(uiTabPlaceLabels->listWidgetPlaceLabels, piece.GetPlaceLabels().at(i));
|
||||
NewSpecialPoint(uiTabPlaceLabels->listWidgetPlaceLabels, label);
|
||||
}
|
||||
|
||||
if (piece.GetPlaceLabels().size() > 0)
|
||||
|
@ -2471,9 +2473,8 @@ void DialogSeamAllowance::InitNodesList()
|
|||
|
||||
const QVector<VPieceNode> nodes = GetListInternals<VPieceNode>(uiTabPaths->listWidgetMainPath);
|
||||
|
||||
for (int i = 0; i < nodes.size(); ++i)
|
||||
for (auto &node : nodes)
|
||||
{
|
||||
const VPieceNode node = nodes.at(i);
|
||||
if (node.GetTypeTool() == Tool::NodePoint && not node.IsExcluded())
|
||||
{
|
||||
const QString name = GetNodeName(node);
|
||||
|
@ -2505,9 +2506,8 @@ void DialogSeamAllowance::InitPassmarksList()
|
|||
|
||||
const QVector<VPieceNode> nodes = GetListInternals<VPieceNode>(uiTabPaths->listWidgetMainPath);
|
||||
|
||||
for (int i = 0; i < nodes.size(); ++i)
|
||||
for (auto &node : nodes)
|
||||
{
|
||||
const VPieceNode node = nodes.at(i);
|
||||
if (node.GetTypeTool() == Tool::NodePoint && node.IsPassmark())
|
||||
{
|
||||
const QString name = GetNodeName(node);
|
||||
|
@ -2775,9 +2775,8 @@ void DialogSeamAllowance::InitCSAPoint(QComboBox *box)
|
|||
|
||||
const QVector<VPieceNode> nodes = GetListInternals<VPieceNode>(uiTabPaths->listWidgetMainPath);
|
||||
|
||||
for (int i = 0; i < nodes.size(); ++i)
|
||||
for (auto &node : nodes)
|
||||
{
|
||||
const VPieceNode &node = nodes.at(i);
|
||||
if (node.GetTypeTool() == Tool::NodePoint && not node.IsExcluded())
|
||||
{
|
||||
const QString name = GetNodeName(node);
|
||||
|
@ -2802,10 +2801,9 @@ void DialogSeamAllowance::InitPinPoint(QComboBox *box)
|
|||
|
||||
const QVector<quint32> pins = GetListInternals<quint32>(uiTabPins->listWidgetPins);
|
||||
|
||||
for (int i = 0; i < pins.size(); ++i)
|
||||
for (auto pin : pins)
|
||||
{
|
||||
const QSharedPointer<VGObject> pin = data->GetGObject(pins.at(i));
|
||||
box->addItem(pin->name(), pins.at(i));
|
||||
box->addItem(data->GetGObject(pin)->name(), pin);
|
||||
}
|
||||
|
||||
const int index = uiTabPaths->comboBoxNodes->findData(currentId);
|
||||
|
@ -3301,9 +3299,9 @@ QString DialogSeamAllowance::GetDefaultPieceName() const
|
|||
QList<VPiece> pieces = data->DataPieces()->values();
|
||||
QSet<QString> names;
|
||||
|
||||
for (int i = 0; i < pieces.size(); ++i)
|
||||
for (auto &piece : pieces)
|
||||
{
|
||||
names.insert(pieces.at(i).GetName());
|
||||
names.insert(piece.GetName());
|
||||
}
|
||||
|
||||
const QString defName = tr("Detail");
|
||||
|
|
|
@ -55,9 +55,8 @@ void VAbstractFlipping::CreateDestination(VAbstractOperationInitData &initData,
|
|||
|
||||
initData.id = VContainer::getNextId();//Just reserve id for tool
|
||||
|
||||
for (int i = 0; i < initData.source.size(); ++i)
|
||||
for (auto idObject : qAsConst(initData.source))
|
||||
{
|
||||
const quint32 idObject = initData.source.at(i);
|
||||
const QSharedPointer<VGObject> obj = initData.data->GetGObject(idObject);
|
||||
|
||||
// This check helps to find missed objects in the switch
|
||||
|
|
|
@ -130,9 +130,9 @@ VToolFlippingByAxis *VToolFlippingByAxis::Create(VToolFlippingByAxisInitData ini
|
|||
InitOperationToolConnections(initData.scene, tool);
|
||||
VAbstractPattern::AddTool(initData.id, tool);
|
||||
initData.doc->IncrementReferens(originPoint.getIdTool());
|
||||
for (int i = 0; i < initData.source.size(); ++i)
|
||||
for (auto idObject : qAsConst(initData.source))
|
||||
{
|
||||
initData.doc->IncrementReferens(initData.data->GetGObject(initData.source.at(i))->getIdTool());
|
||||
initData.doc->IncrementReferens(initData.data->GetGObject(idObject)->getIdTool());
|
||||
}
|
||||
return tool;
|
||||
}
|
||||
|
|
|
@ -124,9 +124,9 @@ VToolFlippingByLine *VToolFlippingByLine::Create(VToolFlippingByLineInitData ini
|
|||
VAbstractPattern::AddTool(initData.id, tool);
|
||||
initData.doc->IncrementReferens(firstPoint.getIdTool());
|
||||
initData.doc->IncrementReferens(secondPoint.getIdTool());
|
||||
for (int i = 0; i < initData.source.size(); ++i)
|
||||
for (auto idObject : qAsConst(initData.source))
|
||||
{
|
||||
initData.doc->IncrementReferens(initData.data->GetGObject(initData.source.at(i))->getIdTool());
|
||||
initData.doc->IncrementReferens(initData.data->GetGObject(idObject)->getIdTool());
|
||||
}
|
||||
return tool;
|
||||
}
|
||||
|
|
|
@ -519,26 +519,26 @@ void VAbstractOperation::SaveSourceDestination(QDomElement &tag)
|
|||
doc->RemoveAllChildren(tag);
|
||||
|
||||
QDomElement tagObjects = doc->createElement(TagSource);
|
||||
for (int i = 0; i < source.size(); ++i)
|
||||
for (auto id : qAsConst(source))
|
||||
{
|
||||
QDomElement item = doc->createElement(TagItem);
|
||||
doc->SetAttribute(item, AttrIdObject, source.at(i));
|
||||
doc->SetAttribute(item, AttrIdObject, id);
|
||||
tagObjects.appendChild(item);
|
||||
}
|
||||
tag.appendChild(tagObjects);
|
||||
|
||||
tagObjects = doc->createElement(TagDestination);
|
||||
for (int i = 0; i < destination.size(); ++i)
|
||||
for (auto dItem : qAsConst(destination))
|
||||
{
|
||||
QDomElement item = doc->createElement(TagItem);
|
||||
doc->SetAttribute(item, AttrIdObject, destination.at(i).id);
|
||||
doc->SetAttribute(item, AttrIdObject, dItem.id);
|
||||
|
||||
if (not VFuzzyComparePossibleNulls(destination.at(i).mx, INT_MAX) &&
|
||||
not VFuzzyComparePossibleNulls(destination.at(i).my, INT_MAX))
|
||||
if (not VFuzzyComparePossibleNulls(dItem.mx, INT_MAX) &&
|
||||
not VFuzzyComparePossibleNulls(dItem.my, INT_MAX))
|
||||
{
|
||||
doc->SetAttribute(item, AttrMx, qApp->fromPixel(destination.at(i).mx));
|
||||
doc->SetAttribute(item, AttrMy, qApp->fromPixel(destination.at(i).my));
|
||||
doc->SetAttribute<bool>(item, AttrShowLabel, destination.at(i).showLabel);
|
||||
doc->SetAttribute(item, AttrMx, qApp->fromPixel(dItem.mx));
|
||||
doc->SetAttribute(item, AttrMy, qApp->fromPixel(dItem.my));
|
||||
doc->SetAttribute<bool>(item, AttrShowLabel, dItem.showLabel);
|
||||
}
|
||||
|
||||
tagObjects.appendChild(item);
|
||||
|
@ -609,9 +609,8 @@ void VAbstractOperation::AllowCurveSelecting(bool enabled, GOType type)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractOperation::InitOperatedObjects()
|
||||
{
|
||||
for (int i = 0; i < destination.size(); ++i)
|
||||
for (auto object : qAsConst(destination))
|
||||
{
|
||||
const DestinationItem object = destination.at(i);
|
||||
const QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(object.id);
|
||||
|
||||
// This check helps to find missed objects in the switch
|
||||
|
|
|
@ -82,9 +82,8 @@ QPointF GetOriginPoint(const QVector<quint32> objects, const VContainer *data, q
|
|||
{
|
||||
QPolygonF originObjects;
|
||||
|
||||
for (int i = 0; i < objects.size(); ++i)
|
||||
for (auto id : objects)
|
||||
{
|
||||
const quint32 id = objects.at(i);
|
||||
const QSharedPointer<VGObject> obj = data->GetGObject(id);
|
||||
|
||||
// This check helps to find missed objects in the switch
|
||||
|
@ -200,9 +199,8 @@ VToolMove *VToolMove::Create(VToolMoveInitData &initData)
|
|||
|
||||
initData.id = VContainer::getNextId();//Just reserve id for tool
|
||||
|
||||
for (int i = 0; i < initData.source.size(); ++i)
|
||||
for (auto idObject : qAsConst(initData.source))
|
||||
{
|
||||
const quint32 idObject = initData.source.at(i);
|
||||
const QSharedPointer<VGObject> obj = initData.data->GetGObject(idObject);
|
||||
|
||||
// This check helps to find missed objects in the switch
|
||||
|
@ -332,9 +330,9 @@ QT_WARNING_POP
|
|||
initData.doc->IncrementReferens(originPoint->getIdTool());
|
||||
}
|
||||
|
||||
for (int i = 0; i < initData.source.size(); ++i)
|
||||
for (auto idObject : qAsConst(initData.source))
|
||||
{
|
||||
initData.doc->IncrementReferens(initData.data->GetGObject(initData.source.at(i))->getIdTool());
|
||||
initData.doc->IncrementReferens(initData.data->GetGObject(idObject)->getIdTool());
|
||||
}
|
||||
return tool;
|
||||
}
|
||||
|
|
|
@ -144,9 +144,8 @@ VToolRotation *VToolRotation::Create(VToolRotationInitData &initData)
|
|||
|
||||
initData.id = VContainer::getNextId();//Just reserve id for tool
|
||||
|
||||
for (int i = 0; i < initData.source.size(); ++i)
|
||||
for (auto idObject : qAsConst(initData.source))
|
||||
{
|
||||
const quint32 idObject = initData.source.at(i);
|
||||
const QSharedPointer<VGObject> obj = initData.data->GetGObject(idObject);
|
||||
|
||||
// This check helps to find missed objects in the switch
|
||||
|
@ -259,9 +258,9 @@ QT_WARNING_POP
|
|||
InitOperationToolConnections(initData.scene, tool);
|
||||
VAbstractPattern::AddTool(initData.id, tool);
|
||||
initData.doc->IncrementReferens(originPoint.getIdTool());
|
||||
for (int i = 0; i < initData.source.size(); ++i)
|
||||
for (auto idObject : qAsConst(initData.source))
|
||||
{
|
||||
initData.doc->IncrementReferens(initData.data->GetGObject(initData.source.at(i))->getIdTool());
|
||||
initData.doc->IncrementReferens(initData.data->GetGObject(idObject)->getIdTool());
|
||||
}
|
||||
return tool;
|
||||
}
|
||||
|
|
|
@ -442,9 +442,9 @@ void VAbstractSpline::InitDefShape()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractSpline::ShowHandles(bool show)
|
||||
{
|
||||
for (int i = 0; i < controlPoints.size(); ++i)
|
||||
for (auto point : qAsConst(controlPoints))
|
||||
{
|
||||
controlPoints.at(i)->setVisible(show);
|
||||
point->setVisible(show);
|
||||
}
|
||||
update();// Show direction
|
||||
}
|
||||
|
|
|
@ -300,9 +300,9 @@ void VToolSeamAllowance::AddCSARecords(VAbstractPattern *doc, QDomElement &domEl
|
|||
if (records.size() > 0)
|
||||
{
|
||||
QDomElement csaRecordsElement = doc->createElement(VToolSeamAllowance::TagCSA);
|
||||
for (int i = 0; i < records.size(); ++i)
|
||||
for (auto record : records)
|
||||
{
|
||||
AddCSARecord(doc, csaRecordsElement, records.at(i));
|
||||
AddCSARecord(doc, csaRecordsElement, record);
|
||||
}
|
||||
domElement.appendChild(csaRecordsElement);
|
||||
}
|
||||
|
@ -314,10 +314,10 @@ void VToolSeamAllowance::AddInternalPaths(VAbstractPattern *doc, QDomElement &do
|
|||
if (paths.size() > 0)
|
||||
{
|
||||
QDomElement iPathsElement = doc->createElement(VToolSeamAllowance::TagIPaths);
|
||||
for (int i = 0; i < paths.size(); ++i)
|
||||
for (auto path : paths)
|
||||
{
|
||||
QDomElement recordNode = doc->createElement(VToolSeamAllowance::TagRecord);
|
||||
doc->SetAttribute(recordNode, VAbstractPattern::AttrPath, paths.at(i));
|
||||
doc->SetAttribute(recordNode, VAbstractPattern::AttrPath, path);
|
||||
iPathsElement.appendChild(recordNode);
|
||||
}
|
||||
domElement.appendChild(iPathsElement);
|
||||
|
@ -1332,12 +1332,12 @@ void VToolSeamAllowance::UpdateExcludeState()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolSeamAllowance::UpdateInternalPaths()
|
||||
{
|
||||
const VPiece detail = VAbstractTool::data.GetPiece(m_id);
|
||||
for (int i = 0; i < detail.GetInternalPaths().size(); ++i)
|
||||
const QVector<quint32> paths = VAbstractTool::data.GetPiece(m_id).GetInternalPaths();
|
||||
for (auto path : paths)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (auto *tool = qobject_cast<VToolPiecePath*>(VAbstractPattern::getTool(detail.GetInternalPaths().at(i))))
|
||||
if (auto *tool = qobject_cast<VToolPiecePath*>(VAbstractPattern::getTool(path)))
|
||||
{
|
||||
tool->RefreshGeometry();
|
||||
}
|
||||
|
@ -1766,18 +1766,20 @@ void VToolSeamAllowance::InitNode(const VPieceNode &node, VMainGraphicsScene *sc
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolSeamAllowance::InitCSAPaths(const VPiece &detail) const
|
||||
{
|
||||
for (int i = 0; i < detail.GetCustomSARecords().size(); ++i)
|
||||
const QVector<CustomSARecord> records = detail.GetCustomSARecords();
|
||||
for (auto record : records)
|
||||
{
|
||||
doc->IncrementReferens(detail.GetCustomSARecords().at(i).path);
|
||||
doc->IncrementReferens(record.path);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolSeamAllowance::InitInternalPaths(const VPiece &detail)
|
||||
{
|
||||
for (int i = 0; i < detail.GetInternalPaths().size(); ++i)
|
||||
const QVector<quint32> paths = detail.GetInternalPaths();
|
||||
for (auto path : paths)
|
||||
{
|
||||
auto *tool = qobject_cast<VToolPiecePath*>(VAbstractPattern::getTool(detail.GetInternalPaths().at(i)));
|
||||
auto *tool = qobject_cast<VToolPiecePath*>(VAbstractPattern::getTool(path));
|
||||
SCASSERT(tool != nullptr);
|
||||
|
||||
if (tool->parent() != this)
|
||||
|
@ -1786,16 +1788,16 @@ void VToolSeamAllowance::InitInternalPaths(const VPiece &detail)
|
|||
tool->SetParentType(ParentType::Item);
|
||||
}
|
||||
tool->show();
|
||||
doc->IncrementReferens(detail.GetInternalPaths().at(i));
|
||||
doc->IncrementReferens(path);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolSeamAllowance::InitSpecialPoints(const QVector<quint32> &points) const
|
||||
{
|
||||
for (int i = 0; i < points.size(); ++i)
|
||||
for (auto point : points)
|
||||
{
|
||||
doc->IncrementReferens(points.at(i));
|
||||
doc->IncrementReferens(point);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1913,10 +1915,10 @@ void VToolSeamAllowance::AddPointRecords(VAbstractPattern *doc, QDomElement &dom
|
|||
if (records.size() > 0)
|
||||
{
|
||||
QDomElement pinsElement = doc->createElement(tag);
|
||||
for (int i = 0; i < records.size(); ++i)
|
||||
for (auto record : records)
|
||||
{
|
||||
QDomElement recordNode = doc->createElement(VToolSeamAllowance::TagRecord);
|
||||
recordNode.appendChild(doc->createTextNode(QString().setNum(records.at(i))));
|
||||
recordNode.appendChild(doc->createTextNode(QString().setNum(record)));
|
||||
pinsElement.appendChild(recordNode);
|
||||
}
|
||||
domElement.appendChild(pinsElement);
|
||||
|
|
|
@ -813,10 +813,10 @@ void SaveChildren(VAbstractPattern *doc, quint32 id, QDomElement section, const
|
|||
{
|
||||
if (children.size() > 0)
|
||||
{
|
||||
for (int i=0; i<children.size(); ++i)
|
||||
for (auto child : children)
|
||||
{
|
||||
QDomElement tagChild = doc->createElement(VToolUnionDetails::TagChild);
|
||||
tagChild.appendChild(doc->createTextNode(QString().setNum(children.at(i))));
|
||||
tagChild.appendChild(doc->createTextNode(QString().setNum(child)));
|
||||
section.appendChild(tagChild);
|
||||
}
|
||||
|
||||
|
@ -1131,21 +1131,20 @@ void CreateUnitedNodes(VPiece &newDetail, const VPiece &d1, const VPiece &d2, co
|
|||
const VPiecePath d1Path = d1.GetPath().RemoveEdge(initData.indexD1);
|
||||
const VPiecePath d2Path = d2.GetPath().RemoveEdge(initData.indexD2);
|
||||
|
||||
const QVector<QPair<bool, VPieceNode> > unitedPath = VToolUnionDetails::CalcUnitedPath(d1Path, d2Path,
|
||||
initData.indexD2, pRotate);
|
||||
const auto unitedPath = VToolUnionDetails::CalcUnitedPath(d1Path, d2Path, initData.indexD2, pRotate);
|
||||
|
||||
QVector<quint32> children;
|
||||
VPiecePath newPath;
|
||||
|
||||
for (int i=0; i < unitedPath.size(); ++i)
|
||||
for (auto &path : unitedPath)
|
||||
{
|
||||
if (unitedPath.at(i).first)
|
||||
if (path.first)
|
||||
{// first piece
|
||||
AddNodeToNewPath(initData, newPath, unitedPath.at(i).second, children, drawName);
|
||||
AddNodeToNewPath(initData, newPath, path.second, children, drawName);
|
||||
}
|
||||
else
|
||||
{// second piece
|
||||
AddNodeToNewPath(initData, newPath, unitedPath.at(i).second, children, drawName, dx, dy, pRotate, angle);
|
||||
AddNodeToNewPath(initData, newPath, path.second, children, drawName, dx, dy, pRotate, angle);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1204,9 +1203,10 @@ void CreateUnitedDetailCSA(VPiece &newDetail, const VPiece &d, QVector<quint32>
|
|||
void CreateUnitedCSA(VPiece &newDetail, const VPiece &d1, const VPiece &d2, const QString &drawName,
|
||||
const VToolUnionDetailsInitData &initData, qreal dx, qreal dy, quint32 pRotate, qreal angle)
|
||||
{
|
||||
for (int i = 0; i < d1.GetCustomSARecords().size(); ++i)
|
||||
const QVector<CustomSARecord> records = d1.GetCustomSARecords();
|
||||
for (auto record : records)
|
||||
{
|
||||
newDetail.GetCustomSARecords().append(d1.GetCustomSARecords().at(i));
|
||||
newDetail.GetCustomSARecords().append(record);
|
||||
}
|
||||
|
||||
QVector<quint32> children;
|
||||
|
@ -1264,9 +1264,10 @@ void CreateUnitedInternalPaths(VPiece &newDetail, const VPiece &d1, const VPiece
|
|||
const VToolUnionDetailsInitData &initData, qreal dx, qreal dy, quint32 pRotate,
|
||||
qreal angle)
|
||||
{
|
||||
for (int i = 0; i < d1.GetInternalPaths().size(); ++i)
|
||||
const QVector<quint32> paths = d1.GetInternalPaths();
|
||||
for (auto path : paths)
|
||||
{
|
||||
newDetail.GetInternalPaths().append(d1.GetInternalPaths().at(i));
|
||||
newDetail.GetInternalPaths().append(path);
|
||||
}
|
||||
|
||||
QVector<quint32> children;
|
||||
|
@ -1309,9 +1310,10 @@ void CreateUnitedDetailPlaceLabels(VPiece &newDetail, const VPiece &d, QVector<q
|
|||
void CreateUnitedPins(VPiece &newDetail, const VPiece &d1, const VPiece &d2, const QString &drawName,
|
||||
const VToolUnionDetailsInitData &initData, qreal dx, qreal dy, quint32 pRotate, qreal angle)
|
||||
{
|
||||
for (int i = 0; i < d1.GetPins().size(); ++i)
|
||||
const auto pins = d1.GetPins();
|
||||
for (auto pin : pins)
|
||||
{
|
||||
newDetail.GetPins().append(d1.GetPins().at(i));
|
||||
newDetail.GetPins().append(pin);
|
||||
}
|
||||
|
||||
QVector<quint32> children;
|
||||
|
@ -1324,9 +1326,10 @@ void CreateUnitedPlaceLabels(VPiece &newDetail, const VPiece &d1, const VPiece &
|
|||
const VToolUnionDetailsInitData &initData, qreal dx, qreal dy, quint32 pRotate,
|
||||
qreal angle)
|
||||
{
|
||||
for (int i = 0; i < d1.GetPlaceLabels().size(); ++i)
|
||||
const auto labels = d1.GetPlaceLabels();
|
||||
for (auto label : labels)
|
||||
{
|
||||
newDetail.GetPlaceLabels().append(d1.GetPlaceLabels().at(i));
|
||||
newDetail.GetPlaceLabels().append(label);
|
||||
}
|
||||
|
||||
QVector<quint32> children;
|
||||
|
@ -1352,19 +1355,17 @@ void UpdateUnitedNodes(const VToolUnionDetailsInitData &initData, qreal dx, qrea
|
|||
"Time to refactor the code.");
|
||||
if (children.size() == countNodeD1 + countNodeD2-1)
|
||||
{
|
||||
const QVector<QPair<bool, VPieceNode> > unitedPath = VToolUnionDetails::CalcUnitedPath(d1REPath, d2REPath,
|
||||
initData.indexD2,
|
||||
pRotate);
|
||||
const auto unitedPath = VToolUnionDetails::CalcUnitedPath(d1REPath, d2REPath, initData.indexD2, pRotate);
|
||||
|
||||
for (int i=0; i < unitedPath.size(); ++i)
|
||||
for (auto path : unitedPath)
|
||||
{
|
||||
if (unitedPath.at(i).first)
|
||||
if (path.first)
|
||||
{// first piece
|
||||
UpdatePathNode(initData.data, unitedPath.at(i).second, children);
|
||||
UpdatePathNode(initData.data, path.second, children);
|
||||
}
|
||||
else
|
||||
{// second piece
|
||||
UpdatePathNode(initData.data, unitedPath.at(i).second, children, dx, dy, pRotate, angle);
|
||||
UpdatePathNode(initData.data, path.second, children, dx, dy, pRotate, angle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1402,9 +1403,9 @@ void UpdateUnitedNodes(const VToolUnionDetailsInitData &initData, qreal dx, qrea
|
|||
void UpdateUnitedDetailPaths(const VToolUnionDetailsInitData &initData, qreal dx, qreal dy, quint32 pRotate,
|
||||
qreal angle, const QVector<quint32> &records, QVector<quint32> children)
|
||||
{
|
||||
for (int i=0; i < records.size(); ++i)
|
||||
for (auto record : records)
|
||||
{
|
||||
const VPiecePath path = initData.data->GetPiecePath(records.at(i));
|
||||
const VPiecePath path = initData.data->GetPiecePath(record);
|
||||
|
||||
if (initData.version == 1)
|
||||
{
|
||||
|
@ -1444,9 +1445,9 @@ void UpdateUnitedDetailCSA(const VToolUnionDetailsInitData &initData, qreal dx,
|
|||
qreal angle, const QVector<CustomSARecord> &records)
|
||||
{
|
||||
QVector<quint32> idRecords;
|
||||
for (int i = 0; i < records.size(); ++i)
|
||||
for (auto record : records)
|
||||
{
|
||||
idRecords.append(records.at(i).path);
|
||||
idRecords.append(record.path);
|
||||
}
|
||||
UpdateUnitedDetailPaths(initData, dx, dy, pRotate, angle, idRecords, GetCSAChildren(initData.doc, initData.id));
|
||||
}
|
||||
|
@ -1465,9 +1466,9 @@ void UpdateUnitedDetailPins(const VToolUnionDetailsInitData &initData, qreal dx,
|
|||
{
|
||||
QVector<quint32> children = GetPinChildren(initData.doc, initData.id);
|
||||
|
||||
for (int i = 0; i < records.size(); ++i)
|
||||
for (auto record : records)
|
||||
{
|
||||
QScopedPointer<VPointF> point(new VPointF(*initData.data->GeometricObject<VPointF>(records.at(i))));
|
||||
QScopedPointer<VPointF> point(new VPointF(*initData.data->GeometricObject<VPointF>(record)));
|
||||
point->setMode(Draw::Modeling);
|
||||
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID)
|
||||
{
|
||||
|
@ -1484,9 +1485,9 @@ void UpdateUnitedDetailPlaceLabels(const VToolUnionDetailsInitData &initData, qr
|
|||
{
|
||||
QVector<quint32> children = GetPlaceLabelChildren(initData.doc, initData.id);
|
||||
|
||||
for (int i = 0; i < records.size(); ++i)
|
||||
for (auto record : records)
|
||||
{
|
||||
QSharedPointer<VPlaceLabelItem> parentLabel = initData.data->GeometricObject<VPlaceLabelItem>(records.at(i));
|
||||
QSharedPointer<VPlaceLabelItem> parentLabel = initData.data->GeometricObject<VPlaceLabelItem>(record);
|
||||
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID)
|
||||
{
|
||||
BiasRotatePoint(parentLabel.data(), dx, dy,
|
||||
|
|
|
@ -104,9 +104,8 @@ void VisOperation::RefreshFlippedObjects(const QPointF &firstPoint, const QPoint
|
|||
{
|
||||
int iPoint = -1;
|
||||
int iCurve = -1;
|
||||
for (int i = 0; i < objects.size(); ++i)
|
||||
for (auto id : qAsConst(objects))
|
||||
{
|
||||
const quint32 id = objects.at(i);
|
||||
const QSharedPointer<VGObject> obj = Visualization::data->GetGObject(id);
|
||||
|
||||
// This check helps to find missed objects in the switch
|
||||
|
|
|
@ -271,9 +271,8 @@ int VisToolMove::AddMovedRotatedCurve(qreal angle, qreal length, quint32 id, int
|
|||
QPointF VisToolMove::GetOriginPoint(const QVector<QGraphicsItem *> &objects)
|
||||
{
|
||||
QRectF boundingRect;
|
||||
for (int i=0; i < objects.size(); ++i)
|
||||
for (auto object : qAsConst(objects))
|
||||
{
|
||||
QGraphicsItem *object = objects.at(i);
|
||||
if (object)
|
||||
{
|
||||
QRectF childrenRect = object->childrenBoundingRect();
|
||||
|
@ -300,9 +299,8 @@ QVector<QGraphicsItem *> VisToolMove::CreateOriginObjects(int &iPoint, int &iCur
|
|||
{
|
||||
QVector<QGraphicsItem *> originObjects;
|
||||
|
||||
for (int i = 0; i < objects.size(); ++i)
|
||||
for (auto id : qAsConst(objects))
|
||||
{
|
||||
const quint32 id = objects.at(i);
|
||||
const QSharedPointer<VGObject> obj = Visualization::data->GetGObject(id);
|
||||
|
||||
// This check helps to find missed objects in the switch
|
||||
|
@ -358,9 +356,8 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
|||
void VisToolMove::CreateMovedRotatedObjects(int &iPoint, int &iCurve, qreal length, qreal angle, qreal rotationAngle,
|
||||
const QPointF &rotationOrigin)
|
||||
{
|
||||
for (int i = 0; i < objects.size(); ++i)
|
||||
for (auto id : qAsConst(objects))
|
||||
{
|
||||
const quint32 id = objects.at(i);
|
||||
const QSharedPointer<VGObject> obj = Visualization::data->GetGObject(id);
|
||||
|
||||
// This check helps to find missed objects in the switch
|
||||
|
|
|
@ -125,9 +125,8 @@ void VisToolRotation::RefreshGeometry()
|
|||
|
||||
int iPoint = -1;
|
||||
int iCurve = -1;
|
||||
for (int i = 0; i < objects.size(); ++i)
|
||||
for (auto id : qAsConst(objects))
|
||||
{
|
||||
const quint32 id = objects.at(i);
|
||||
const QSharedPointer<VGObject> obj = Visualization::data->GetGObject(id);
|
||||
|
||||
// This check helps to find missed objects in the switch
|
||||
|
|
|
@ -87,9 +87,9 @@ VSimplePoint *VisPieceSpecialPoints::GetPoint(quint32 i, const QColor &color)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisPieceSpecialPoints::HideAllItems()
|
||||
{
|
||||
for (int i=0; i < m_points.size(); ++i)
|
||||
for (auto item : qAsConst(m_points))
|
||||
{
|
||||
if (QGraphicsEllipseItem *item = m_points.at(i))
|
||||
if (item)
|
||||
{
|
||||
item->setVisible(false);
|
||||
}
|
||||
|
|
|
@ -99,9 +99,9 @@ void VisToolPiecePath::HideAllItems()
|
|||
m_line->setVisible(false);
|
||||
}
|
||||
|
||||
for (int i=0; i < m_points.size(); ++i)
|
||||
for (auto item : qAsConst(m_points))
|
||||
{
|
||||
if (QGraphicsEllipseItem *item = m_points.at(i))
|
||||
if (item)
|
||||
{
|
||||
item->setVisible(false);
|
||||
}
|
||||
|
|
|
@ -486,14 +486,13 @@ void VMainGraphicsView::mousePressEvent(QMouseEvent *event)
|
|||
emit itemClicked(nullptr);
|
||||
break;
|
||||
}
|
||||
for (int i = 0; i < list.size(); ++i)
|
||||
for (auto item : list)
|
||||
{
|
||||
if (this->scene()->items().contains(list.at(i)))
|
||||
if (this->scene()->items().contains(item))
|
||||
{
|
||||
if (list.at(i)->type() > QGraphicsItem::UserType &&
|
||||
list.at(i)->type() <= VSimpleCurve::Type)
|
||||
if (item->type() > QGraphicsItem::UserType && item->type() <= VSimpleCurve::Type)
|
||||
{
|
||||
emit itemClicked(list.at(i));
|
||||
emit itemClicked(item);
|
||||
break;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -231,10 +231,10 @@ void TST_BuitInRegExp::TestTemplatePlaceholders()
|
|||
QSet<QString> originals;
|
||||
QSet<QString> translations;
|
||||
|
||||
for (int i = 0; i < labelTemplatePlaceholders.size(); ++i)
|
||||
for (auto &placeholder : labelTemplatePlaceholders)
|
||||
{
|
||||
originals.insert(labelTemplatePlaceholders.at(i));
|
||||
translations.insert(m_trMs->PlaceholderToUser(labelTemplatePlaceholders.at(i)));
|
||||
originals.insert(placeholder);
|
||||
translations.insert(m_trMs->PlaceholderToUser(placeholder));
|
||||
}
|
||||
|
||||
QCOMPARE(originals.size(), labelTemplatePlaceholders.size()); // All tags are unique
|
||||
|
|
|
@ -299,19 +299,19 @@ void TST_TSLocaleTranslation::TestHTMLTags()
|
|||
<< QLatin1String("html")
|
||||
<< QLatin1String("body");
|
||||
static const QString pattern("{1}.*>");
|
||||
for (int i=0; i < tags.size(); ++i)
|
||||
for (auto &tag : tags)
|
||||
{
|
||||
const QRegularExpression openRegex(QLatin1String("<") + tags.at(i) + pattern,
|
||||
const QRegularExpression openRegex(QLatin1String("<") + tag + pattern,
|
||||
QRegularExpression::DotMatchesEverythingOption);
|
||||
if (source.contains(openRegex))
|
||||
{
|
||||
const int countOpenTag = source.count(openRegex);
|
||||
const QRegularExpression closeRegex(QLatin1String("</") + tags.at(i) + pattern,
|
||||
const QRegularExpression closeRegex(QLatin1String("</") + tag + pattern,
|
||||
QRegularExpression::DotMatchesEverythingOption);
|
||||
const int countCloseTag = translation.count(closeRegex);
|
||||
if (not translation.contains(closeRegex) || countCloseTag != countOpenTag)
|
||||
{
|
||||
const QString message = QString("Tag mismatch. Tag: '<%1>'. ").arg(tags.at(i)) +
|
||||
const QString message = QString("Tag mismatch. Tag: '<%1>'. ").arg(tag) +
|
||||
QString("Original name:'%1'").arg(source) + QString(", translated name:'%1'").arg(translation);
|
||||
QFAIL(qUtf8Printable(message));
|
||||
}
|
||||
|
|
|
@ -180,9 +180,9 @@ void TST_VArc::TestGetPoints()
|
|||
{
|
||||
const qreal epsRadius = 1.5; // computing error
|
||||
|
||||
for (int i=0; i < points.size(); ++i)
|
||||
for (auto point : points)
|
||||
{
|
||||
QLineF rLine(static_cast<QPointF>(center), points.at(i));
|
||||
QLineF rLine(static_cast<QPointF>(center), point);
|
||||
const qreal value = qAbs(rLine.length() - radius);
|
||||
const QString errorMsg = QString("Broken the first rule. All points should be on the same distance from "
|
||||
"the center. Error ='%1'.").arg(value);
|
||||
|
|
|
@ -281,9 +281,8 @@ void TST_VEllipticalArc::TestGetPoints1()
|
|||
{ // equation of ellipse will be different when rotation angle isn't 0 so we can't use this test in this case
|
||||
const qreal eps = 0.05;
|
||||
|
||||
for (int i=0; i < points.size(); ++i)
|
||||
for (auto p : points)
|
||||
{
|
||||
QPointF p = points.at(i);
|
||||
const qreal equationRes = p.rx()*p.rx()/(radius1*radius1) + p.ry()*p.ry()/(radius2*radius2);
|
||||
const qreal diff = qAbs(equationRes - 1);
|
||||
const QString errorMsg = QString("Broken the first rule. Any point must satisfy the equation of ellipse."
|
||||
|
|
|
@ -65,9 +65,9 @@ void TST_VPoster::BigPoster()
|
|||
|
||||
QCOMPARE(poster.size(), 12);
|
||||
|
||||
for (int i=0; i < poster.size(); i++)
|
||||
for (auto p : poster)
|
||||
{
|
||||
QCOMPARE(poster.at(i).rect.size(), PageRect(printer).size());
|
||||
QCOMPARE(p.rect.size(), PageRect(printer).size());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user