Merged dismine/valentina into develop
--HG-- branch : develop
This commit is contained in:
commit
a56c41589c
|
@ -41,6 +41,8 @@ win32 {
|
|||
../../../dist/win/msvcr120.dll
|
||||
}
|
||||
|
||||
DEFINES += QT_NO_FOREACH
|
||||
|
||||
macx{
|
||||
# QTBUG-31034 qmake doesn't allow override QMAKE_CXX
|
||||
CONFIG+=no_ccache
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
@ -526,6 +526,15 @@ void TMainWindow::ToolBarStyles()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TMainWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
#if defined(Q_OS_MAC)
|
||||
// Workaround for Qt bug https://bugreports.qt.io/browse/QTBUG-43344
|
||||
static int numCalled = 0;
|
||||
if (numCalled++ >= 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (MaybeSave())
|
||||
{
|
||||
WriteSettings();
|
||||
|
@ -970,8 +979,11 @@ void TMainWindow::ImportDataFromCSV()
|
|||
const QString filters = tr("Comma-Separated Values") + QLatin1String(" (*.csv)");
|
||||
const QString suffix("csv");
|
||||
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Import from CSV"), QDir::homePath(), filters, nullptr,
|
||||
QFileDialog::DontUseNativeDialog);
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Import from CSV"), QDir::homePath(), filters, nullptr
|
||||
#ifdef Q_OS_LINUX
|
||||
, QFileDialog::DontUseNativeDialog
|
||||
#endif
|
||||
);
|
||||
|
||||
if (fileName.isEmpty())
|
||||
{
|
||||
|
@ -1354,15 +1366,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);
|
||||
|
@ -1373,18 +1385,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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1448,9 +1460,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
|
||||
|
@ -1458,10 +1470,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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2843,12 +2855,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;
|
||||
}
|
||||
|
@ -2984,7 +2996,7 @@ void TMainWindow::CreateWindowMenu(QMenu *menu)
|
|||
SCASSERT(menu != nullptr)
|
||||
|
||||
QAction *action = menu->addAction(tr("&New Window"));
|
||||
connect(action, &QAction::triggered, this, [this]()
|
||||
connect(action, &QAction::triggered, this, []()
|
||||
{
|
||||
qApp->NewMainWindow();
|
||||
qApp->MainWindow()->activateWindow();
|
||||
|
@ -3214,18 +3226,18 @@ void TMainWindow::ImportIndividualMeasurements(const QxtCsvModel &csv)
|
|||
}
|
||||
}
|
||||
|
||||
for(int i=0; i < measurements.size(); ++i)
|
||||
for(auto im : qAsConst(measurements))
|
||||
{
|
||||
m->AddEmpty(measurements.at(i).name, measurements.at(i).value);
|
||||
m->AddEmpty(im.name, im.value);
|
||||
|
||||
if (not measurements.at(i).fullName.isEmpty())
|
||||
if (not im.fullName.isEmpty())
|
||||
{
|
||||
m->SetMFullName(measurements.at(i).name, measurements.at(i).fullName);
|
||||
m->SetMFullName(im.name, im.fullName);
|
||||
}
|
||||
|
||||
if (not measurements.at(i).description.isEmpty())
|
||||
if (not im.description.isEmpty())
|
||||
{
|
||||
m->SetMDescription(measurements.at(i).name, measurements.at(i).description);
|
||||
m->SetMDescription(im.name, im.description);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3244,7 +3256,7 @@ void TMainWindow::ImportMultisizeMeasurements(const QxtCsvModel &csv)
|
|||
return;
|
||||
}
|
||||
|
||||
auto ConverToDouble = [this](QString text, const QString &error)
|
||||
auto ConverToDouble = [](QString text, const QString &error)
|
||||
{
|
||||
text = VTranslateVars::TryFormulaFromUser(text, qApp->Settings()->GetOsSeparator());
|
||||
bool ok = false;
|
||||
|
@ -3324,21 +3336,21 @@ void TMainWindow::ImportMultisizeMeasurements(const QxtCsvModel &csv)
|
|||
}
|
||||
}
|
||||
|
||||
for(int i=0; i < measurements.size(); ++i)
|
||||
for(auto mm : qAsConst(measurements))
|
||||
{
|
||||
m->AddEmpty(measurements.at(i).name);
|
||||
m->SetMBaseValue(measurements.at(i).name, measurements.at(i).base);
|
||||
m->SetMSizeIncrease(measurements.at(i).name, measurements.at(i).sizeIncrease);
|
||||
m->SetMHeightIncrease(measurements.at(i).name, measurements.at(i).heightIncrease);
|
||||
m->AddEmpty(mm.name);
|
||||
m->SetMBaseValue(mm.name, mm.base);
|
||||
m->SetMSizeIncrease(mm.name, mm.sizeIncrease);
|
||||
m->SetMHeightIncrease(mm.name, mm.heightIncrease);
|
||||
|
||||
if (not measurements.at(i).fullName.isEmpty())
|
||||
if (not mm.fullName.isEmpty())
|
||||
{
|
||||
m->SetMFullName(measurements.at(i).name, measurements.at(i).fullName);
|
||||
m->SetMFullName(mm.name, mm.fullName);
|
||||
}
|
||||
|
||||
if (not measurements.at(i).description.isEmpty())
|
||||
if (not mm.description.isEmpty())
|
||||
{
|
||||
m->SetMDescription(measurements.at(i).name, measurements.at(i).description);
|
||||
m->SetMDescription(mm.name, mm.description);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -139,8 +139,8 @@ VPE::VProperty *VFormulaProperty::clone(bool include_children, VProperty *contai
|
|||
|
||||
if (!include_children)
|
||||
{
|
||||
QList<VProperty*> tmpChildren = container->getChildren();
|
||||
foreach (VProperty* tmpChild, tmpChildren)
|
||||
const QList<VProperty*> tmpChildren = container->getChildren();
|
||||
for (auto tmpChild : tmpChildren)
|
||||
{
|
||||
container->removeChild(tmpChild);
|
||||
delete tmpChild;
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <QColorDialog>
|
||||
#include <QDebug>
|
||||
#include <QRegularExpression>
|
||||
#include <QSpacerItem>
|
||||
|
||||
#include "../vpropertyexplorer/vproperty.h"
|
||||
#include "../vtools/dialogs/support/dialogeditwrongformula.h"
|
||||
|
@ -42,7 +43,7 @@
|
|||
// VFormulaPropertyEditor
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VFormulaPropertyEditor::VFormulaPropertyEditor(QWidget *parent)
|
||||
: QWidget(parent), formula(VFormula()), ToolButton(nullptr), TextLabel(nullptr), Spacer(nullptr)
|
||||
: QWidget(parent), formula(VFormula()), ToolButton(nullptr), TextLabel(nullptr)
|
||||
{
|
||||
setAutoFillBackground(true);
|
||||
|
||||
|
@ -61,15 +62,13 @@ VFormulaPropertyEditor::VFormulaPropertyEditor(QWidget *parent)
|
|||
TextLabel = new QLabel(this);
|
||||
TextLabel->setText(formula.getStringValue());
|
||||
|
||||
// Spacer (this is needed for proper display of the label and button)
|
||||
Spacer = new QSpacerItem(1, 0, QSizePolicy::Expanding, QSizePolicy::Ignored);
|
||||
|
||||
// The layout (a horizontal layout)
|
||||
QHBoxLayout* layout = new QHBoxLayout(this);
|
||||
layout->setSpacing(3);
|
||||
layout->setMargin(0);
|
||||
layout->addWidget(TextLabel);
|
||||
layout->addItem(Spacer);
|
||||
// Spacer (this is needed for proper display of the label and button)
|
||||
layout->addSpacerItem(new QSpacerItem(1000000000, 0, QSizePolicy::Expanding, QSizePolicy::Expanding));
|
||||
layout->addWidget(ToolButton);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include <QToolButton>
|
||||
#include <QLineEdit>
|
||||
#include <QLabel>
|
||||
#include <QSpacerItem>
|
||||
|
||||
#include "../vpatterndb/vformula.h"
|
||||
|
||||
|
@ -72,7 +71,6 @@ private:
|
|||
VFormula formula;
|
||||
QToolButton* ToolButton;
|
||||
QLabel* TextLabel;
|
||||
QSpacerItem* Spacer;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -148,7 +148,10 @@ void PreferencesPathPage::EditPath()
|
|||
const QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), path,
|
||||
QFileDialog::ShowDirsOnly
|
||||
| QFileDialog::DontResolveSymlinks
|
||||
| QFileDialog::DontUseNativeDialog);
|
||||
#ifdef Q_OS_LINUX
|
||||
| QFileDialog::DontUseNativeDialog
|
||||
#endif
|
||||
);
|
||||
if (dir.isEmpty())
|
||||
{
|
||||
if (usedNotExistedDir)
|
||||
|
|
|
@ -61,7 +61,7 @@ DialogAboutApp::DialogAboutApp(QWidget *parent) :
|
|||
|
||||
|
||||
ui->pushButton_Web_Site->setText(tr("Web site : %1").arg(VER_COMPANYDOMAIN_STR));
|
||||
connect(ui->pushButton_Web_Site, &QPushButton::clicked, this, [this]()
|
||||
connect(ui->pushButton_Web_Site, &QPushButton::clicked, this, []()
|
||||
{
|
||||
if ( QDesktopServices::openUrl(QUrl(VER_COMPANYDOMAIN_STR)) == false)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -585,15 +585,14 @@ bool DialogIncrements::IncrementUsed(const QString &name) const
|
|||
{
|
||||
const QVector<VFormulaField> expressions = doc->ListExpressions();
|
||||
|
||||
for(int i = 0; i < expressions.size(); ++i)
|
||||
for(auto field : expressions)
|
||||
{
|
||||
if (expressions.at(i).expression.indexOf(name) != -1)
|
||||
if (field.expression.indexOf(name) != -1)
|
||||
{
|
||||
// Eval formula
|
||||
try
|
||||
{
|
||||
QScopedPointer<qmu::QmuTokenParser> cal(new qmu::QmuTokenParser(expressions.at(i).expression, false,
|
||||
false));
|
||||
QScopedPointer<qmu::QmuTokenParser> cal(new qmu::QmuTokenParser(field.expression, false, false));
|
||||
|
||||
// Tokens (variables, measurements)
|
||||
if (cal->GetTokens().values().contains(name))
|
||||
|
@ -728,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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -746,9 +746,9 @@ void DialogLayoutSettings::InitPrinter()
|
|||
QStringList printerNames;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 3, 0)
|
||||
const QList<QPrinterInfo> printers = QPrinterInfo::availablePrinters();
|
||||
for(int i = 0; i < printers.size(); ++i)
|
||||
for(auto printer : printers)
|
||||
{
|
||||
const QString name = printers.at(i).printerName();
|
||||
const QString name = printer.printerName();
|
||||
if (not name.isEmpty())
|
||||
{
|
||||
printerNames.append(name);
|
||||
|
|
|
@ -44,11 +44,11 @@ QStringList PrepareKnowMaterials(const QStringList &patternMaterials, bool remem
|
|||
|
||||
if (rememberPM)
|
||||
{
|
||||
for(int i=0; i < patternMaterials.size(); ++i)
|
||||
for(auto &patternMaterial : patternMaterials)
|
||||
{
|
||||
if (not patternMaterials.at(i).isEmpty() && not knownMaterials.contains(patternMaterials.at(i)))
|
||||
if (not patternMaterial.isEmpty() && not knownMaterials.contains(patternMaterial))
|
||||
{
|
||||
knownMaterials.append(patternMaterials.at(i));
|
||||
knownMaterials.append(patternMaterial);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat
|
|||
}
|
||||
ui->lineEditPathToFile->setCursorPosition(0);
|
||||
|
||||
connect(ui->pushButtonShowInExplorer, &QPushButton::clicked, this, [this]()
|
||||
connect(ui->pushButtonShowInExplorer, &QPushButton::clicked, this, []()
|
||||
{
|
||||
ShowInGraphicalShell(qApp->GetPPath());
|
||||
});
|
||||
|
@ -837,8 +837,11 @@ void DialogPatternProperties::InitImage()
|
|||
void DialogPatternProperties::ChangeImage()
|
||||
{
|
||||
const QString filter = tr("Images") + QLatin1String(" (*.png *.jpg *.jpeg *.bmp)");
|
||||
const QString fileName = QFileDialog::getOpenFileName(this, tr("Image for pattern"), QString(), filter, nullptr,
|
||||
QFileDialog::DontUseNativeDialog);
|
||||
const QString fileName = QFileDialog::getOpenFileName(this, tr("Image for pattern"), QString(), filter, nullptr
|
||||
#ifdef Q_OS_LINUX
|
||||
, QFileDialog::DontUseNativeDialog
|
||||
#endif
|
||||
);
|
||||
if (not fileName.isEmpty())
|
||||
{
|
||||
QImage image;
|
||||
|
@ -879,8 +882,11 @@ void DialogPatternProperties::SaveImage()
|
|||
QByteArray ba = QByteArray::fromBase64(byteArray);
|
||||
const QString extension = QLatin1String(".") + doc->GetImageExtension();
|
||||
QString filter = tr("Images") + QLatin1String(" (*") + extension + QLatin1String(")");
|
||||
QString filename = QFileDialog::getSaveFileName(this, tr("Save File"), tr("untitled"), filter, &filter,
|
||||
QFileDialog::DontUseNativeDialog);
|
||||
QString filename = QFileDialog::getSaveFileName(this, tr("Save File"), tr("untitled"), filter, &filter
|
||||
#ifdef Q_OS_LINUX
|
||||
, QFileDialog::DontUseNativeDialog
|
||||
#endif
|
||||
);
|
||||
if (not filename.isEmpty())
|
||||
{
|
||||
if (not filename.endsWith(extension.toUpper()))
|
||||
|
|
|
@ -95,7 +95,7 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName
|
|||
}
|
||||
}
|
||||
|
||||
foreach (auto& v, InitFormats())
|
||||
for (auto &v : InitFormats())
|
||||
{
|
||||
ui->comboBoxFormat->addItem(v.first, QVariant(static_cast<int>(v.second)));
|
||||
}
|
||||
|
@ -129,7 +129,10 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName
|
|||
const QString dir = QFileDialog::getExistingDirectory(this, tr("Select folder"), dirPath,
|
||||
QFileDialog::ShowDirsOnly
|
||||
| QFileDialog::DontResolveSymlinks
|
||||
| QFileDialog::DontUseNativeDialog);
|
||||
#ifdef Q_OS_LINUX
|
||||
| QFileDialog::DontUseNativeDialog
|
||||
#endif
|
||||
);
|
||||
if (not dir.isEmpty())
|
||||
{// If paths equal the signal will not be called, we will do this manually
|
||||
dir == ui->lineEditPath->text() ? PathChanged(dir) : ui->lineEditPath->setText(dir);
|
||||
|
|
|
@ -62,7 +62,7 @@ void VAbstractLayoutDialog::InitTemplates(QComboBox *comboBoxTemplates)
|
|||
const QString pdi = QString("(%1ppi)").arg(PrintDPI);
|
||||
|
||||
auto cntr = static_cast<VIndexType>(PaperSizeTemplate::A0);
|
||||
foreach(const auto& v, pageFormatNames)
|
||||
for(const auto& v : pageFormatNames)
|
||||
{
|
||||
if (cntr <= static_cast<int>(PaperSizeTemplate::Legal))
|
||||
{
|
||||
|
|
|
@ -1518,6 +1518,15 @@ void MainWindow::changeEvent(QEvent *event)
|
|||
*/
|
||||
void MainWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
#if defined(Q_OS_MAC)
|
||||
// Workaround for Qt bug https://bugreports.qt.io/browse/QTBUG-43344
|
||||
static int numCalled = 0;
|
||||
if (numCalled++ >= 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
qCDebug(vMainWindow, "Closing main window");
|
||||
if (MaybeSave())
|
||||
{
|
||||
|
@ -1660,8 +1669,11 @@ void MainWindow::LoadIndividual()
|
|||
usedNotExistedDir = directory.mkpath(".");
|
||||
}
|
||||
|
||||
const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter, nullptr,
|
||||
QFileDialog::DontUseNativeDialog);
|
||||
const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter, nullptr
|
||||
#ifdef Q_OS_LINUX
|
||||
, QFileDialog::DontUseNativeDialog
|
||||
#endif
|
||||
);
|
||||
|
||||
if (not mPath.isEmpty())
|
||||
{
|
||||
|
@ -1698,8 +1710,11 @@ void MainWindow::LoadMultisize()
|
|||
//Use standard path to multisize measurements
|
||||
QString path = qApp->ValentinaSettings()->GetPathMultisizeMeasurements();
|
||||
path = VCommonSettings::PrepareMultisizeTables(path);
|
||||
const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter, nullptr,
|
||||
QFileDialog::DontUseNativeDialog);
|
||||
const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter, nullptr
|
||||
#ifdef Q_OS_LINUX
|
||||
, QFileDialog::DontUseNativeDialog
|
||||
#endif
|
||||
);
|
||||
|
||||
if (not mPath.isEmpty())
|
||||
{
|
||||
|
@ -2745,7 +2760,11 @@ bool MainWindow::SaveAs()
|
|||
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"),
|
||||
dir + QLatin1String("/") + tr("pattern") + QLatin1String(".val"),
|
||||
filters, nullptr, QFileDialog::DontUseNativeDialog);
|
||||
filters, nullptr
|
||||
#ifdef Q_OS_LINUX
|
||||
, QFileDialog::DontUseNativeDialog
|
||||
#endif
|
||||
);
|
||||
|
||||
auto RemoveTempDir = [usedNotExistedDir, dir]()
|
||||
{
|
||||
|
@ -2936,8 +2955,11 @@ void MainWindow::Open()
|
|||
dir = QFileInfo(files.first()).absolutePath();
|
||||
}
|
||||
qCDebug(vMainWindow, "Run QFileDialog::getOpenFileName: dir = %s.", qUtf8Printable(dir));
|
||||
const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter, nullptr,
|
||||
QFileDialog::DontUseNativeDialog);
|
||||
const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter, nullptr
|
||||
#ifdef Q_OS_LINUX
|
||||
, QFileDialog::DontUseNativeDialog
|
||||
#endif
|
||||
);
|
||||
if (filePath.isEmpty())
|
||||
{
|
||||
return;
|
||||
|
@ -4270,19 +4292,19 @@ void MainWindow::CreateActions()
|
|||
connect(ui->actionExit, &QAction::triggered, this, &MainWindow::close);
|
||||
|
||||
connect(ui->actionPreferences, &QAction::triggered, this, &MainWindow::Preferences);
|
||||
connect(ui->actionReportBug, &QAction::triggered, this, [this]()
|
||||
connect(ui->actionReportBug, &QAction::triggered, this, []()
|
||||
{
|
||||
qCDebug(vMainWindow, "Reporting bug");
|
||||
QDesktopServices::openUrl(QUrl(QStringLiteral("https://bitbucket.org/dismine/valentina/issues/new")));
|
||||
});
|
||||
|
||||
connect(ui->actionWiki, &QAction::triggered, this, [this]()
|
||||
connect(ui->actionWiki, &QAction::triggered, this, []()
|
||||
{
|
||||
qCDebug(vMainWindow, "Showing online help");
|
||||
QDesktopServices::openUrl(QUrl(QStringLiteral("https://wiki.valentinaproject.org/wiki/Main_Page")));
|
||||
});
|
||||
|
||||
connect(ui->actionForum, &QAction::triggered, this, [this]()
|
||||
connect(ui->actionForum, &QAction::triggered, this, []()
|
||||
{
|
||||
qCDebug(vMainWindow, "Opening forum");
|
||||
QDesktopServices::openUrl(QUrl(QStringLiteral("http://valentinaproject.forumotion.me/")));
|
||||
|
@ -4635,29 +4657,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4863,21 +4885,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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5380,9 +5402,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;
|
||||
}
|
||||
|
|
|
@ -260,7 +260,7 @@ QStringList VAbstractPattern::ListMeasurements() const
|
|||
QSet<QString> measurements;
|
||||
QSet<QString> others = futureIncrements.result().toSet();
|
||||
|
||||
foreach (const QString &token, tokens)
|
||||
for (const auto &token : tokens)
|
||||
{
|
||||
if (token == QChar('-') || measurements.contains(token) || others.contains(token))
|
||||
{
|
||||
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -1677,10 +1677,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);
|
||||
}
|
||||
|
||||
|
@ -2581,10 +2581,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,13 +201,13 @@ 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) );
|
||||
foreach(const QString &val, list )
|
||||
const QList<QString> list = names.values( key );
|
||||
for(const auto &val : list)
|
||||
{
|
||||
const QDomNodeList nodeList = this->elementsByTagName(val);
|
||||
if (nodeList.isEmpty())
|
||||
|
@ -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,15 +214,15 @@ 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) );
|
||||
foreach(const QString &val, list )
|
||||
const QList<QString> list = names.values( key );
|
||||
for(const auto &val : list)
|
||||
{
|
||||
const QDomNodeList nodeList = this->elementsByTagName(val);
|
||||
if (nodeList.isEmpty())
|
||||
|
@ -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();
|
||||
|
|
|
@ -292,26 +292,26 @@ QString NameRegExp()
|
|||
QString decimalPoints;
|
||||
QString groupSeparators;
|
||||
|
||||
for(int i = 0; i < allLocales.size(); ++i)
|
||||
for(auto &locale : allLocales)
|
||||
{
|
||||
if (not positiveSigns.contains(allLocales.at(i).positiveSign()))
|
||||
if (not positiveSigns.contains(locale.positiveSign()))
|
||||
{
|
||||
positiveSigns.append(allLocales.at(i).positiveSign());
|
||||
positiveSigns.append(locale.positiveSign());
|
||||
}
|
||||
|
||||
if (not negativeSigns.contains(allLocales.at(i).negativeSign()))
|
||||
if (not negativeSigns.contains(locale.negativeSign()))
|
||||
{
|
||||
negativeSigns.append(allLocales.at(i).negativeSign());
|
||||
negativeSigns.append(locale.negativeSign());
|
||||
}
|
||||
|
||||
if (not decimalPoints.contains(allLocales.at(i).decimalPoint()))
|
||||
if (not decimalPoints.contains(locale.decimalPoint()))
|
||||
{
|
||||
decimalPoints.append(allLocales.at(i).decimalPoint());
|
||||
decimalPoints.append(locale.decimalPoint());
|
||||
}
|
||||
|
||||
if (not groupSeparators.contains(allLocales.at(i).groupSeparator()))
|
||||
if (not groupSeparators.contains(locale.groupSeparator()))
|
||||
{
|
||||
groupSeparators.append(allLocales.at(i).groupSeparator());
|
||||
groupSeparators.append(locale.groupSeparator());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
@ -622,10 +621,8 @@ bool VDxfEngine::ExportToAAMA(const QVector<VLayoutPiece> &details)
|
|||
|
||||
ExportAAMAGlobalText(input, details);
|
||||
|
||||
for(int i = 0; i < details.size(); ++i)
|
||||
for(auto &detail : details)
|
||||
{
|
||||
const VLayoutPiece &detail = details.at(i);
|
||||
|
||||
dx_ifaceBlock *detailBlock = new dx_ifaceBlock();
|
||||
|
||||
QString blockName = detail.GetName();
|
||||
|
@ -683,32 +680,29 @@ void VDxfEngine::ExportAAMADraw(dx_ifaceBlock *detailBlock, const VLayoutPiece &
|
|||
if (not detail.IsHideMainPath())
|
||||
{
|
||||
QVector<QPointF> poly = detail.GetContourPoints();
|
||||
DRW_Entity *e = AAMAPolygon(poly, "8", true);
|
||||
if (e)
|
||||
if (DRW_Entity *e = AAMAPolygon(poly, "8", true))
|
||||
{
|
||||
detailBlock->ent.push_back(e);
|
||||
}
|
||||
}
|
||||
|
||||
QVector<QVector<QPointF>> drawIntCut = detail.InternalPathsForCut(false);
|
||||
for(int j = 0; j < drawIntCut.size(); ++j)
|
||||
const QVector<QVector<QPointF>> drawIntCut = detail.InternalPathsForCut(false);
|
||||
for(auto &intCut : drawIntCut)
|
||||
{
|
||||
DRW_Entity *e = AAMAPolygon(drawIntCut.at(j), "8", false);
|
||||
if (e)
|
||||
if (DRW_Entity *e = AAMAPolygon(intCut, "8", false))
|
||||
{
|
||||
detailBlock->ent.push_back(e);
|
||||
}
|
||||
}
|
||||
|
||||
const QVector<VLayoutPlaceLabel> labels = detail.GetPlaceLabels();
|
||||
foreach(const VLayoutPlaceLabel &label, labels)
|
||||
for(auto &label : labels)
|
||||
{
|
||||
if (label.type != PlaceLabelType::Doubletree && label.type != PlaceLabelType::Button)
|
||||
{
|
||||
foreach(const QPolygonF &p, label.shape)
|
||||
for(auto &p : qAsConst(label.shape))
|
||||
{
|
||||
DRW_Entity *e = AAMAPolygon(p, "8", false);
|
||||
if (e)
|
||||
if (DRW_Entity *e = AAMAPolygon(p, "8", false))
|
||||
{
|
||||
detailBlock->ent.push_back(e);
|
||||
}
|
||||
|
@ -721,10 +715,9 @@ void VDxfEngine::ExportAAMADraw(dx_ifaceBlock *detailBlock, const VLayoutPiece &
|
|||
void VDxfEngine::ExportAAMAIntcut(dx_ifaceBlock *detailBlock, const VLayoutPiece &detail)
|
||||
{
|
||||
QVector<QVector<QPointF>> drawIntCut = detail.InternalPathsForCut(true);
|
||||
for(int j = 0; j < drawIntCut.size(); ++j)
|
||||
for(auto &intCut : drawIntCut)
|
||||
{
|
||||
DRW_Entity *e = AAMAPolygon(drawIntCut.at(j), "11", false);
|
||||
if (e)
|
||||
if (DRW_Entity *e = AAMAPolygon(intCut, "11", false))
|
||||
{
|
||||
detailBlock->ent.push_back(e);
|
||||
}
|
||||
|
@ -736,11 +729,10 @@ void VDxfEngine::ExportAAMANotch(dx_ifaceBlock *detailBlock, const VLayoutPiece
|
|||
{
|
||||
if (detail.IsSeamAllowance())
|
||||
{
|
||||
QVector<QLineF> passmarks = detail.GetPassmarks();
|
||||
for(int i = 0; i < passmarks.size(); ++i)
|
||||
const QVector<QLineF> passmarks = detail.GetPassmarks();
|
||||
for(auto passmark : passmarks)
|
||||
{
|
||||
DRW_Entity *e = AAMALine(passmarks.at(i), "4");
|
||||
if (e)
|
||||
if (DRW_Entity *e = AAMALine(passmark, "4"))
|
||||
{
|
||||
detailBlock->ent.push_back(e);
|
||||
}
|
||||
|
@ -754,8 +746,7 @@ void VDxfEngine::ExportAAMAGrainline(dx_ifaceBlock *detailBlock, const VLayoutPi
|
|||
const QVector<QPointF> grainline = detail.GetGrainline();
|
||||
if (grainline.count() > 1)
|
||||
{
|
||||
DRW_Entity *e = AAMALine(QLineF(grainline.first(), grainline.last()), "7");
|
||||
if (e)
|
||||
if (DRW_Entity *e = AAMALine(QLineF(grainline.first(), grainline.last()), "7"))
|
||||
{
|
||||
detailBlock->ent.push_back(e);
|
||||
}
|
||||
|
@ -778,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)
|
||||
|
@ -798,7 +789,7 @@ void VDxfEngine::ExportAAMADrill(dx_ifaceBlock *detailBlock, const VLayoutPiece
|
|||
{
|
||||
const QVector<VLayoutPlaceLabel> labels = detail.GetPlaceLabels();
|
||||
|
||||
foreach(const VLayoutPlaceLabel &label, labels)
|
||||
for(auto &label : labels)
|
||||
{
|
||||
if (label.type == PlaceLabelType::Doubletree || label.type == PlaceLabelType::Button)
|
||||
{
|
||||
|
@ -878,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;
|
||||
|
|
|
@ -658,13 +658,13 @@ bool VMeasurements::IsDefinedKnownNamesValid() const
|
|||
QStringList names = AllGroupNames();
|
||||
|
||||
QSet<QString> set;
|
||||
foreach (const QString &var, names)
|
||||
for (const auto &var : names)
|
||||
{
|
||||
set.insert(var);
|
||||
}
|
||||
|
||||
names = ListKnown();
|
||||
foreach (const QString &var, names)
|
||||
for (const auto &var : qAsConst(names))
|
||||
{
|
||||
if (not set.contains(var))
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -83,9 +83,9 @@ VCubicBezierPath VCubicBezierPath::Rotate(const QPointF &originPoint, qreal degr
|
|||
{
|
||||
const QVector<VPointF> points = GetCubicPath();
|
||||
VCubicBezierPath curve;
|
||||
for(int i=0; i < points.size(); ++i)
|
||||
for(auto &point : points)
|
||||
{
|
||||
curve.append(points.at(i).Rotate(originPoint, degrees));
|
||||
curve.append(point.Rotate(originPoint, degrees));
|
||||
}
|
||||
curve.setName(name() + prefix);
|
||||
curve.SetColor(GetColor());
|
||||
|
@ -99,9 +99,9 @@ VCubicBezierPath VCubicBezierPath::Flip(const QLineF &axis, const QString &prefi
|
|||
{
|
||||
const QVector<VPointF> points = GetCubicPath();
|
||||
VCubicBezierPath curve;
|
||||
for(int i=0; i < points.size(); ++i)
|
||||
for(auto &point : points)
|
||||
{
|
||||
curve.append(points.at(i).Flip(axis));
|
||||
curve.append(point.Flip(axis));
|
||||
}
|
||||
curve.setName(name() + prefix);
|
||||
curve.SetColor(GetColor());
|
||||
|
@ -115,9 +115,9 @@ VCubicBezierPath VCubicBezierPath::Move(qreal length, qreal angle, const QString
|
|||
{
|
||||
const QVector<VPointF> points = GetCubicPath();
|
||||
VCubicBezierPath curve;
|
||||
for(int i=0; i < points.size(); ++i)
|
||||
for(auto &point : points)
|
||||
{
|
||||
curve.append(points.at(i).Move(length, angle));
|
||||
curve.append(point.Move(length, angle));
|
||||
}
|
||||
curve.setName(name() + prefix);
|
||||
curve.SetColor(GetColor());
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -1017,7 +1017,7 @@ bool VAbstractPiece::IsEkvPointOnLine(const VSAPoint &iPoint, const VSAPoint &pr
|
|||
QPainterPath VAbstractPiece::PlaceLabelImgPath(const PlaceLabelImg &img)
|
||||
{
|
||||
QPainterPath path;
|
||||
foreach(const QPolygonF &p, img)
|
||||
for (auto &p : img)
|
||||
{
|
||||
if (not p.isEmpty())
|
||||
{
|
||||
|
|
|
@ -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))
|
||||
|
@ -305,9 +305,9 @@ QVector<QPointF> CorrectPosition(const QRectF &parentBoundingRect, QVector<QPoin
|
|||
QVector<VSAPoint> PrepareAllowance(const QVector<QPointF> &points)
|
||||
{
|
||||
QVector<VSAPoint> allowancePoints;
|
||||
for(int i = 0; i < points.size(); ++i)
|
||||
for(auto point : points)
|
||||
{
|
||||
allowancePoints.append(VSAPoint(points.at(i)));
|
||||
allowancePoints.append(VSAPoint(point));
|
||||
}
|
||||
return allowancePoints;
|
||||
}
|
||||
|
@ -348,9 +348,10 @@ QStringList PieceLabelText(const QVector<QPointF> &labelShape, const VTextManage
|
|||
QVector<VLayoutPlaceLabel> ConvertPlaceLabels(const VPiece &piece, const VContainer *pattern)
|
||||
{
|
||||
QVector<VLayoutPlaceLabel> labels;
|
||||
for(int i=0; i < piece.GetPlaceLabels().size(); ++i)
|
||||
const QVector<quint32> placeLabels = piece.GetPlaceLabels();
|
||||
for(auto placeLabel : placeLabels)
|
||||
{
|
||||
const auto label = pattern->GeometricObject<VPlaceLabelItem>(piece.GetPlaceLabels().at(i));
|
||||
const auto label = pattern->GeometricObject<VPlaceLabelItem>(placeLabel);
|
||||
VLayoutPlaceLabel layoutLabel;
|
||||
layoutLabel.shape = label->LabelShape();
|
||||
layoutLabel.center = label->toQPointF();
|
||||
|
@ -447,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)
|
||||
|
@ -469,12 +470,12 @@ template <>
|
|||
QVector<VLayoutPlaceLabel> VLayoutPiece::Map<VLayoutPlaceLabel>(const QVector<VLayoutPlaceLabel> &points) const
|
||||
{
|
||||
QVector<VLayoutPlaceLabel> p;
|
||||
foreach (const VLayoutPlaceLabel &label, points)
|
||||
for (auto &label : points)
|
||||
{
|
||||
VLayoutPlaceLabel mappedLabel;
|
||||
mappedLabel.type = label.type;
|
||||
mappedLabel.center = d->matrix.map(label.center);
|
||||
foreach (const QPolygonF &p, label.shape)
|
||||
for (const auto &p : label.shape)
|
||||
{
|
||||
mappedLabel.shape.append(d->matrix.map(p));
|
||||
}
|
||||
|
@ -948,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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1050,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);
|
||||
|
@ -1198,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"
|
||||
|
||||
|
|
|
@ -46,7 +46,8 @@ DialogExportToCSV::DialogExportToCSV(QWidget *parent)
|
|||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
foreach (int mib, QTextCodec::availableMibs())
|
||||
const QList<int> mibs = QTextCodec::availableMibs();
|
||||
for (auto mib : mibs)
|
||||
{
|
||||
ui->comboBoxCodec->addItem(QTextCodec::codecForMib(mib)->name(), mib);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ void VTableSearch::Find(const QString &term)
|
|||
|
||||
if (not searchList.isEmpty())
|
||||
{
|
||||
foreach(QTableWidgetItem *item, searchList)
|
||||
for (auto item : qAsConst(searchList))
|
||||
{
|
||||
item->setBackground(Qt::yellow);
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ void VTableSearch::RemoveRow(int row)
|
|||
|
||||
if (row <= indexRow)
|
||||
{
|
||||
foreach(QTableWidgetItem *item, searchList)
|
||||
for (auto item : qAsConst(searchList))
|
||||
{
|
||||
if (item->row() == row)
|
||||
{
|
||||
|
@ -180,7 +180,7 @@ void VTableSearch::AddRow(int row)
|
|||
|
||||
if (row <= indexRow)
|
||||
{
|
||||
foreach(QTableWidgetItem *item, searchList)
|
||||
for (auto item : qAsConst(searchList))
|
||||
{
|
||||
if (item->row() == row)
|
||||
{
|
||||
|
@ -202,7 +202,7 @@ void VTableSearch::RefreshList(const QString &term)
|
|||
|
||||
searchList = table->findItems(term, Qt::MatchContains);
|
||||
|
||||
foreach(QTableWidgetItem *item, searchList)
|
||||
for (auto item : qAsConst(searchList))
|
||||
{
|
||||
item->setBackground(Qt::yellow);
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -591,11 +591,11 @@ void VContainer::ClearUniqueIncrementNames()
|
|||
const QList<QString> list = uniqueNames.toList();
|
||||
ClearUniqueNames();
|
||||
|
||||
for(int i = 0; i < list.size(); ++i)
|
||||
for(auto &name : list)
|
||||
{
|
||||
if (not list.at(i).startsWith('#'))
|
||||
if (not name.startsWith('#'))
|
||||
{
|
||||
uniqueNames.insert(list.at(i));
|
||||
uniqueNames.insert(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
@ -448,11 +447,11 @@ QVector<QLineF> VPiece::PassmarksLines(const VContainer *data, const QVector<QPo
|
|||
QVector<PlaceLabelImg> VPiece::PlaceLabelPoints(const VContainer *data) const
|
||||
{
|
||||
QVector<PlaceLabelImg> points;
|
||||
for(int i=0; i < d->m_placeLabels.size(); ++i)
|
||||
for(auto placeLabel : d->m_placeLabels)
|
||||
{
|
||||
try
|
||||
{
|
||||
const auto label = data->GeometricObject<VPlaceLabelItem>(d->m_placeLabels.at(i));
|
||||
const auto label = data->GeometricObject<VPlaceLabelItem>(placeLabel);
|
||||
points.append(label->LabelShape());
|
||||
}
|
||||
catch (const VExceptionBadId &e)
|
||||
|
@ -463,10 +462,21 @@ QVector<PlaceLabelImg> VPiece::PlaceLabelPoints(const VContainer *data) const
|
|||
return points;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<QPainterPath> VPiece::CurvesPainterPath(const VContainer *data) const
|
||||
{
|
||||
return GetPath().CurvesPainterPath(data);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QPainterPath VPiece::MainPathPath(const VContainer *data) const
|
||||
{
|
||||
const QVector<QPointF> points = MainPathPoints(data);
|
||||
return VPiece::MainPathPath(MainPathPoints(data));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QPainterPath VPiece::MainPathPath(const QVector<QPointF> &points)
|
||||
{
|
||||
QPainterPath path;
|
||||
|
||||
if (not points.isEmpty())
|
||||
|
@ -670,22 +680,22 @@ QList<quint32> VPiece::Dependencies() const
|
|||
{
|
||||
QList<quint32> list = d->m_path.Dependencies();
|
||||
|
||||
foreach (const CustomSARecord &record, d->m_customSARecords)
|
||||
for (auto &record : d->m_customSARecords)
|
||||
{
|
||||
list.append(record.path);
|
||||
}
|
||||
|
||||
foreach (const quint32 &value, d->m_internalPaths)
|
||||
for (auto &value : d->m_internalPaths)
|
||||
{
|
||||
list.append(value);
|
||||
}
|
||||
|
||||
foreach (const quint32 &value, d->m_pins)
|
||||
for (auto &value : d->m_pins)
|
||||
{
|
||||
list.append(value);
|
||||
}
|
||||
|
||||
foreach (const quint32 &value, d->m_placeLabels)
|
||||
for (auto &value : d->m_placeLabels)
|
||||
{
|
||||
list.append(value);
|
||||
}
|
||||
|
@ -884,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);
|
||||
|
||||
|
@ -937,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1138,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;
|
||||
|
|
|
@ -74,7 +74,11 @@ public:
|
|||
const QVector<QPointF> &seamAllowance = QVector<QPointF>()) const;
|
||||
QVector<PlaceLabelImg> PlaceLabelPoints(const VContainer *data) const;
|
||||
|
||||
QVector<QPainterPath> CurvesPainterPath(const VContainer *data) const;
|
||||
|
||||
QPainterPath MainPathPath(const VContainer *data) const;
|
||||
static QPainterPath MainPathPath(const QVector<QPointF> &points);
|
||||
|
||||
QPainterPath SeamAllowancePath(const VContainer *data) const;
|
||||
QPainterPath SeamAllowancePath(const QVector<QPointF> &points) const;
|
||||
QPainterPath PassmarksPath(const VContainer *data,
|
||||
|
|
|
@ -128,6 +128,20 @@ int IndexOfNode(const QVector<VPieceNode> &list, quint32 id)
|
|||
qDebug()<<"Can't find node.";
|
||||
return -1;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QPainterPath MakePainterPath(const QVector<QPointF> &points)
|
||||
{
|
||||
QPainterPath path;
|
||||
|
||||
if (not points.isEmpty())
|
||||
{
|
||||
path.addPolygon(QPolygonF(points));
|
||||
path.setFillRule(Qt::WindingFill);
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -332,6 +346,41 @@ QVector<VPointF> VPiecePath::PathNodePoints(const VContainer *data, bool showExc
|
|||
return points;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<QVector<QPointF> > VPiecePath::PathCurvePoints(const VContainer *data) const
|
||||
{
|
||||
QVector<QVector<QPointF> > curves;
|
||||
for (int i = 0; i < CountNodes(); ++i)
|
||||
{
|
||||
if (at(i).IsExcluded())
|
||||
{
|
||||
continue;// skip excluded node
|
||||
}
|
||||
|
||||
switch (at(i).GetTypeTool())
|
||||
{
|
||||
case (Tool::NodeArc):
|
||||
case (Tool::NodeElArc):
|
||||
case (Tool::NodeSpline):
|
||||
case (Tool::NodeSplinePath):
|
||||
{
|
||||
const QSharedPointer<VAbstractCurve> curve = data->GeometricObject<VAbstractCurve>(at(i).GetId());
|
||||
|
||||
const QPointF begin = StartSegment(data, i, at(i).GetReverse());
|
||||
const QPointF end = EndSegment(data, i, at(i).GetReverse());
|
||||
|
||||
curves.append(curve->GetSegmentPoints(begin, end, at(i).GetReverse()));
|
||||
break;
|
||||
}
|
||||
case (Tool::NodePoint):
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return curves;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<VSAPoint> VPiecePath::SeamAllowancePoints(const VContainer *data, qreal width, bool reverse) const
|
||||
{
|
||||
|
@ -374,16 +423,20 @@ QVector<VSAPoint> VPiecePath::SeamAllowancePoints(const VContainer *data, qreal
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QPainterPath VPiecePath::PainterPath(const VContainer *data) const
|
||||
{
|
||||
const QVector<QPointF> points = PathPoints(data);
|
||||
QPainterPath path;
|
||||
|
||||
if (not points.isEmpty())
|
||||
{
|
||||
path.addPolygon(QPolygonF(points));
|
||||
path.setFillRule(Qt::WindingFill);
|
||||
return MakePainterPath(PathPoints(data));
|
||||
}
|
||||
|
||||
return path;
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<QPainterPath> VPiecePath::CurvesPainterPath(const VContainer *data) const
|
||||
{
|
||||
const QVector<QVector<QPointF> > curves = PathCurvePoints(data);
|
||||
QVector<QPainterPath> paths(curves.size());
|
||||
|
||||
for(auto &curve : curves)
|
||||
{
|
||||
paths.append(MakePainterPath(curve));
|
||||
}
|
||||
return paths;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -452,7 +505,7 @@ VSAPoint VPiecePath::EndSegment(const VContainer *data, const QVector<VPieceNode
|
|||
QList<quint32> VPiecePath::Dependencies() const
|
||||
{
|
||||
QList<quint32> list;
|
||||
foreach (const VPieceNode &node, d->m_nodes)
|
||||
for (auto &node : d->m_nodes)
|
||||
{
|
||||
list.append(node.GetId());
|
||||
}
|
||||
|
@ -528,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;
|
||||
}
|
||||
|
@ -623,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;
|
||||
|
@ -942,9 +995,9 @@ QVector<VSAPoint> VPiecePath::CurveSeamAllowanceSegment(const VContainer *data,
|
|||
qreal w2 = end.GetSABefore();
|
||||
if (w1 < 0 && w2 < 0)
|
||||
{// no local widths
|
||||
for(int i = 0; i < points.size(); ++i)
|
||||
for(auto point : points)
|
||||
{
|
||||
VSAPoint p(points.at(i));
|
||||
VSAPoint p(point);
|
||||
if (i == 0)
|
||||
{ // first point
|
||||
p.SetSAAfter(begin.GetSAAfter());
|
||||
|
@ -983,9 +1036,9 @@ QVector<VSAPoint> VPiecePath::CurveSeamAllowanceSegment(const VContainer *data,
|
|||
|
||||
qreal length = 0; // how much we handle
|
||||
|
||||
for(int i = 1; i < points.size(); ++i)
|
||||
for(auto point : points)
|
||||
{
|
||||
p = VSAPoint(points.at(i));
|
||||
p = VSAPoint(point);
|
||||
|
||||
if (i == points.size() - 1)
|
||||
{// last point
|
||||
|
|
|
@ -87,9 +87,11 @@ public:
|
|||
|
||||
QVector<QPointF> PathPoints(const VContainer *data) const;
|
||||
QVector<VPointF> PathNodePoints(const VContainer *data, bool showExcluded = true) const;
|
||||
QVector<QVector<QPointF> > PathCurvePoints(const VContainer *data) const;
|
||||
QVector<VSAPoint> SeamAllowancePoints(const VContainer *data, qreal width, bool reverse) const;
|
||||
|
||||
QPainterPath PainterPath(const VContainer *data) const;
|
||||
QVector<QPainterPath> CurvesPainterPath(const VContainer *data) const;
|
||||
|
||||
QList<quint32> Dependencies() const;
|
||||
QVector<quint32> MissingNodes(const VPiecePath &path) const;
|
||||
|
|
|
@ -222,7 +222,9 @@ QPushButton *CheckableMessageBox::addButton(const QString &text, QDialogButtonBo
|
|||
|
||||
QDialogButtonBox::StandardButton CheckableMessageBox::defaultButton() const
|
||||
{
|
||||
foreach (QAbstractButton *b, d->buttonBox->buttons())
|
||||
const QList<QAbstractButton *> buttons = d->buttonBox->buttons();
|
||||
for (auto b : buttons)
|
||||
{
|
||||
if (QPushButton *pb = qobject_cast<QPushButton *>(b))
|
||||
{
|
||||
if (pb->isDefault())
|
||||
|
@ -230,6 +232,7 @@ QDialogButtonBox::StandardButton CheckableMessageBox::defaultButton() const
|
|||
return d->buttonBox->standardButton(pb);
|
||||
}
|
||||
}
|
||||
}
|
||||
return QDialogButtonBox::NoButton;
|
||||
}
|
||||
|
||||
|
@ -429,7 +432,7 @@ bool CheckableMessageBox::hasSuppressedQuestions(QSettings *settings)
|
|||
//Q_ASSERT(settings, return false);
|
||||
bool hasSuppressed = false;
|
||||
settings->beginGroup(QLatin1String(kDoNotAskAgainKey));
|
||||
foreach (const QString &subKey, settings->childKeys())
|
||||
for (auto &subKey : settings->childKeys())
|
||||
{
|
||||
if (settings->value(subKey, false).toBool())
|
||||
{
|
||||
|
|
|
@ -115,8 +115,8 @@ VPE::VProperty* VPE::QVector3DProperty::clone(bool include_children, VProperty*
|
|||
|
||||
if (!include_children)
|
||||
{
|
||||
QList<VProperty*> tmpChildren = container->getChildren();
|
||||
foreach (VProperty* tmpChild, tmpChildren)
|
||||
const QList<VProperty*> &tmpChildren = container->getChildren();
|
||||
for (auto tmpChild : tmpChildren)
|
||||
{
|
||||
container->removeChild(tmpChild);
|
||||
delete tmpChild;
|
||||
|
|
|
@ -113,10 +113,16 @@ void VPE::VFileEditWidget::onToolButtonClicked()
|
|||
{
|
||||
QString filepath = (Directory ? QFileDialog::getExistingDirectory(nullptr, tr("Directory"), CurrentFilePath,
|
||||
QFileDialog::ShowDirsOnly
|
||||
| QFileDialog::DontUseNativeDialog)
|
||||
#ifdef Q_OS_LINUX
|
||||
| QFileDialog::DontUseNativeDialog
|
||||
#endif
|
||||
)
|
||||
: QFileDialog::getOpenFileName(nullptr, tr("Open File"), CurrentFilePath,
|
||||
FileDialogFilter, nullptr,
|
||||
QFileDialog::DontUseNativeDialog));
|
||||
FileDialogFilter, nullptr
|
||||
#ifdef Q_OS_LINUX
|
||||
, QFileDialog::DontUseNativeDialog
|
||||
#endif
|
||||
));
|
||||
if (filepath.isNull() == false)
|
||||
{
|
||||
setFile(filepath, true);
|
||||
|
@ -245,7 +251,7 @@ bool VPE::VFileEditWidget::checkFileFilter(const QString& file) const
|
|||
return false;
|
||||
}
|
||||
|
||||
foreach(QString tmpFilter, FilterList)
|
||||
for (auto &tmpFilter : FilterList)
|
||||
{
|
||||
QRegExp tmpRegExpFilter(tmpFilter, Qt::CaseInsensitive, QRegExp::Wildcard);
|
||||
if (tmpRegExpFilter.exactMatch(file))
|
||||
|
|
|
@ -114,8 +114,8 @@ VPE::VProperty *VPE::VPointFProperty::clone(bool include_children, VProperty *co
|
|||
|
||||
if (!include_children)
|
||||
{
|
||||
QList<VProperty*> tmpChildren = container->getChildren();
|
||||
foreach(VProperty* tmpChild, tmpChildren)
|
||||
const QList<VProperty*> &tmpChildren = container->getChildren();
|
||||
for(auto tmpChild : tmpChildren)
|
||||
{
|
||||
container->removeChild(tmpChild);
|
||||
delete tmpChild;
|
||||
|
|
|
@ -350,9 +350,11 @@ QMap<QString, QVariant> VPE::VProperty::getSettings() const
|
|||
{
|
||||
QMap<QString, QVariant> tmpResult;
|
||||
|
||||
QStringList tmpKeyList = getSettingKeys();
|
||||
foreach(const QString& tmpKey, tmpKeyList)
|
||||
const QStringList tmpKeyList = getSettingKeys();
|
||||
for(auto &tmpKey : tmpKeyList)
|
||||
{
|
||||
tmpResult.insert(tmpKey, getSetting(tmpKey));
|
||||
}
|
||||
|
||||
return tmpResult;
|
||||
}
|
||||
|
@ -392,9 +394,12 @@ VPE::VProperty* VPE::VProperty::clone(bool include_children, VProperty* containe
|
|||
|
||||
if (include_children)
|
||||
{
|
||||
foreach(VProperty* tmpChild, d_ptr->Children)
|
||||
const QList<VProperty*> children = d_ptr->Children;
|
||||
for (auto tmpChild : children)
|
||||
{
|
||||
container->addChild(tmpChild->clone(true));
|
||||
}
|
||||
}
|
||||
|
||||
return container;
|
||||
}
|
||||
|
|
|
@ -213,9 +213,9 @@ void VPE::VPropertyFormView::connectPropertyFormWidget(VPropertyFormWidget *widg
|
|||
|
||||
connect(widget, &VPropertyFormWidget::propertyDataSubmitted, this, &VPropertyFormView::dataSubmitted,
|
||||
Qt::UniqueConnection);
|
||||
QList<VPropertyFormWidget*> tmpList = widget->getChildPropertyFormWidgets();
|
||||
const QList<VPropertyFormWidget*> tmpList = widget->getChildPropertyFormWidgets();
|
||||
|
||||
foreach(VPropertyFormWidget* tmpEditorWidget, tmpList)
|
||||
for (auto tmpEditorWidget : tmpList)
|
||||
{
|
||||
connectPropertyFormWidget(tmpEditorWidget);
|
||||
}
|
||||
|
|
|
@ -103,6 +103,7 @@ void VPE::VPropertyFormWidget::build()
|
|||
}
|
||||
|
||||
QFormLayout* tmpFormLayout = new QFormLayout(this);
|
||||
tmpFormLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||
setLayout(tmpFormLayout);
|
||||
|
||||
for (int i = 0; i < d_ptr->Properties.count(); ++i)
|
||||
|
@ -123,9 +124,11 @@ void VPE::VPropertyFormWidget::build()
|
|||
tmpFormLayout->addRow(group);
|
||||
|
||||
QFormLayout* subFormLayout = new QFormLayout(group);
|
||||
subFormLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||
QMargins margins = subFormLayout->contentsMargins();
|
||||
margins.setTop(0);
|
||||
margins.setLeft(14);
|
||||
margins.setLeft(18);
|
||||
margins.setRight(0);
|
||||
subFormLayout->setContentsMargins(margins);
|
||||
|
||||
group->setLayout(subFormLayout);
|
||||
|
@ -268,8 +271,8 @@ void VPE::VPropertyFormWidget::setCommitBehaviour(bool auto_commit)
|
|||
{
|
||||
d_ptr->UpdateEditors = auto_commit;
|
||||
|
||||
QList<VPropertyFormWidget*> tmpChildFormWidgets = getChildPropertyFormWidgets();
|
||||
foreach(VPropertyFormWidget* tmpChild, tmpChildFormWidgets)
|
||||
const QList<VPropertyFormWidget*> tmpChildFormWidgets = getChildPropertyFormWidgets();
|
||||
for (auto tmpChild : tmpChildFormWidgets)
|
||||
{
|
||||
if (tmpChild)
|
||||
{
|
||||
|
@ -281,7 +284,7 @@ void VPE::VPropertyFormWidget::setCommitBehaviour(bool auto_commit)
|
|||
QList<VPE::VPropertyFormWidget *> VPE::VPropertyFormWidget::getChildPropertyFormWidgets() const
|
||||
{
|
||||
QList<VPropertyFormWidget *> tmpResult;
|
||||
foreach(const VPropertyFormWidgetPrivate::SEditorWidget& tmpEditorWidget, d_ptr->EditorWidgets)
|
||||
for (auto &tmpEditorWidget : d_ptr->EditorWidgets)
|
||||
{
|
||||
if (tmpEditorWidget.FormWidget)
|
||||
{
|
||||
|
|
|
@ -204,9 +204,11 @@ VPE::VPropertySet* VPE::VPropertySet::clone() const
|
|||
{
|
||||
VPropertySet* tmpResult = new VPropertySet();
|
||||
|
||||
foreach(VProperty* tmpProperty, d_ptr->RootProperties)
|
||||
const QList<VProperty*> rootProperties = d_ptr->RootProperties;
|
||||
for (auto tmpProperty : rootProperties)
|
||||
{
|
||||
cloneProperty(tmpProperty, nullptr, tmpResult);
|
||||
|
||||
}
|
||||
|
||||
return tmpResult;
|
||||
}
|
||||
|
@ -219,7 +221,7 @@ bool VPE::VPropertySet::hasProperty(VProperty *property, VProperty *parent) cons
|
|||
}
|
||||
|
||||
const QList<VProperty*>& tmpChildrenList = (parent != nullptr ? parent->getChildren() : d_ptr->RootProperties);
|
||||
foreach(VProperty* tmpProp, tmpChildrenList)
|
||||
for(auto tmpProp : tmpChildrenList)
|
||||
{
|
||||
if (tmpProp && (tmpProp == property || hasProperty(property, tmpProp)))
|
||||
{
|
||||
|
@ -253,13 +255,17 @@ void VPE::VPropertySet::cloneProperty(VProperty* property_to_clone, VProperty *p
|
|||
void VPE::VPropertySet::removePropertyFromSet(VProperty *prop)
|
||||
{
|
||||
// Remove all the children
|
||||
foreach(VProperty* tmpChild, prop->getChildren())
|
||||
const QList<VPE::VProperty*>& children = prop->getChildren();
|
||||
for (auto tmpChild : children)
|
||||
{
|
||||
removeProperty(tmpChild);
|
||||
}
|
||||
|
||||
|
||||
QList<QString> tmpKeys = d_ptr->Properties.keys(prop);
|
||||
foreach(const QString& tmpID, tmpKeys)
|
||||
const QList<QString> tmpKeys = d_ptr->Properties.keys(prop);
|
||||
for (auto &tmpID : tmpKeys)
|
||||
{
|
||||
d_ptr->Properties.remove(tmpID);
|
||||
}
|
||||
|
||||
// Remove from list
|
||||
d_ptr->RootProperties.removeAll(prop);
|
||||
|
|
|
@ -61,7 +61,7 @@ void VPE::VSerializedProperty::initChildren(const VProperty *property, const VPr
|
|||
if (property && set)
|
||||
{
|
||||
const QList<VProperty*>& tmpChildren = property->getChildren();
|
||||
foreach(const VProperty* tmpChild, tmpChildren)
|
||||
for (auto tmpChild : tmpChildren)
|
||||
{
|
||||
QString tmpChildID = set->getPropertyID(property);
|
||||
Children.append(VSerializedProperty(tmpChild, tmpChildID, set));
|
||||
|
|
|
@ -163,9 +163,9 @@ bool AbstractTest::CopyRecursively(const QString &srcFilePath, const QString &tg
|
|||
return false;
|
||||
}
|
||||
QDir sourceDir(srcFilePath);
|
||||
QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden |
|
||||
QDir::System);
|
||||
foreach (const QString &fileName, fileNames)
|
||||
const QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot |
|
||||
QDir::Hidden | QDir::System);
|
||||
for (auto &fileName : fileNames)
|
||||
{
|
||||
const QString newSrcFilePath = srcFilePath + QDir::separator() + fileName;
|
||||
const QString newTgtFilePath = tgtFilePath + QDir::separator() + fileName;
|
||||
|
|
|
@ -291,7 +291,11 @@ void DialogEditLabel::ExportTemplate()
|
|||
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Export label template"),
|
||||
path + QLatin1String("/") + tr("template") + QLatin1String(".xml"),
|
||||
filters, nullptr, QFileDialog::DontUseNativeDialog);
|
||||
filters, nullptr
|
||||
#ifdef Q_OS_LINUX
|
||||
, QFileDialog::DontUseNativeDialog
|
||||
#endif
|
||||
);
|
||||
|
||||
if (fileName.isEmpty())
|
||||
{
|
||||
|
@ -340,8 +344,11 @@ void DialogEditLabel::ImportTemplate()
|
|||
QString filter(tr("Label template") + QLatin1String(" (*.xml)"));
|
||||
//Use standard path to label templates
|
||||
const QString path = VCommonSettings::PrepareLabelTemplates(qApp->Settings()->GetPathLabelTemplate());
|
||||
const QString fileName = QFileDialog::getOpenFileName(this, tr("Import template"), path, filter, nullptr,
|
||||
QFileDialog::DontUseNativeDialog);
|
||||
const QString fileName = QFileDialog::getOpenFileName(this, tr("Import template"), path, filter, nullptr
|
||||
#ifdef Q_OS_LINUX
|
||||
, QFileDialog::DontUseNativeDialog
|
||||
#endif
|
||||
);
|
||||
if (fileName.isEmpty())
|
||||
{
|
||||
return;
|
||||
|
@ -574,16 +581,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 +629,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);
|
||||
|
|
|
@ -163,11 +163,6 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 &
|
|||
flagMainPathIsValid = MainPathIsValid();
|
||||
CheckState();
|
||||
|
||||
if (not applyAllowed)
|
||||
{
|
||||
vis = new VisToolPiece(data);
|
||||
}
|
||||
|
||||
m_ftb->SetCurrentIndex(TabOrder::Paths);// Show always first tab active on start.
|
||||
}
|
||||
|
||||
|
@ -203,6 +198,11 @@ void DialogSeamAllowance::EnableApply(bool enable)
|
|||
m_ftb->SetTabEnabled(TabOrder::Grainline, applyAllowed);
|
||||
m_ftb->SetTabEnabled(TabOrder::Passmarks, applyAllowed);
|
||||
m_ftb->SetTabEnabled(TabOrder::PlaceLabels, applyAllowed);
|
||||
|
||||
if (not applyAllowed && vis.isNull())
|
||||
{
|
||||
vis = new VisToolPiece(data);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -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);
|
||||
|
@ -3028,10 +3026,13 @@ void DialogSeamAllowance::SetFormulaSAWidth(const QString &formula)
|
|||
}
|
||||
uiTabPaths->plainTextEditFormulaWidth->setPlainText(width);
|
||||
|
||||
if (not applyAllowed)
|
||||
{
|
||||
VisToolPiece *path = qobject_cast<VisToolPiece *>(vis);
|
||||
SCASSERT(path != nullptr)
|
||||
const VPiece p = CreatePiece();
|
||||
path->SetPiece(p);
|
||||
}
|
||||
|
||||
MoveCursorToEnd(uiTabPaths->plainTextEditFormulaWidth);
|
||||
}
|
||||
|
@ -3298,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
|
||||
|
@ -106,7 +105,7 @@ QPointF GetOriginPoint(const QVector<quint32> objects, const VContainer *data, q
|
|||
originObjects.append(data->GeometricObject<VAbstractCurve>(id)->GetPoints());
|
||||
#else
|
||||
const QVector<QPointF> points = data->GeometricObject<VAbstractCurve>(id)->GetPoints();
|
||||
foreach (const QPointF &point, points)
|
||||
for (auto &point : points)
|
||||
{
|
||||
originObjects.append(point);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -174,7 +174,7 @@ void VAbstractSpline::AllowHover(bool enabled)
|
|||
// Manually handle hover events. Need for setting cursor for not selectable paths.
|
||||
m_acceptHoverEvents = enabled;
|
||||
|
||||
foreach (auto *point, controlPoints)
|
||||
for (auto point : qAsConst(controlPoints))
|
||||
{
|
||||
point->setAcceptHoverEvents(enabled);
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ void VAbstractSpline::AllowSelecting(bool enabled)
|
|||
{
|
||||
setFlag(QGraphicsItem::ItemIsSelectable, enabled);
|
||||
|
||||
foreach (auto *point, controlPoints)
|
||||
for (auto point : qAsConst(controlPoints))
|
||||
{
|
||||
point->setFlag(QGraphicsItem::ItemIsSelectable, enabled);
|
||||
}
|
||||
|
@ -424,7 +424,7 @@ void VAbstractSpline::CurveSelected(bool selected)
|
|||
{
|
||||
setSelected(selected);
|
||||
|
||||
foreach (auto *point, controlPoints)
|
||||
for (auto point : qAsConst(controlPoints))
|
||||
{
|
||||
point->blockSignals(true);
|
||||
point->setSelected(selected);
|
||||
|
@ -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
|
||||
}
|
||||
|
|
|
@ -294,7 +294,7 @@ void VToolSpline::EnableToolMove(bool move)
|
|||
{
|
||||
this->setFlag(QGraphicsItem::ItemIsMovable, move);
|
||||
|
||||
foreach (auto *point, controlPoints)
|
||||
for (auto point : qAsConst(controlPoints))
|
||||
{
|
||||
point->setFlag(QGraphicsItem::ItemIsMovable, move);
|
||||
}
|
||||
|
@ -562,7 +562,7 @@ bool VToolSpline::IsMovable() const
|
|||
void VToolSpline::RefreshCtrlPoints()
|
||||
{
|
||||
// Very important to disable control points. Without it the pogram can't move the curve.
|
||||
foreach (auto *point, controlPoints)
|
||||
for (auto point : qAsConst(controlPoints))
|
||||
{
|
||||
point->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false);
|
||||
}
|
||||
|
@ -595,7 +595,7 @@ void VToolSpline::RefreshCtrlPoints()
|
|||
controlPoints[0]->blockSignals(false);
|
||||
controlPoints[1]->blockSignals(false);
|
||||
|
||||
foreach (auto *point, controlPoints)
|
||||
for (auto point : qAsConst(controlPoints))
|
||||
{
|
||||
point->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
||||
}
|
||||
|
|
|
@ -293,7 +293,7 @@ void VToolSplinePath::EnableToolMove(bool move)
|
|||
{
|
||||
this->setFlag(QGraphicsItem::ItemIsMovable, move);
|
||||
|
||||
foreach (auto *point, controlPoints)
|
||||
for (auto point : qAsConst(controlPoints))
|
||||
{
|
||||
point->setFlag(QGraphicsItem::ItemIsMovable, move);
|
||||
}
|
||||
|
@ -727,7 +727,7 @@ bool VToolSplinePath::IsMovable(int index) const
|
|||
void VToolSplinePath::RefreshCtrlPoints()
|
||||
{
|
||||
// Very important to disable control points. Without it the pogram can't move the curve.
|
||||
foreach (auto *point, controlPoints)
|
||||
for (auto point : qAsConst(controlPoints))
|
||||
{
|
||||
point->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false);
|
||||
}
|
||||
|
@ -765,7 +765,7 @@ void VToolSplinePath::RefreshCtrlPoints()
|
|||
controlPoints[j-1]->blockSignals(false);
|
||||
}
|
||||
|
||||
foreach (auto *point, controlPoints)
|
||||
for (auto point : qAsConst(controlPoints))
|
||||
{
|
||||
point->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
|
||||
}
|
||||
|
|
|
@ -411,12 +411,12 @@ void VAbstractTool::ToolCreation(const Source &typeCreation)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VToolRecord VAbstractTool::GetRecord(const quint32 id, const Tool &toolType, VAbstractPattern *doc)
|
||||
{
|
||||
QVector<VToolRecord> *history = doc->getHistory();
|
||||
for(int i = 0; i < history->size(); ++i)
|
||||
const QVector<VToolRecord> *history = doc->getHistory();
|
||||
for(auto &record : *history)
|
||||
{
|
||||
if (history->at(i).getId() == id && history->at(i).getTypeTool() == toolType)
|
||||
if (record.getId() == id && record.getTypeTool() == toolType)
|
||||
{
|
||||
return history->at(i);
|
||||
return record;
|
||||
}
|
||||
}
|
||||
return VToolRecord();
|
||||
|
|
|
@ -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);
|
||||
|
@ -1240,9 +1240,9 @@ void VToolSeamAllowance::keyReleaseEvent(QKeyEvent *event)
|
|||
{
|
||||
qApp->getUndoStack()->beginMacro(tr("multi deletion"));
|
||||
|
||||
for(int i=0; i < toolList.size(); ++i)
|
||||
for(auto tool : toolList)
|
||||
{
|
||||
toolList.at(i)->RemoveWithConfirm(false);
|
||||
tool->RemoveWithConfirm(false);
|
||||
}
|
||||
}
|
||||
DeleteToolWithConfirm(false);
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -1355,7 +1355,9 @@ void VToolSeamAllowance::RefreshGeometry(bool updateChildren)
|
|||
this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false);
|
||||
|
||||
const VPiece detail = VAbstractTool::data.GetPiece(m_id);
|
||||
QFuture<QPainterPath > futurePath = QtConcurrent::run(detail, &VPiece::MainPathPath, this->getData());
|
||||
QFuture<QPainterPath > futurePath = QtConcurrent::run(detail,
|
||||
QOverload<const VContainer *>::of(&VPiece::MainPathPath),
|
||||
this->getData());
|
||||
QFuture<QVector<QPointF> > futureSeamAllowance;
|
||||
|
||||
if (detail.IsSeamAllowance())
|
||||
|
@ -1440,7 +1442,7 @@ void VToolSeamAllowance::SaveDialogChange(const QString &undoText)
|
|||
{
|
||||
qApp->getUndoStack()->beginMacro(undoText.isEmpty() ? saveCommand->text(): undoText);
|
||||
|
||||
foreach (QUndoCommand* command, undocommands)
|
||||
for (auto command : undocommands)
|
||||
{
|
||||
qApp->getUndoStack()->push(command);
|
||||
}
|
||||
|
@ -1764,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)
|
||||
|
@ -1784,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1890,9 +1894,9 @@ QList<VToolSeamAllowance *> VToolSeamAllowance::SelectedTools() const
|
|||
|
||||
if (not list.isEmpty())
|
||||
{
|
||||
for(int i=0; i < list.size(); ++i)
|
||||
for(auto item : list)
|
||||
{
|
||||
VToolSeamAllowance *tool = qgraphicsitem_cast<VToolSeamAllowance *>(list.at(i));
|
||||
VToolSeamAllowance *tool = qgraphicsitem_cast<VToolSeamAllowance *>(item);
|
||||
if (tool != nullptr && tool->getId() != m_id)
|
||||
{
|
||||
tools.append(tool);
|
||||
|
@ -1911,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);
|
||||
|
@ -2009,9 +2013,8 @@ QVector<CustomSARecord> VToolSeamAllowance::DuplicateCustomSARecords(const QVect
|
|||
const QMap<quint32, quint32> &replacements)
|
||||
{
|
||||
QVector<CustomSARecord> newRecords;
|
||||
for(int i=0; i < records.size(); ++i)
|
||||
for(auto record : records)
|
||||
{
|
||||
CustomSARecord record = records.at(i);
|
||||
record.path = DuplicatePiecePath(record.path, initData);
|
||||
record.startPoint = replacements.value(record.startPoint, NULL_ID);
|
||||
record.endPoint = replacements.value(record.endPoint, NULL_ID);
|
||||
|
@ -2025,9 +2028,9 @@ QVector<quint32> VToolSeamAllowance::DuplicateInternalPaths(const QVector<quint3
|
|||
const VToolSeamAllowanceInitData &initData)
|
||||
{
|
||||
QVector<quint32> newPaths;
|
||||
for(int i=0; i < iPaths.size(); ++i)
|
||||
for(auto iPath : iPaths)
|
||||
{
|
||||
newPaths.append(DuplicatePiecePath(iPaths.at(i), initData));
|
||||
newPaths.append(DuplicatePiecePath(iPath, initData));
|
||||
}
|
||||
return newPaths;
|
||||
}
|
||||
|
@ -2037,11 +2040,11 @@ QVector<quint32> VToolSeamAllowance::DuplicatePins(const QVector<quint32> &pins,
|
|||
const VToolSeamAllowanceInitData &initData)
|
||||
{
|
||||
QVector<quint32> newPins;
|
||||
for(int i=0; i < pins.size(); ++i)
|
||||
for(auto p : pins)
|
||||
{
|
||||
QSharedPointer<VPointF> pin = initData.data->GeometricObject<VPointF>(pins.at(i));
|
||||
QSharedPointer<VPointF> pin = initData.data->GeometricObject<VPointF>(p);
|
||||
|
||||
VAbstractNode *tool = qobject_cast<VAbstractNode *>(VAbstractPattern::getTool(pins.at(i)));
|
||||
VAbstractNode *tool = qobject_cast<VAbstractNode *>(VAbstractPattern::getTool(p));
|
||||
SCASSERT(tool != nullptr)
|
||||
|
||||
VToolPinInitData initNodeData;
|
||||
|
@ -2066,10 +2069,10 @@ QVector<quint32> VToolSeamAllowance::DuplicatePlaceLabels(const QVector<quint32>
|
|||
const VToolSeamAllowanceInitData &initData)
|
||||
{
|
||||
QVector<quint32> newPlaceLabels;
|
||||
for(int i=0; i < placeLabels.size(); ++i)
|
||||
for(auto placeLabel : placeLabels)
|
||||
{
|
||||
QSharedPointer<VPlaceLabelItem> label = initData.data->GeometricObject<VPlaceLabelItem>(placeLabels.at(i));
|
||||
VAbstractNode *tool = qobject_cast<VAbstractNode *>(VAbstractPattern::getTool(placeLabels.at(i)));
|
||||
QSharedPointer<VPlaceLabelItem> label = initData.data->GeometricObject<VPlaceLabelItem>(placeLabel);
|
||||
VAbstractNode *tool = qobject_cast<VAbstractNode *>(VAbstractPattern::getTool(placeLabel));
|
||||
SCASSERT(tool != nullptr)
|
||||
|
||||
VToolPlaceLabelInitData initNodeData;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1161,9 +1160,9 @@ void CreateUnitedDetailCSA(VPiece &newDetail, const VPiece &d, QVector<quint32>
|
|||
quint32 pRotate, qreal angle)
|
||||
{
|
||||
QVector<quint32> nodeChildren;
|
||||
for(int i=0; i < d.GetCustomSARecords().size(); ++i)
|
||||
const QVector<CustomSARecord> records = d.GetCustomSARecords();
|
||||
for(auto record : records)
|
||||
{
|
||||
CustomSARecord record = d.GetCustomSARecords().at(i);
|
||||
const VPiecePath path = initData.data->GetPiecePath(record.path);
|
||||
VPiecePath newPath = path;
|
||||
newPath.Clear();//Clear nodes
|
||||
|
@ -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;
|
||||
|
@ -1220,9 +1220,10 @@ void CreateUnitedDetailInternalPaths(VPiece &newDetail, const VPiece &d, QVector
|
|||
qreal dy, quint32 pRotate, qreal angle)
|
||||
{
|
||||
QVector<quint32> nodeChildren;
|
||||
for(int i=0; i < d.GetInternalPaths().size(); ++i)
|
||||
const QVector<quint32> internalPaths = d.GetInternalPaths();
|
||||
for(auto iPath : internalPaths)
|
||||
{
|
||||
const VPiecePath path = initData.data->GetPiecePath(d.GetInternalPaths().at(i));
|
||||
const VPiecePath path = initData.data->GetPiecePath(iPath);
|
||||
VPiecePath newPath = path;
|
||||
newPath.Clear();//Clear nodes
|
||||
|
||||
|
@ -1263,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;
|
||||
|
@ -1280,9 +1282,10 @@ void CreateUnitedDetailPins(VPiece &newDetail, const VPiece &d, QVector<quint32>
|
|||
quint32 pRotate, qreal angle)
|
||||
{
|
||||
QVector<quint32> nodeChildren;
|
||||
for(int i=0; i < d.GetPins().size(); ++i)
|
||||
const QVector<quint32> pins = d.GetPins();
|
||||
for(auto pin : pins)
|
||||
{
|
||||
const quint32 id = AddPin(d.GetPins().at(i), initData, children, drawName, dx, dy, pRotate, angle);
|
||||
const quint32 id = AddPin(pin, initData, children, drawName, dx, dy, pRotate, angle);
|
||||
newDetail.GetPins().append(id);
|
||||
}
|
||||
children += nodeChildren;
|
||||
|
@ -1294,10 +1297,10 @@ void CreateUnitedDetailPlaceLabels(VPiece &newDetail, const VPiece &d, QVector<q
|
|||
qreal dy, quint32 pRotate, qreal angle)
|
||||
{
|
||||
QVector<quint32> nodeChildren;
|
||||
for(int i=0; i < d.GetPlaceLabels().size(); ++i)
|
||||
const QVector<quint32> placeLabels = d.GetPlaceLabels();
|
||||
for(auto placeLabel : placeLabels)
|
||||
{
|
||||
const quint32 id = AddPlaceLabel(d.GetPlaceLabels().at(i), initData, children, drawName, dx, dy, pRotate,
|
||||
angle);
|
||||
const quint32 id = AddPlaceLabel(placeLabel, initData, children, drawName, dx, dy, pRotate, angle);
|
||||
newDetail.GetPlaceLabels().append(id);
|
||||
}
|
||||
children += nodeChildren;
|
||||
|
@ -1307,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;
|
||||
|
@ -1322,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;
|
||||
|
@ -1350,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1400,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)
|
||||
{
|
||||
|
@ -1442,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));
|
||||
}
|
||||
|
@ -1463,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)
|
||||
{
|
||||
|
@ -1482,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,
|
||||
|
@ -1645,9 +1648,9 @@ void VToolUnionDetails::incrementReferens()
|
|||
if (_referens == 1)
|
||||
{
|
||||
const QVector<quint32> objects = GetReferenceObjects();
|
||||
for(int i = 0; i < objects.size(); ++i)
|
||||
for(auto object : objects)
|
||||
{
|
||||
doc->IncrementReferens(objects.at(i));
|
||||
doc->IncrementReferens(object);
|
||||
}
|
||||
|
||||
QDomElement domElement = doc->elementById(m_id, getTagName());
|
||||
|
@ -1665,9 +1668,9 @@ void VToolUnionDetails::decrementReferens()
|
|||
if (_referens == 0)
|
||||
{
|
||||
const QVector<quint32> objects = GetReferenceObjects();
|
||||
for(int i = 0; i < objects.size(); ++i)
|
||||
for(auto object : objects)
|
||||
{
|
||||
doc->DecrementReferens(objects.at(i));
|
||||
doc->DecrementReferens(object);
|
||||
}
|
||||
|
||||
QDomElement domElement = doc->elementById(m_id, getTagName());
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -35,13 +35,15 @@
|
|||
VisToolPiece::VisToolPiece(const VContainer *data, QGraphicsItem *parent)
|
||||
: VisPath(data, parent),
|
||||
m_points(),
|
||||
m_curves(),
|
||||
m_line1(nullptr),
|
||||
m_line2(nullptr),
|
||||
m_piece(),
|
||||
m_pieceCached(false),
|
||||
m_cachedMainPath(),
|
||||
m_cachedNodes(),
|
||||
m_cachedMainPathPoints()
|
||||
m_cachedMainPathPoints(),
|
||||
m_cachedCurvesPath()
|
||||
{
|
||||
m_line1 = InitItem<VScaledLine>(supportColor, this);
|
||||
m_line2 = InitItem<VScaledLine>(supportColor, this);
|
||||
|
@ -56,11 +58,16 @@ void VisToolPiece::RefreshGeometry()
|
|||
{
|
||||
if (not m_pieceCached)
|
||||
{
|
||||
m_cachedMainPath = m_piece.MainPathPath(Visualization::data);
|
||||
m_cachedNodes = m_piece.MainPathNodePoints(Visualization::data);
|
||||
if (mode == Mode::Creation)
|
||||
{
|
||||
m_cachedCurvesPath = m_piece.CurvesPainterPath(Visualization::data);
|
||||
m_cachedMainPathPoints = m_piece.MainPathPoints(Visualization::data);
|
||||
m_cachedMainPath = VPiece::MainPathPath(m_cachedMainPathPoints);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_cachedMainPath = m_piece.MainPathPath(Visualization::data);
|
||||
}
|
||||
m_pieceCached = true;
|
||||
}
|
||||
|
@ -75,6 +82,12 @@ void VisToolPiece::RefreshGeometry()
|
|||
|
||||
if (mode == Mode::Creation)
|
||||
{
|
||||
for (int i = 0; i < m_cachedCurvesPath.size(); ++i)
|
||||
{
|
||||
VCurvePathItem *path = GetCurve(static_cast<quint32>(i), supportColor);
|
||||
DrawPath(path, m_cachedCurvesPath.at(i), supportColor);
|
||||
}
|
||||
|
||||
DrawLine(m_line1, QLineF(m_cachedMainPathPoints.first(), Visualization::scenePos), supportColor,
|
||||
Qt::DashLine);
|
||||
|
||||
|
@ -100,6 +113,12 @@ VScaledEllipse *VisToolPiece::GetPoint(quint32 i, const QColor &color)
|
|||
return GetPointItem(m_points, i, color, this);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VCurvePathItem *VisToolPiece::GetCurve(quint32 i, const QColor &color)
|
||||
{
|
||||
return GetCurveItem(m_curves, i, color, this);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolPiece::HideAllItems()
|
||||
{
|
||||
|
@ -113,9 +132,17 @@ void VisToolPiece::HideAllItems()
|
|||
m_line2->setVisible(false);
|
||||
}
|
||||
|
||||
for (int i=0; i < m_points.size(); ++i)
|
||||
for(QGraphicsEllipseItem *item : qAsConst(m_points))
|
||||
{
|
||||
if (QGraphicsEllipseItem *item = m_points.at(i))
|
||||
if (item)
|
||||
{
|
||||
item->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
for(QGraphicsPathItem *item : qAsConst(m_curves))
|
||||
{
|
||||
if (item)
|
||||
{
|
||||
item->setVisible(false);
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ public:
|
|||
private:
|
||||
Q_DISABLE_COPY(VisToolPiece)
|
||||
QVector<VScaledEllipse *> m_points;
|
||||
QVector<VCurvePathItem *> m_curves;
|
||||
|
||||
VScaledLine *m_line1;
|
||||
VScaledLine *m_line2;
|
||||
|
@ -58,8 +59,10 @@ private:
|
|||
QPainterPath m_cachedMainPath;
|
||||
QVector<VPointF> m_cachedNodes;
|
||||
QVector<QPointF> m_cachedMainPathPoints;
|
||||
QVector<QPainterPath> m_cachedCurvesPath;
|
||||
|
||||
VScaledEllipse* GetPoint(quint32 i, const QColor &color);
|
||||
VCurvePathItem *GetCurve(quint32 i, const QColor &color);
|
||||
|
||||
void HideAllItems();
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -59,6 +59,44 @@ template <class K, class V> class QHash;
|
|||
|
||||
Q_LOGGING_CATEGORY(vVis, "v.visualization")
|
||||
|
||||
namespace
|
||||
{
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VScaledEllipse *InitPointItem(const QColor &color, QGraphicsItem *parent, qreal z = 0)
|
||||
{
|
||||
VScaledEllipse *point = new VScaledEllipse(parent);
|
||||
point->setZValue(1);
|
||||
point->setBrush(QBrush(Qt::NoBrush));
|
||||
|
||||
QPen visPen = point->pen();
|
||||
visPen.setColor(color);
|
||||
|
||||
point->setPen(visPen);
|
||||
point->setRect(PointRect(ScaledRadius(SceneScale(qApp->getCurrentScene()))));
|
||||
point->setPos(QPointF());
|
||||
point->setFlags(QGraphicsItem::ItemStacksBehindParent);
|
||||
point->setZValue(z);
|
||||
point->setVisible(false);
|
||||
return point;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VCurvePathItem *InitCurveItem(const QColor &color, QGraphicsItem *parent, qreal z = 0)
|
||||
{
|
||||
VCurvePathItem *curve = new VCurvePathItem(parent);
|
||||
curve->setBrush(QBrush(Qt::NoBrush));
|
||||
|
||||
QPen visPen = curve->pen();
|
||||
visPen.setColor(color);
|
||||
curve->setPen(visPen);
|
||||
|
||||
curve->setFlags(QGraphicsItem::ItemStacksBehindParent);
|
||||
curve->setZValue(z);
|
||||
curve->setVisible(false);
|
||||
return curve;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
Visualization::Visualization(const VContainer *data)
|
||||
:QObject(),
|
||||
|
@ -261,23 +299,20 @@ VScaledEllipse *Visualization::GetPointItem(QVector<VScaledEllipse *> &points, q
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VScaledEllipse *Visualization::InitPointItem(const QColor &color, QGraphicsItem *parent, qreal z)
|
||||
VCurvePathItem *Visualization::GetCurveItem(QVector<VCurvePathItem *> &curves, quint32 i, const QColor &color,
|
||||
QGraphicsItem *parent)
|
||||
{
|
||||
VScaledEllipse *point = new VScaledEllipse(parent);
|
||||
point->setZValue(1);
|
||||
point->setBrush(QBrush(Qt::NoBrush));
|
||||
|
||||
QPen visPen = point->pen();
|
||||
visPen.setColor(color);
|
||||
|
||||
point->setPen(visPen);
|
||||
point->setRect(PointRect(ScaledRadius(SceneScale(qApp->getCurrentScene()))));
|
||||
point->setPos(QPointF());
|
||||
point->setFlags(QGraphicsItem::ItemStacksBehindParent);
|
||||
point->setZValue(z);
|
||||
point->setVisible(false);
|
||||
if (not curves.isEmpty() && static_cast<quint32>(curves.size() - 1) >= i)
|
||||
{
|
||||
return curves.at(static_cast<int>(i));
|
||||
}
|
||||
else
|
||||
{
|
||||
auto point = InitCurveItem(color, parent);
|
||||
curves.append(point);
|
||||
return point;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
Mode Visualization::GetMode() const
|
||||
|
|
|
@ -114,10 +114,10 @@ protected:
|
|||
|
||||
static VScaledEllipse *GetPointItem(QVector<VScaledEllipse *> &points, quint32 i, const QColor &color,
|
||||
QGraphicsItem *parent);
|
||||
static VCurvePathItem *GetCurveItem(QVector<VCurvePathItem *> &curves, quint32 i, const QColor &color,
|
||||
QGraphicsItem *parent);
|
||||
private:
|
||||
Q_DISABLE_COPY(Visualization)
|
||||
|
||||
static VScaledEllipse* InitPointItem(const QColor &color, QGraphicsItem *parent, qreal z = 0);
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -88,7 +88,7 @@ QSize FancyTabBar::TabSizeHint(bool minimum) const
|
|||
if (words.size() > 1)
|
||||
{
|
||||
QString sentence;
|
||||
foreach(const QString & word, words)
|
||||
for (auto &word : words)
|
||||
{
|
||||
sentence = sentence.isEmpty() ? sentence = word : sentence + QLatin1Char(' ') + word;
|
||||
|
||||
|
|
|
@ -114,7 +114,8 @@ void StyleHelper::setBaseColor(const QColor &newcolor)
|
|||
if (color.isValid() && color != m_baseColor)
|
||||
{
|
||||
m_baseColor = color;
|
||||
foreach (QWidget *w, QApplication::topLevelWidgets())
|
||||
const QWidgetList widgets = QApplication::topLevelWidgets();
|
||||
for (auto w : widgets)
|
||||
{
|
||||
w->update();
|
||||
}
|
||||
|
|
|
@ -106,8 +106,11 @@ QString VAbstractMainWindow::CSVFilePath()
|
|||
const QString suffix("csv");
|
||||
const QString path = QDir::homePath() + QLatin1String("/") + tr("values") + QLatin1String(".") + suffix;
|
||||
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Export to CSV"), path, filters, nullptr,
|
||||
QFileDialog::DontUseNativeDialog);
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Export to CSV"), path, filters, nullptr
|
||||
#ifdef Q_OS_LINUX
|
||||
, QFileDialog::DontUseNativeDialog
|
||||
#endif
|
||||
);
|
||||
|
||||
if (fileName.isEmpty())
|
||||
{
|
||||
|
|
|
@ -209,7 +209,7 @@ void VMainGraphicsScene::InitOrigins()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VMainGraphicsScene::SetOriginsVisible(bool visible)
|
||||
{
|
||||
foreach (QGraphicsItem *item, origins)
|
||||
for (auto item : qAsConst(origins))
|
||||
{
|
||||
item->setVisible(visible);
|
||||
}
|
||||
|
@ -225,7 +225,8 @@ QPointF VMainGraphicsScene::getScenePos() const
|
|||
QRectF VMainGraphicsScene::VisibleItemsBoundingRect() const
|
||||
{
|
||||
QRectF rect;
|
||||
foreach(QGraphicsItem *item, items())
|
||||
const QList<QGraphicsItem *> qItems = items();
|
||||
for (auto item : qItems)
|
||||
{
|
||||
if(not item->isVisible())
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
@ -692,7 +691,8 @@ void VMainGraphicsView::NewSceneRect(QGraphicsScene *sc, QGraphicsView *view, QG
|
|||
else
|
||||
{
|
||||
QRectF rect = item->sceneBoundingRect();
|
||||
foreach(QGraphicsItem *child, item->childItems())
|
||||
const QList<QGraphicsItem *> children = item->childItems();
|
||||
for (auto child : children)
|
||||
{
|
||||
if(child->isVisible())
|
||||
{
|
||||
|
|
|
@ -51,16 +51,16 @@ int main(int argc, char** argv)
|
|||
ASSERT_TEST(new TST_TSTranslation());
|
||||
|
||||
const QStringList locales = SupportedLocales();
|
||||
for(int l = 0, sz = locales.size(); l < sz; ++l)
|
||||
for(auto &locale : locales)
|
||||
{
|
||||
for(quint32 s = 0; s < TST_MeasurementRegExp::systemCounts; ++s)
|
||||
{
|
||||
ASSERT_TEST(new TST_MeasurementRegExp(s, locales.at(l)));
|
||||
ASSERT_TEST(new TST_MeasurementRegExp(s, locale));
|
||||
}
|
||||
|
||||
ASSERT_TEST(new TST_TSLocaleTranslation(locales.at(l)));
|
||||
ASSERT_TEST(new TST_BuitInRegExp(locales.at(l)));
|
||||
ASSERT_TEST(new TST_QmuParserErrorMsg(locales.at(l)));
|
||||
ASSERT_TEST(new TST_TSLocaleTranslation(locale));
|
||||
ASSERT_TEST(new TST_BuitInRegExp(locale));
|
||||
ASSERT_TEST(new TST_QmuParserErrorMsg(locale));
|
||||
}
|
||||
|
||||
return status;
|
||||
|
|
|
@ -183,11 +183,11 @@ void TST_BuitInRegExp::TestCheckInternalVaribleRegExp_data()
|
|||
QTest::addColumn<QString>("var");
|
||||
QTest::addColumn<QString>("originalName");
|
||||
|
||||
foreach(const QString &var, builInVariables)
|
||||
for (auto &var : qAsConst(builInVariables))
|
||||
{
|
||||
const QString tag = QString("Locale: '%1'. Var '%2'").arg(m_locale, var);
|
||||
const QStringList originalNames = AllNames();
|
||||
foreach(const QString &str, originalNames)
|
||||
for (auto &str : originalNames)
|
||||
{
|
||||
QTest::newRow(qUtf8Printable(tag)) << var << str;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -254,7 +254,7 @@ void TST_BuitInRegExp::PrepareData()
|
|||
|
||||
QTest::addColumn<QString>("originalName");
|
||||
|
||||
foreach(const QString &str, originalNames)
|
||||
for (auto &str : originalNames)
|
||||
{
|
||||
const QString tag = QString("Locale: '%1'. Name '%2'").arg(m_locale, str);
|
||||
QTest::newRow(qUtf8Printable(tag)) << str;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user