Refactoring.

Replace the redundant type with "auto".
This commit is contained in:
Roman Telezhynskyi 2024-04-30 11:48:51 +03:00
parent a81f878cd6
commit aaa40a5662
37 changed files with 111 additions and 109 deletions

View File

@ -1768,7 +1768,7 @@ void VPMainWindow::UpdateWindowTitle()
setWindowFilePath(curFile); setWindowFilePath(curFile);
#if defined(Q_OS_MAC) #if defined(Q_OS_MAC)
static QIcon fileIcon = QIcon(QCoreApplication::applicationDirPath() + "/../Resources/layout.icns"_L1); static auto fileIcon = QIcon(QCoreApplication::applicationDirPath() + "/../Resources/layout.icns"_L1);
QIcon icon; QIcon icon;
if (not curFile.isEmpty()) if (not curFile.isEmpty())
{ {

View File

@ -103,7 +103,7 @@ void InitMinMax(qreal &min, qreal &max, const MeasurementDimension_p &dimension,
void SetCellIcon(QTableWidgetItem *item, const QVector<qreal> &validRows, qreal rowValue, qreal columnValue, void SetCellIcon(QTableWidgetItem *item, const QVector<qreal> &validRows, qreal rowValue, qreal columnValue,
const VDimensionRestriction &restriction, qreal min, qreal max) const VDimensionRestriction &restriction, qreal min, qreal max)
{ {
const QIcon closeIcon = QIcon(QStringLiteral("://icon/24x24/close.png")); const auto closeIcon = QIcon(QStringLiteral("://icon/24x24/close.png"));
if (VFuzzyContains(validRows, rowValue)) if (VFuzzyContains(validRows, rowValue))
{ {

View File

@ -315,7 +315,7 @@ void TKMMainWindow::UpdateWindowTitle()
setWindowFilePath(m_curFile); setWindowFilePath(m_curFile);
#if defined(Q_OS_MAC) #if defined(Q_OS_MAC)
static QIcon fileIcon = QIcon(QCoreApplication::applicationDirPath() + "/../Resources/measurements.icns"_L1); static auto fileIcon = QIcon(QCoreApplication::applicationDirPath() + "/../Resources/measurements.icns"_L1);
QIcon icon; QIcon icon;
if (not m_curFile.isEmpty()) if (not m_curFile.isEmpty())
{ {
@ -1346,7 +1346,7 @@ void TKMMainWindow::SaveMUnits()
} }
const QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName); const QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName);
const MUnits units = static_cast<MUnits>(ui->comboBoxMUnits->currentData().toInt()); const auto units = static_cast<MUnits>(ui->comboBoxMUnits->currentData().toInt());
m_m->SetMSpecialUnits(nameField->data(Qt::UserRole).toString(), units == MUnits::Degrees); m_m->SetMSpecialUnits(nameField->data(Qt::UserRole).toString(), units == MUnits::Degrees);
MeasurementsWereSaved(false); MeasurementsWereSaved(false);
@ -2234,8 +2234,8 @@ void TKMMainWindow::RefreshImages()
QSize const size = i.value().Size(); QSize const size = i.value().Size();
QSize const targetSize = ui->listWidget->iconSize(); QSize const targetSize = ui->listWidget->iconSize();
double const scalingFactorWidth = static_cast<double>(targetSize.width()) / size.width(); auto const scalingFactorWidth = static_cast<double>(targetSize.width()) / size.width();
double const scalingFactorHeight = static_cast<double>(targetSize.height()) / size.height(); auto const scalingFactorHeight = static_cast<double>(targetSize.height()) / size.height();
int newWidth; int newWidth;
int newHeight; int newHeight;

View File

@ -1207,7 +1207,7 @@ void TMainWindow::SaveEmail()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void TMainWindow::SaveGender(int index) void TMainWindow::SaveGender(int index)
{ {
const GenderType type = static_cast<GenderType>(ui->comboBoxGender->itemData(index).toInt()); const auto type = static_cast<GenderType>(ui->comboBoxGender->itemData(index).toInt());
if (m_m->Gender() != type) if (m_m->Gender() != type)
{ {
m_m->SetGender(type); m_m->SetGender(type);
@ -2521,7 +2521,7 @@ void TMainWindow::SaveMUnits()
} }
const QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName); const QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName);
const MUnits units = static_cast<MUnits>(ui->comboBoxMUnits->currentData().toInt()); const auto units = static_cast<MUnits>(ui->comboBoxMUnits->currentData().toInt());
m_m->SetMSpecialUnits(nameField->data(Qt::UserRole).toString(), units == MUnits::Degrees); m_m->SetMSpecialUnits(nameField->data(Qt::UserRole).toString(), units == MUnits::Degrees);
MeasurementsWereSaved(false); MeasurementsWereSaved(false);
@ -2547,7 +2547,7 @@ void TMainWindow::SaveMDimension()
} }
const QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName); const QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName);
const IMD dimension = static_cast<IMD>(ui->comboBoxDimension->currentData().toInt()); const auto dimension = static_cast<IMD>(ui->comboBoxDimension->currentData().toInt());
m_m->SetMDimension(nameField->data(Qt::UserRole).toString(), dimension); m_m->SetMDimension(nameField->data(Qt::UserRole).toString(), dimension);
MeasurementsWereSaved(false); MeasurementsWereSaved(false);
@ -3013,7 +3013,7 @@ void TMainWindow::InitWindow()
ui->comboBoxGender->setCurrentIndex(index); ui->comboBoxGender->setCurrentIndex(index);
{ {
const QLocale dateLocale = QLocale(VAbstractApplication::VApp()->Settings()->GetLocale()); const auto dateLocale = QLocale(VAbstractApplication::VApp()->Settings()->GetLocale());
ui->dateEditBirthDate->setLocale(dateLocale); ui->dateEditBirthDate->setLocale(dateLocale);
ui->dateEditBirthDate->setDisplayFormat(dateLocale.dateFormat()); ui->dateEditBirthDate->setDisplayFormat(dateLocale.dateFormat());
ui->dateEditBirthDate->setDate(m_m->BirthDate()); ui->dateEditBirthDate->setDate(m_m->BirthDate());
@ -3801,7 +3801,7 @@ void TMainWindow::UpdateWindowTitle()
setWindowFilePath(m_curFile); setWindowFilePath(m_curFile);
#if defined(Q_OS_MAC) #if defined(Q_OS_MAC)
static QIcon fileIcon = QIcon(QCoreApplication::applicationDirPath() + "/../Resources/measurements.icns"_L1); static auto fileIcon = QIcon(QCoreApplication::applicationDirPath() + "/../Resources/measurements.icns"_L1);
QIcon icon; QIcon icon;
if (not m_curFile.isEmpty()) if (not m_curFile.isEmpty())
{ {

View File

@ -107,7 +107,7 @@ PreferencesPatternPage::PreferencesPatternPage(QWidget *parent)
connect(ui->comboBoxLineWidthUnit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, connect(ui->comboBoxLineWidthUnit, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
[this]() [this]()
{ {
const Unit lineUnit = static_cast<Unit>(ui->comboBoxLineWidthUnit->currentData().toInt()); const auto lineUnit = static_cast<Unit>(ui->comboBoxLineWidthUnit->currentData().toInt());
const qreal value = UnitConvertor(ui->doubleSpinBoxLineWidth->value(), m_oldLineUnit, lineUnit); const qreal value = UnitConvertor(ui->doubleSpinBoxLineWidth->value(), m_oldLineUnit, lineUnit);
ui->doubleSpinBoxLineWidth->setDecimals(lineUnit == Unit::Mm ? 1 : 6); ui->doubleSpinBoxLineWidth->setDecimals(lineUnit == Unit::Mm ? 1 : 6);
ui->doubleSpinBoxLineWidth->setMinimum( ui->doubleSpinBoxLineWidth->setMinimum(

View File

@ -1700,7 +1700,7 @@ void DialogIncrements::SaveIncrUnits()
const QTableWidgetItem *nameField = table->item(row, 0); const QTableWidgetItem *nameField = table->item(row, 0);
const IncrUnits units = static_cast<IncrUnits>(combo->currentData().toInt()); const auto units = static_cast<IncrUnits>(combo->currentData().toInt());
m_doc->SetIncrementSpecialUnits(nameField->text(), units == IncrUnits::Degrees); m_doc->SetIncrementSpecialUnits(nameField->text(), units == IncrUnits::Degrees);
LocalUpdateTree(); LocalUpdateTree();

View File

@ -900,7 +900,7 @@ auto DialogLayoutSettings::MakeHelpTiledPdfTemplateList() -> QString
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto DialogLayoutSettings::Template() -> QSizeF auto DialogLayoutSettings::Template() -> QSizeF
{ {
const PaperSizeTemplate temp = static_cast<PaperSizeTemplate>(ui->comboBoxTemplates->currentData().toInt()); const auto temp = static_cast<PaperSizeTemplate>(ui->comboBoxTemplates->currentData().toInt());
const Unit paperUnit = PaperUnit(); const Unit paperUnit = PaperUnit();

View File

@ -330,7 +330,7 @@ auto DialogSaveLayout::IsShowGrainline() const -> bool
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto DialogSaveLayout::MakeHelpFormatList() -> QString auto DialogSaveLayout::MakeHelpFormatList() -> QString
{ {
QString out(QStringLiteral("\n")); auto out = QStringLiteral("\n");
const auto formats = InitFormats(); const auto formats = InitFormats();
for (int i = 0; i < formats.size(); ++i) for (int i = 0; i < formats.size(); ++i)
{ {
@ -891,7 +891,7 @@ void DialogSaveLayout::WriteSettings() const
settings->SetTiledPDFMargins(margins, unit); settings->SetTiledPDFMargins(margins, unit);
// write Template // write Template
const PaperSizeTemplate temp = static_cast<PaperSizeTemplate>(ui->comboBoxTemplates->currentData().toInt()); const auto temp = static_cast<PaperSizeTemplate>(ui->comboBoxTemplates->currentData().toInt());
const QSizeF size = GetTemplateSize(temp, Unit::Mm); const QSizeF size = GetTemplateSize(temp, Unit::Mm);
settings->SetTiledPDFPaperHeight(size.height(), Unit::Mm); settings->SetTiledPDFPaperHeight(size.height(), Unit::Mm);

View File

@ -7567,7 +7567,7 @@ void MainWindow::UpdateWindowTitle()
setWindowFilePath(VAbstractValApplication::VApp()->GetPatternPath()); setWindowFilePath(VAbstractValApplication::VApp()->GetPatternPath());
#if defined(Q_OS_MAC) #if defined(Q_OS_MAC)
static QIcon fileIcon = QIcon(QCoreApplication::applicationDirPath() + "/../Resources/Valentina.icns"_L1); static auto fileIcon = QIcon(QCoreApplication::applicationDirPath() + "/../Resources/Valentina.icns"_L1);
QIcon icon; QIcon icon;
if (not VAbstractValApplication::VApp()->GetPatternPath().isEmpty()) if (not VAbstractValApplication::VApp()->GetPatternPath().isEmpty())
{ {

View File

@ -144,7 +144,7 @@ void QmuFormulaBase::SetSepForTr(bool osSeparator, bool fromUser)
{ {
if (fromUser) if (fromUser)
{ {
const QLocale loc = QLocale(); const QLocale loc;
setLocale(loc); setLocale(loc);
SetArgSep(';'); SetArgSep(';');
setCNumbers(not osSeparator); setCNumbers(not osSeparator);

View File

@ -97,7 +97,7 @@ auto GetSystemMemorySize() -> qint64
host_statistics64(machPort, HOST_VM_INFO, reinterpret_cast<host_info64_t>(&vmStats), &count); host_statistics64(machPort, HOST_VM_INFO, reinterpret_cast<host_info64_t>(&vmStats), &count);
qulonglong freeMemory = static_cast<qulonglong>(vmStats.free_count) * static_cast<qulonglong>(pageSize); auto freeMemory = static_cast<qulonglong>(vmStats.free_count) * static_cast<qulonglong>(pageSize);
qulonglong totalMemoryUsed = qulonglong totalMemoryUsed =
(static_cast<qulonglong>(vmStats.active_count) + static_cast<qulonglong>(vmStats.inactive_count) + (static_cast<qulonglong>(vmStats.active_count) + static_cast<qulonglong>(vmStats.inactive_count) +
static_cast<qulonglong>(vmStats.wire_count)) * static_cast<qulonglong>(vmStats.wire_count)) *

View File

@ -308,7 +308,7 @@ auto VArc::GetPoints() const -> QVector<QPointF>
{ {
const qreal lDistance = qAbs(d->radius) * 4.0 / 3.0 * qTan(qDegreesToRadians(sectionAngle.at(i)) * 0.25); const qreal lDistance = qAbs(d->radius) * 4.0 / 3.0 * qTan(qDegreesToRadians(sectionAngle.at(i)) * 0.25);
const QPointF center = static_cast<QPointF>(GetCenter()); const auto center = static_cast<QPointF>(GetCenter());
QLineF lineP1P2(pStart, center); QLineF lineP1P2(pStart, center);
lineP1P2.setAngle(lineP1P2.angle() - 90.0); lineP1P2.setAngle(lineP1P2.angle() - 90.0);

View File

@ -216,7 +216,7 @@ auto VCubicBezierPath::GetSpline(vsizetype index) const -> VSpline
auto p2 = static_cast<QPointF>(d->path.at(base + 1)); auto p2 = static_cast<QPointF>(d->path.at(base + 1));
if (base + 1 > 1) if (base + 1 > 1)
{ {
const QPointF b = static_cast<QPointF>(d->path.at(base)); const auto b = static_cast<QPointF>(d->path.at(base));
QLineF const foot1(b, static_cast<QPointF>(d->path.at(base - 1))); QLineF const foot1(b, static_cast<QPointF>(d->path.at(base - 1)));
QLineF foot2(b, p2); QLineF foot2(b, p2);

View File

@ -126,7 +126,7 @@ auto EllipseCore(fpm::fixed_16_16 xC, fpm::fixed_16_16 yC, fpm::fixed_16_16 xP,
-> QVector<QPointF> -> QVector<QPointF>
{ {
uint const k = qMin(static_cast<uint>(AngularInc(xP, yP, xQ, yQ, flatness)), 16U); uint const k = qMin(static_cast<uint>(AngularInc(xP, yP, xQ, yQ, flatness)), 16U);
const uint count = static_cast<std::uint32_t>(sweep.raw_value()) >> (16 - k); const auto count = static_cast<std::uint32_t>(sweep.raw_value()) >> (16 - k);
QVector<QPointF> arc; QVector<QPointF> arc;
arc.reserve(static_cast<int>(count) + 1); arc.reserve(static_cast<int>(count) + 1);

View File

@ -564,10 +564,10 @@ auto VSpline::ParamT(const QPointF &pBt) const -> qreal
// Here we try find closest to our point. // Here we try find closest to our point.
for (auto t : qAsConst(ts)) for (auto t : qAsConst(ts))
{ {
const QPointF p0 = static_cast<QPointF>(GetP1()); const auto p0 = static_cast<QPointF>(GetP1());
const QPointF p1 = static_cast<QPointF>(GetP2()); const auto p1 = static_cast<QPointF>(GetP2());
const QPointF p2 = static_cast<QPointF>(GetP3()); const auto p2 = static_cast<QPointF>(GetP3());
const QPointF p3 = static_cast<QPointF>(GetP4()); const auto p3 = static_cast<QPointF>(GetP4());
// The explicit form of the Cubic Bézier curve // The explicit form of the Cubic Bézier curve
const qreal pointX = pow(1 - t, 3) * p0.x() + 3 * pow(1 - t, 2) * t * p1.x() + const qreal pointX = pow(1 - t, 3) * p0.x() + 3 * pow(1 - t, 2) * t * p1.x() +
3 * (1 - t) * pow(t, 2) * p2.x() + pow(t, 3) * p3.x(); 3 * (1 - t) * pow(t, 2) * p2.x() + pow(t, 3) * p3.x();

View File

@ -552,7 +552,7 @@ void WatermarkWindow::UpdateWindowTitle()
setWindowFilePath(m_curFile); setWindowFilePath(m_curFile);
#if defined(Q_OS_MAC) #if defined(Q_OS_MAC)
static QIcon fileIcon = QIcon(QCoreApplication::applicationDirPath() + "/../Resources/Valentina.icns"_L1); static auto fileIcon = QIcon(QCoreApplication::applicationDirPath() + "/../Resources/Valentina.icns"_L1);
QIcon icon; QIcon icon;
if (not m_curFile.isEmpty()) if (not m_curFile.isEmpty())
{ {

View File

@ -104,7 +104,7 @@ void InitLanguageList(QComboBox *combobox)
continue; continue;
} }
QLocale const loc = QLocale(locale); auto const loc = QLocale(locale);
QString const lang = loc.nativeLanguageName(); QString const lang = loc.nativeLanguageName();
QString country = TerritoryToString(loc); QString country = TerritoryToString(loc);
if (country == "Czechia"_L1) if (country == "Czechia"_L1)

View File

@ -45,7 +45,7 @@ Q_GLOBAL_STATIC(QMutex, svgPathTokenizerMutex) // NOLINT
QT_WARNING_POP QT_WARNING_POP
const qreal V_PI = static_cast<qreal>(M_PI); // pi const auto V_PI = static_cast<qreal>(M_PI); // pi
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto IsCommand(const QChar &ch) -> bool auto IsCommand(const QChar &ch) -> bool

View File

@ -1051,7 +1051,7 @@ void VCommonSettings::SetCSVSeparator(const QChar &separator)
auto VCommonSettings::GetCSVSeparator() const -> QChar auto VCommonSettings::GetCSVSeparator() const -> QChar
{ {
QSettings const settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); QSettings const settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
const quint8 separator = static_cast<quint8>(settings.value(*settingCSVSeparator, 3).toUInt()); const auto separator = static_cast<quint8>(settings.value(*settingCSVSeparator, 3).toUInt());
switch (separator) switch (separator)
{ {
case 0: case 0:
@ -1596,7 +1596,7 @@ void VCommonSettings::SetTiledPDFMargins(const QMarginsF &value, const Unit &uni
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VCommonSettings::GetTiledPDFOrientation() const -> PageOrientation auto VCommonSettings::GetTiledPDFOrientation() const -> PageOrientation
{ {
bool const defaultValue = static_cast<bool>(PageOrientation::Portrait); auto const defaultValue = static_cast<bool>(PageOrientation::Portrait);
bool const result = value(*settingTiledPDFOrientation, defaultValue).toBool(); bool const result = value(*settingTiledPDFOrientation, defaultValue).toBool();
return static_cast<PageOrientation>(result); return static_cast<PageOrientation>(result);
} }

View File

@ -46,7 +46,7 @@ auto CurvePoint(VSAPoint candidate, const VContainer *data, const VPieceNode &no
{ {
if (node.GetTypeTool() == Tool::NodePoint) if (node.GetTypeTool() == Tool::NodePoint)
{ {
const QPointF p = static_cast<QPointF>(*data->GeometricObject<VPointF>(node.GetId())); const auto p = static_cast<QPointF>(*data->GeometricObject<VPointF>(node.GetId()));
if (VAbstractCurve::IsPointOnCurve(curvePoints, p)) if (VAbstractCurve::IsPointOnCurve(curvePoints, p))
{ {
candidate = VSAPoint(p); candidate = VSAPoint(p);
@ -864,7 +864,7 @@ auto VPiecePath::RemoveEdge(quint32 index) const -> VPiecePath
path.Clear(); path.Clear();
// Edge can be only segment. We ignore all curves inside segments. // Edge can be only segment. We ignore all curves inside segments.
const quint32 edges = static_cast<quint32>(ListNodePoint().size()); const auto edges = static_cast<quint32>(ListNodePoint().size());
for (quint32 i = 0; i < edges; ++i) for (quint32 i = 0; i < edges; ++i)
{ {
VPieceNode p1; VPieceNode p1;

View File

@ -375,7 +375,7 @@ void VTranslateVars::TranslateVarsFromUser(QString &newFormula, QMap<vsizetype,
void VTranslateVars::TranslateNumbersFromUser(QString &newFormula, QMap<vsizetype, QString> &tokens, void VTranslateVars::TranslateNumbersFromUser(QString &newFormula, QMap<vsizetype, QString> &tokens,
QMap<vsizetype, QString> &numbers, bool osSeparator) QMap<vsizetype, QString> &numbers, bool osSeparator)
{ {
QLocale loc = QLocale(); // User locale QLocale loc; // User locale
if (loc != QLocale::c() && osSeparator) if (loc != QLocale::c() && osSeparator)
{ // User want use Os separator { // User want use Os separator
QList<vsizetype> nKeys = numbers.keys(); // Positions for all numbers in expression QList<vsizetype> nKeys = numbers.keys(); // Positions for all numbers in expression
@ -453,7 +453,7 @@ void VTranslateVars::TranslateVarsToUser(QString &newFormula, QMap<vsizetype, QS
void VTranslateVars::TranslateNumbersToUser(QString &newFormula, QMap<vsizetype, QString> &tokens, void VTranslateVars::TranslateNumbersToUser(QString &newFormula, QMap<vsizetype, QString> &tokens,
QMap<vsizetype, QString> &numbers, bool osSeparator) QMap<vsizetype, QString> &numbers, bool osSeparator)
{ {
QLocale loc = QLocale(); // User locale QLocale loc; // User locale
if (loc != QLocale::C && osSeparator) if (loc != QLocale::C && osSeparator)
{ // User want use Os separator { // User want use Os separator
QList<vsizetype> nKeys = numbers.keys(); // Positions for all numbers in expression QList<vsizetype> nKeys = numbers.keys(); // Positions for all numbers in expression

View File

@ -269,9 +269,9 @@ void DialogHeight::PointNameChanged()
try try
{ {
const QPointF basePoint = static_cast<QPointF>(*data->GeometricObject<VPointF>(basePointId)); const auto basePoint = static_cast<QPointF>(*data->GeometricObject<VPointF>(basePointId));
const QPointF p1Line = static_cast<QPointF>(*data->GeometricObject<VPointF>(p1LineId)); const auto p1Line = static_cast<QPointF>(*data->GeometricObject<VPointF>(p1LineId));
const QPointF p2Line = static_cast<QPointF>(*data->GeometricObject<VPointF>(p2LineId)); const auto p2Line = static_cast<QPointF>(*data->GeometricObject<VPointF>(p2LineId));
if (set.size() != 3 || VGObject::ClosestPoint(QLineF(p1Line, p2Line), basePoint) == QPointF()) if (set.size() != 3 || VGObject::ClosestPoint(QLineF(p1Line, p2Line), basePoint) == QPointF())
{ {

View File

@ -1436,7 +1436,7 @@ void DialogPiecePath::NodeAngleChanged(int index)
QListWidgetItem *rowItem = GetItemById(ui->comboBoxNodes->currentData().toUInt()); QListWidgetItem *rowItem = GetItemById(ui->comboBoxNodes->currentData().toUInt());
if (rowItem) if (rowItem)
{ {
const PieceNodeAngle angle = static_cast<PieceNodeAngle>(ui->comboBoxAngle->currentData().toUInt()); const auto angle = static_cast<PieceNodeAngle>(ui->comboBoxAngle->currentData().toUInt());
auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole)); auto rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
rowNode.SetAngleType(angle); rowNode.SetAngleType(angle);
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));

View File

@ -111,7 +111,7 @@ auto VToolFlippingByAxis::Create(const QPointer<DialogTool> &dialog, VMainGraphi
auto VToolFlippingByAxis::Create(VToolFlippingByAxisInitData initData) -> VToolFlippingByAxis * auto VToolFlippingByAxis::Create(VToolFlippingByAxisInitData initData) -> VToolFlippingByAxis *
{ {
const auto originPoint = *initData.data->GeometricObject<VPointF>(initData.originPointId); const auto originPoint = *initData.data->GeometricObject<VPointF>(initData.originPointId);
const QPointF fPoint = static_cast<QPointF>(originPoint); const auto fPoint = static_cast<QPointF>(originPoint);
QPointF sPoint; QPointF sPoint;
if (initData.axisType == AxisType::VerticalAxis) if (initData.axisType == AxisType::VerticalAxis)

View File

@ -111,10 +111,10 @@ auto VToolFlippingByLine::Create(const QPointer<DialogTool> &dialog, VMainGraphi
auto VToolFlippingByLine::Create(VToolFlippingByLineInitData initData) -> VToolFlippingByLine * auto VToolFlippingByLine::Create(VToolFlippingByLineInitData initData) -> VToolFlippingByLine *
{ {
const auto firstPoint = *initData.data->GeometricObject<VPointF>(initData.firstLinePointId); const auto firstPoint = *initData.data->GeometricObject<VPointF>(initData.firstLinePointId);
const QPointF fPoint = static_cast<QPointF>(firstPoint); const auto fPoint = static_cast<QPointF>(firstPoint);
const auto secondPoint = *initData.data->GeometricObject<VPointF>(initData.secondLinePointId); const auto secondPoint = *initData.data->GeometricObject<VPointF>(initData.secondLinePointId);
const QPointF sPoint = static_cast<QPointF>(secondPoint); const auto sPoint = static_cast<QPointF>(secondPoint);
CreateDestination(initData, fPoint, sPoint); CreateDestination(initData, fPoint, sPoint);

View File

@ -135,7 +135,7 @@ auto VToolRotation::Create(VToolRotationInitData &initData) -> VToolRotation *
calcAngle = CheckFormula(initData.id, initData.angle, initData.data); calcAngle = CheckFormula(initData.id, initData.angle, initData.data);
const auto originPoint = *initData.data->GeometricObject<VPointF>(initData.origin); const auto originPoint = *initData.data->GeometricObject<VPointF>(initData.origin);
const QPointF oPoint = static_cast<QPointF>(originPoint); const auto oPoint = static_cast<QPointF>(originPoint);
if (initData.typeCreation == Source::FromGui) if (initData.typeCreation == Source::FromGui)
{ {

View File

@ -465,8 +465,8 @@ void VToolSpline::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
const QPointF offset0 = ((1 - weight) / (3 * t * (1 - t) * (1 - t))) * delta; const QPointF offset0 = ((1 - weight) / (3 * t * (1 - t) * (1 - t))) * delta;
const QPointF offset1 = (weight / (3 * t * t * (1 - t))) * delta; const QPointF offset1 = (weight / (3 * t * t * (1 - t))) * delta;
const QPointF p2 = static_cast<QPointF>(spline->GetP2()) + offset0; const auto p2 = static_cast<QPointF>(spline->GetP2()) + offset0;
const QPointF p3 = static_cast<QPointF>(spline->GetP3()) + offset1; const auto p3 = static_cast<QPointF>(spline->GetP3()) + offset1;
oldPosition = event->scenePos(); // Now mouse here oldPosition = event->scenePos(); // Now mouse here

View File

@ -676,8 +676,8 @@ void VToolSplinePath::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
const QPointF offset0 = ((1 - weight) / (3 * t * (1 - t) * (1 - t))) * delta; const QPointF offset0 = ((1 - weight) / (3 * t * (1 - t) * (1 - t))) * delta;
const QPointF offset1 = (weight / (3 * t * t * (1 - t))) * delta; const QPointF offset1 = (weight / (3 * t * t * (1 - t))) * delta;
const QPointF p2 = static_cast<QPointF>(spline.GetP2()) + offset0; const auto p2 = static_cast<QPointF>(spline.GetP2()) + offset0;
const QPointF p3 = static_cast<QPointF>(spline.GetP3()) + offset1; const auto p3 = static_cast<QPointF>(spline.GetP3()) + offset1;
oldPosition = event->scenePos(); // Now mouse here oldPosition = event->scenePos(); // Now mouse here

View File

@ -81,8 +81,8 @@ VToolLinePoint::VToolLinePoint(VAbstractPattern *doc, VContainer *data, const qu
{ {
this->m_lineType = typeLine; this->m_lineType = typeLine;
Q_ASSERT_X(basePointId != 0, Q_FUNC_INFO, "basePointId == 0"); //-V654 //-V712 Q_ASSERT_X(basePointId != 0, Q_FUNC_INFO, "basePointId == 0"); //-V654 //-V712
QPointF const point1 = static_cast<QPointF>(*data->GeometricObject<VPointF>(basePointId)); auto const point1 = static_cast<QPointF>(*data->GeometricObject<VPointF>(basePointId));
QPointF const point2 = static_cast<QPointF>(*data->GeometricObject<VPointF>(id)); auto const point2 = static_cast<QPointF>(*data->GeometricObject<VPointF>(id));
QLineF const line(point1 - point2, QPointF()); QLineF const line(point1 - point2, QPointF());
mainLine = new VScaledLine(line, VColorRole::CustomColor, this); mainLine = new VScaledLine(line, VColorRole::CustomColor, this);
mainLine->SetBoldLine(false); mainLine->SetBoldLine(false);
@ -115,8 +115,8 @@ void VToolLinePoint::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
void VToolLinePoint::RefreshGeometry() void VToolLinePoint::RefreshGeometry()
{ {
VToolSinglePoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<VPointF>(m_id)); VToolSinglePoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<VPointF>(m_id));
QPointF const point = static_cast<QPointF>(*VDrawTool::data.GeometricObject<VPointF>(m_id)); auto const point = static_cast<QPointF>(*VDrawTool::data.GeometricObject<VPointF>(m_id));
QPointF const basePoint = static_cast<QPointF>(*VDrawTool::data.GeometricObject<VPointF>(basePointId)); auto const basePoint = static_cast<QPointF>(*VDrawTool::data.GeometricObject<VPointF>(basePointId));
QLineF const line(basePoint - point, QPointF()); QLineF const line(basePoint - point, QPointF());
mainLine->setLine(line); mainLine->setLine(line);
mainLine->setVisible(not line.isNull()); mainLine->setVisible(not line.isNull());

View File

@ -34,8 +34,10 @@
#include "../../../../dialogs/tools/dialogpointfromarcandtangent.h" #include "../../../../dialogs/tools/dialogpointfromarcandtangent.h"
#include "../../../../dialogs/tools/dialogtool.h" #include "../../../../dialogs/tools/dialogtool.h"
#include "../../../../visualization/visualization.h"
#include "../../../../visualization/line/vistoolpointfromarcandtangent.h" #include "../../../../visualization/line/vistoolpointfromarcandtangent.h"
#include "../../../../visualization/visualization.h"
#include "../../../vabstracttool.h"
#include "../../vdrawtool.h"
#include "../ifc/exception/vexception.h" #include "../ifc/exception/vexception.h"
#include "../ifc/exception/vexceptionobjecterror.h" #include "../ifc/exception/vexceptionobjecterror.h"
#include "../ifc/ifcdef.h" #include "../ifc/ifcdef.h"
@ -44,8 +46,6 @@
#include "../vgeometry/vpointf.h" #include "../vgeometry/vpointf.h"
#include "../vpatterndb/vcontainer.h" #include "../vpatterndb/vcontainer.h"
#include "../vwidgets/vmaingraphicsscene.h" #include "../vwidgets/vmaingraphicsscene.h"
#include "../../../vabstracttool.h"
#include "../../vdrawtool.h"
#include "vtoolsinglepoint.h" #include "vtoolsinglepoint.h"
template <class T> class QSharedPointer; template <class T> class QSharedPointer;
@ -55,7 +55,7 @@ const QString VToolPointFromArcAndTangent::ToolType = QStringLiteral("pointFromA
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VToolPointFromArcAndTangent::VToolPointFromArcAndTangent(const VToolPointFromArcAndTangentInitData &initData, VToolPointFromArcAndTangent::VToolPointFromArcAndTangent(const VToolPointFromArcAndTangentInitData &initData,
QGraphicsItem *parent) QGraphicsItem *parent)
:VToolSinglePoint(initData.doc, initData.data, initData.id, initData.notes, parent), : VToolSinglePoint(initData.doc, initData.data, initData.id, initData.notes, parent),
arcId(initData.arcId), arcId(initData.arcId),
tangentPointId(initData.tangentPointId), tangentPointId(initData.tangentPointId),
crossPoint(initData.crossPoint) crossPoint(initData.crossPoint)
@ -112,15 +112,16 @@ auto VToolPointFromArcAndTangent::Create(VToolPointFromArcAndTangentInitData ini
const VPointF tPoint = *initData.data->GeometricObject<VPointF>(initData.tangentPointId); const VPointF tPoint = *initData.data->GeometricObject<VPointF>(initData.tangentPointId);
QPointF point; QPointF point;
const bool success = VToolPointFromArcAndTangent::FindPoint(static_cast<QPointF>(tPoint), &arc, const bool success =
initData.crossPoint, &point); VToolPointFromArcAndTangent::FindPoint(static_cast<QPointF>(tPoint), &arc, initData.crossPoint, &point);
if (not success) if (not success)
{ {
const QString errorMsg = tr("Error calculating point '%1'. Tangent to arc '%2' from point '%3' cannot be found") const QString errorMsg = tr("Error calculating point '%1'. Tangent to arc '%2' from point '%3' cannot be found")
.arg(initData.name, arc.ObjectName(), tPoint.name()); .arg(initData.name, arc.ObjectName(), tPoint.name());
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionObjectError(errorMsg) : VAbstractApplication::VApp()->IsPedantic()
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg; ? throw VExceptionObjectError(errorMsg)
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
} }
auto *p = new VPointF(point, initData.name, initData.mx, initData.my); auto *p = new VPointF(point, initData.name, initData.mx, initData.my);
@ -160,17 +161,17 @@ auto VToolPointFromArcAndTangent::FindPoint(const QPointF &p, const VArc *arc, c
SCASSERT(intersectionPoint != nullptr) SCASSERT(intersectionPoint != nullptr)
QPointF p1, p2; QPointF p1, p2;
const QPointF center = static_cast<QPointF>(arc->GetCenter()); const auto center = static_cast<QPointF>(arc->GetCenter());
const qreal radius = arc->GetRadius(); const qreal radius = arc->GetRadius();
const int res = VGObject::ContactPoints (p, center, radius, p1, p2); const int res = VGObject::ContactPoints(p, center, radius, p1, p2);
QLineF r1Arc(center, p1); QLineF r1Arc(center, p1);
r1Arc.setLength(radius+10); r1Arc.setLength(radius + 10);
QLineF r2Arc(center, p2); QLineF r2Arc(center, p2);
r2Arc.setLength(radius+10); r2Arc.setLength(radius + 10);
switch(res) switch (res)
{ {
case 2: case 2:
{ {
@ -188,7 +189,7 @@ auto VToolPointFromArcAndTangent::FindPoint(const QPointF &p, const VArc *arc, c
++localRes; ++localRes;
} }
switch(localRes) switch (localRes)
{ {
case 2: case 2:
*intersectionPoint = (pType == CrossCirclesPoint::FirstPoint ? p1 : p2); *intersectionPoint = (pType == CrossCirclesPoint::FirstPoint ? p1 : p2);
@ -261,10 +262,10 @@ void VToolPointFromArcAndTangent::ShowContextMenu(QGraphicsSceneContextMenuEvent
{ {
ContextMenu<DialogPointFromArcAndTangent>(event, id); ContextMenu<DialogPointFromArcAndTangent>(event, id);
} }
catch(const VExceptionToolWasDeleted &e) catch (const VExceptionToolWasDeleted &e)
{ {
Q_UNUSED(e) Q_UNUSED(e)
return;//Leave this method immediately!!! return; // Leave this method immediately!!!
} }
} }
@ -298,7 +299,7 @@ void VToolPointFromArcAndTangent::SaveDialog(QDomElement &domElement, QList<quin
QString().setNum(static_cast<int>(dialogTool->GetCrossCirclesPoint()))); QString().setNum(static_cast<int>(dialogTool->GetCrossCirclesPoint())));
doc->SetAttributeOrRemoveIf<QString>(domElement, AttrNotes, dialogTool->GetNotes(), doc->SetAttributeOrRemoveIf<QString>(domElement, AttrNotes, dialogTool->GetNotes(),
[](const QString &notes) noexcept {return notes.isEmpty();}); [](const QString &notes) noexcept { return notes.isEmpty(); });
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -33,7 +33,11 @@
#include <new> #include <new>
#include "../../../../dialogs/tools/dialogpointofintersectionarcs.h" #include "../../../../dialogs/tools/dialogpointofintersectionarcs.h"
#include "../../../../dialogs/tools/dialogtool.h"
#include "../../../../visualization/line/vistoolpointofintersectionarcs.h" #include "../../../../visualization/line/vistoolpointofintersectionarcs.h"
#include "../../../../visualization/visualization.h"
#include "../../../vabstracttool.h"
#include "../../vdrawtool.h"
#include "../ifc/exception/vexception.h" #include "../ifc/exception/vexception.h"
#include "../ifc/exception/vexceptionobjecterror.h" #include "../ifc/exception/vexceptionobjecterror.h"
#include "../ifc/ifcdef.h" #include "../ifc/ifcdef.h"
@ -42,10 +46,6 @@
#include "../vgeometry/vpointf.h" #include "../vgeometry/vpointf.h"
#include "../vpatterndb/vcontainer.h" #include "../vpatterndb/vcontainer.h"
#include "../vwidgets/vmaingraphicsscene.h" #include "../vwidgets/vmaingraphicsscene.h"
#include "../../../../dialogs/tools/dialogtool.h"
#include "../../../../visualization/visualization.h"
#include "../../../vabstracttool.h"
#include "../../vdrawtool.h"
#include "vtoolsinglepoint.h" #include "vtoolsinglepoint.h"
template <class T> class QSharedPointer; template <class T> class QSharedPointer;
@ -55,7 +55,7 @@ const QString VToolPointOfIntersectionArcs::ToolType = QStringLiteral("pointOfIn
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VToolPointOfIntersectionArcs::VToolPointOfIntersectionArcs(const VToolPointOfIntersectionArcsInitData &initData, VToolPointOfIntersectionArcs::VToolPointOfIntersectionArcs(const VToolPointOfIntersectionArcsInitData &initData,
QGraphicsItem *parent) QGraphicsItem *parent)
:VToolSinglePoint(initData.doc, initData.data, initData.id, initData.notes, parent), : VToolSinglePoint(initData.doc, initData.data, initData.id, initData.notes, parent),
firstArcId(initData.firstArcId), firstArcId(initData.firstArcId),
secondArcId(initData.secondArcId), secondArcId(initData.secondArcId),
crossPoint(initData.pType) crossPoint(initData.pType)
@ -119,8 +119,9 @@ auto VToolPointOfIntersectionArcs::Create(VToolPointOfIntersectionArcsInitData i
{ {
const QString errorMsg = tr("Error calculating point '%1'. Arcs '%2' and '%3' have no point of intersection") const QString errorMsg = tr("Error calculating point '%1'. Arcs '%2' and '%3' have no point of intersection")
.arg(initData.name, firstArc->ObjectName(), secondArc->ObjectName()); .arg(initData.name, firstArc->ObjectName(), secondArc->ObjectName());
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionObjectError(errorMsg) : VAbstractApplication::VApp()->IsPedantic()
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg; ? throw VExceptionObjectError(errorMsg)
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
} }
auto *p = new VPointF(point, initData.name, initData.mx, initData.my); auto *p = new VPointF(point, initData.name, initData.mx, initData.my);
@ -160,23 +161,23 @@ auto VToolPointOfIntersectionArcs::FindPoint(const VArc *arc1, const VArc *arc2,
SCASSERT(intersectionPoint != nullptr) SCASSERT(intersectionPoint != nullptr)
QPointF p1, p2; QPointF p1, p2;
const QPointF centerArc1 = static_cast<QPointF>(arc1->GetCenter()); const auto centerArc1 = static_cast<QPointF>(arc1->GetCenter());
const QPointF centerArc2 = static_cast<QPointF>(arc2->GetCenter()); const auto centerArc2 = static_cast<QPointF>(arc2->GetCenter());
const int res = VGObject::IntersectionCircles(centerArc1, arc1->GetRadius(), centerArc2, arc2->GetRadius(), p1, p2); const int res = VGObject::IntersectionCircles(centerArc1, arc1->GetRadius(), centerArc2, arc2->GetRadius(), p1, p2);
QLineF r1Arc1(centerArc1, p1); QLineF r1Arc1(centerArc1, p1);
r1Arc1.setLength(r1Arc1.length()+10); r1Arc1.setLength(r1Arc1.length() + 10);
QLineF r1Arc2(centerArc2, p1); QLineF r1Arc2(centerArc2, p1);
r1Arc2.setLength(r1Arc2.length()+10); r1Arc2.setLength(r1Arc2.length() + 10);
QLineF r2Arc1(centerArc1, p2); QLineF r2Arc1(centerArc1, p2);
r2Arc1.setLength(r2Arc1.length()+10); r2Arc1.setLength(r2Arc1.length() + 10);
QLineF r2Arc2(centerArc2, p2); QLineF r2Arc2(centerArc2, p2);
r2Arc2.setLength(r2Arc2.length()+10); r2Arc2.setLength(r2Arc2.length() + 10);
switch(res) switch (res)
{ {
case 2: case 2:
{ {
@ -194,7 +195,7 @@ auto VToolPointOfIntersectionArcs::FindPoint(const VArc *arc1, const VArc *arc2,
++localRes; ++localRes;
} }
switch(localRes) switch (localRes)
{ {
case 2: case 2:
if (pType == CrossCirclesPoint::FirstPoint) if (pType == CrossCirclesPoint::FirstPoint)
@ -284,10 +285,10 @@ void VToolPointOfIntersectionArcs::ShowContextMenu(QGraphicsSceneContextMenuEven
{ {
ContextMenu<DialogPointOfIntersectionArcs>(event, id); ContextMenu<DialogPointOfIntersectionArcs>(event, id);
} }
catch(const VExceptionToolWasDeleted &e) catch (const VExceptionToolWasDeleted &e)
{ {
Q_UNUSED(e) Q_UNUSED(e)
return;//Leave this method immediately!!! return; // Leave this method immediately!!!
} }
} }
@ -319,7 +320,7 @@ void VToolPointOfIntersectionArcs::SaveDialog(QDomElement &domElement, QList<qui
doc->SetAttribute(domElement, AttrSecondArc, QString().setNum(dialogTool->GetSecondArcId())); doc->SetAttribute(domElement, AttrSecondArc, QString().setNum(dialogTool->GetSecondArcId()));
doc->SetAttribute(domElement, AttrCrossPoint, QString().setNum(static_cast<int>(dialogTool->GetCrossArcPoint()))); doc->SetAttribute(domElement, AttrCrossPoint, QString().setNum(static_cast<int>(dialogTool->GetCrossArcPoint())));
doc->SetAttributeOrRemoveIf<QString>(domElement, AttrNotes, dialogTool->GetNotes(), doc->SetAttributeOrRemoveIf<QString>(domElement, AttrNotes, dialogTool->GetNotes(),
[](const QString &notes) noexcept {return notes.isEmpty();}); [](const QString &notes) noexcept { return notes.isEmpty(); });
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -584,7 +584,7 @@ void VNodePoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
}; };
QAction *selectedAction = menu.exec(event->screenPos()); QAction *selectedAction = menu.exec(event->screenPos());
ContextMenuOption const selectedOption = static_cast<ContextMenuOption>( auto const selectedOption = static_cast<ContextMenuOption>(
contextMenu.key(selectedAction, static_cast<int>(ContextMenuOption::NoSelection))); contextMenu.key(selectedAction, static_cast<int>(ContextMenuOption::NoSelection)));
Q_STATIC_ASSERT_X(static_cast<int>(ContextMenuOption::LAST_ONE_DO_NOT_USE) == 35, "Not all options were handled."); Q_STATIC_ASSERT_X(static_cast<int>(ContextMenuOption::LAST_ONE_DO_NOT_USE) == 35, "Not all options were handled.");

View File

@ -503,7 +503,7 @@ auto AddNodeArc(const VPieceNode &node, const VToolUnionDetailsInitData &initDat
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID) if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID)
{ {
const QPointF p = static_cast<QPointF>(*initData.data->GeometricObject<VPointF>(pRotate)); const auto p = static_cast<QPointF>(*initData.data->GeometricObject<VPointF>(pRotate));
BiasRotatePoint(&p1, dx, dy, p, angle); BiasRotatePoint(&p1, dx, dy, p, angle);
BiasRotatePoint(&p2, dx, dy, p, angle); BiasRotatePoint(&p2, dx, dy, p, angle);
@ -554,7 +554,7 @@ auto AddNodeElArc(const VPieceNode &node, const VToolUnionDetailsInitData &initD
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID) if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID)
{ {
const QPointF p = static_cast<QPointF>(*initData.data->GeometricObject<VPointF>(pRotate)); const auto p = static_cast<QPointF>(*initData.data->GeometricObject<VPointF>(pRotate));
BiasRotatePoint(&p1, dx, dy, p, angle); BiasRotatePoint(&p1, dx, dy, p, angle);
BiasRotatePoint(&p2, dx, dy, p, angle); BiasRotatePoint(&p2, dx, dy, p, angle);
@ -609,7 +609,7 @@ auto AddNodeSpline(const VPieceNode &node, const VToolUnionDetailsInitData &init
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID) if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID)
{ {
const QPointF p = static_cast<QPointF>(*initData.data->GeometricObject<VPointF>(pRotate)); const auto p = static_cast<QPointF>(*initData.data->GeometricObject<VPointF>(pRotate));
BiasRotatePoint(p1.data(), dx, dy, p, angle); BiasRotatePoint(p1.data(), dx, dy, p, angle);
BiasRotatePoint(&p2, dx, dy, p, angle); BiasRotatePoint(&p2, dx, dy, p, angle);
@ -658,7 +658,7 @@ auto AddNodeSplinePath(const VPieceNode &node, const VToolUnionDetailsInitData &
QScopedPointer<VPointF> const p4(new VPointF(spline.GetP4())); QScopedPointer<VPointF> const p4(new VPointF(spline.GetP4()));
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID) if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID)
{ {
const QPointF p = static_cast<QPointF>(*initData.data->GeometricObject<VPointF>(pRotate)); const auto p = static_cast<QPointF>(*initData.data->GeometricObject<VPointF>(pRotate));
BiasRotatePoint(p1.data(), dx, dy, p, angle); BiasRotatePoint(p1.data(), dx, dy, p, angle);
BiasRotatePoint(&p2, dx, dy, p, angle); BiasRotatePoint(&p2, dx, dy, p, angle);
@ -943,7 +943,7 @@ void UpdateNodeArc(VContainer *data, const VPieceNode &node, QVector<quint32> &c
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID) if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID)
{ {
const QPointF p = static_cast<QPointF>(*data->GeometricObject<VPointF>(pRotate)); const auto p = static_cast<QPointF>(*data->GeometricObject<VPointF>(pRotate));
BiasRotatePoint(&p1, dx, dy, p, angle); BiasRotatePoint(&p1, dx, dy, p, angle);
BiasRotatePoint(&p2, dx, dy, p, angle); BiasRotatePoint(&p2, dx, dy, p, angle);
@ -970,7 +970,7 @@ void UpdateNodeElArc(VContainer *data, const VPieceNode &node, QVector<quint32>
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID) if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID)
{ {
const QPointF p = static_cast<QPointF>(*data->GeometricObject<VPointF>(pRotate)); const auto p = static_cast<QPointF>(*data->GeometricObject<VPointF>(pRotate));
BiasRotatePoint(&p1, dx, dy, p, angle); BiasRotatePoint(&p1, dx, dy, p, angle);
BiasRotatePoint(&p2, dx, dy, p, angle); BiasRotatePoint(&p2, dx, dy, p, angle);
@ -1000,7 +1000,7 @@ void UpdateNodeSpline(VContainer *data, const VPieceNode &node, QVector<quint32>
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID) if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID)
{ {
const QPointF p = static_cast<QPointF>(*data->GeometricObject<VPointF>(pRotate)); const auto p = static_cast<QPointF>(*data->GeometricObject<VPointF>(pRotate));
BiasRotatePoint(p1.data(), dx, dy, p, angle); BiasRotatePoint(p1.data(), dx, dy, p, angle);
BiasRotatePoint(&p2, dx, dy, p, angle); BiasRotatePoint(&p2, dx, dy, p, angle);
@ -1033,7 +1033,7 @@ void UpdateNodeSplinePath(VContainer *data, const VPieceNode &node, QVector<quin
if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID) if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID)
{ {
const QPointF p = static_cast<QPointF>(*data->GeometricObject<VPointF>(pRotate)); const auto p = static_cast<QPointF>(*data->GeometricObject<VPointF>(pRotate));
BiasRotatePoint(p1.data(), dx, dy, p, angle); BiasRotatePoint(p1.data(), dx, dy, p, angle);
BiasRotatePoint(&p2, dx, dy, p, angle); BiasRotatePoint(&p2, dx, dy, p, angle);

View File

@ -88,7 +88,7 @@ void VisToolPointFromArcAndTangent::VisualMode(quint32 id)
void VisToolPointFromArcAndTangent::FindRays(const QPointF &p, const VArc *arc) void VisToolPointFromArcAndTangent::FindRays(const QPointF &p, const VArc *arc)
{ {
QPointF p1, p2; QPointF p1, p2;
const QPointF center = static_cast<QPointF>(arc->GetCenter()); const auto center = static_cast<QPointF>(arc->GetCenter());
const qreal radius = arc->GetRadius(); const qreal radius = arc->GetRadius();
const int res = VGObject::ContactPoints(p, center, radius, p1, p2); const int res = VGObject::ContactPoints(p, center, radius, p1, p2);

View File

@ -239,7 +239,7 @@ void VisToolCubicBezierPath::Creating(const QVector<VPointF> &pathPoints, vsizet
{ {
const VPointF &p1 = pathPoints.at(subSplPoints + pointsLeft - 2); const VPointF &p1 = pathPoints.at(subSplPoints + pointsLeft - 2);
auto p2 = static_cast<QPointF>(pathPoints.at(subSplPoints + pointsLeft - 1)); auto p2 = static_cast<QPointF>(pathPoints.at(subSplPoints + pointsLeft - 1));
const QPointF p3 = static_cast<QPointF>(pathPoints.at(subSplPoints + pointsLeft)); const auto p3 = static_cast<QPointF>(pathPoints.at(subSplPoints + pointsLeft));
if (subSplCount >= 1) if (subSplCount >= 1)
{ {

View File

@ -147,7 +147,7 @@ void StyleHelper::drawIconWithShadow(const QIcon &icon, const QRect &rect, QPain
for (int x = 0; x < im.width(); ++x) for (int x = 0; x < im.width(); ++x)
{ {
QRgb const pixel = *scanLine; QRgb const pixel = *scanLine;
char const intensity = static_cast<char>(qGray(pixel)); auto const intensity = static_cast<char>(qGray(pixel));
*scanLine = qRgba(intensity, intensity, intensity, qAlpha(pixel)); *scanLine = qRgba(intensity, intensity, intensity, qAlpha(pixel));
++scanLine; ++scanLine;
} }

View File

@ -104,7 +104,7 @@ void VPlainTextEdit::MatchParentheses()
QList<QTextEdit::ExtraSelection> const selections; QList<QTextEdit::ExtraSelection> const selections;
setExtraSelections(selections); setExtraSelections(selections);
VTextBlockData *data = static_cast<VTextBlockData *>(textCursor().block().userData()); auto *data = static_cast<VTextBlockData *>(textCursor().block().userData());
if (data) if (data)
{ {