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);
#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;
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,
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))
{

View File

@ -315,7 +315,7 @@ void TKMMainWindow::UpdateWindowTitle()
setWindowFilePath(m_curFile);
#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;
if (not m_curFile.isEmpty())
{
@ -1346,7 +1346,7 @@ void TKMMainWindow::SaveMUnits()
}
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);
MeasurementsWereSaved(false);
@ -2234,8 +2234,8 @@ void TKMMainWindow::RefreshImages()
QSize const size = i.value().Size();
QSize const targetSize = ui->listWidget->iconSize();
double const scalingFactorWidth = static_cast<double>(targetSize.width()) / size.width();
double const scalingFactorHeight = static_cast<double>(targetSize.height()) / size.height();
auto const scalingFactorWidth = static_cast<double>(targetSize.width()) / size.width();
auto const scalingFactorHeight = static_cast<double>(targetSize.height()) / size.height();
int newWidth;
int newHeight;

View File

@ -1207,7 +1207,7 @@ void TMainWindow::SaveEmail()
//---------------------------------------------------------------------------------------------------------------------
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)
{
m_m->SetGender(type);
@ -2521,7 +2521,7 @@ void TMainWindow::SaveMUnits()
}
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);
MeasurementsWereSaved(false);
@ -2547,7 +2547,7 @@ void TMainWindow::SaveMDimension()
}
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);
MeasurementsWereSaved(false);
@ -3013,7 +3013,7 @@ void TMainWindow::InitWindow()
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->setDisplayFormat(dateLocale.dateFormat());
ui->dateEditBirthDate->setDate(m_m->BirthDate());
@ -3801,7 +3801,7 @@ void TMainWindow::UpdateWindowTitle()
setWindowFilePath(m_curFile);
#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;
if (not m_curFile.isEmpty())
{

View File

@ -107,7 +107,7 @@ PreferencesPatternPage::PreferencesPatternPage(QWidget *parent)
connect(ui->comboBoxLineWidthUnit, QOverload<int>::of(&QComboBox::currentIndexChanged), 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);
ui->doubleSpinBoxLineWidth->setDecimals(lineUnit == Unit::Mm ? 1 : 6);
ui->doubleSpinBoxLineWidth->setMinimum(

View File

@ -1700,7 +1700,7 @@ void DialogIncrements::SaveIncrUnits()
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);
LocalUpdateTree();

View File

@ -900,7 +900,7 @@ auto DialogLayoutSettings::MakeHelpTiledPdfTemplateList() -> QString
//---------------------------------------------------------------------------------------------------------------------
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();

View File

@ -330,7 +330,7 @@ auto DialogSaveLayout::IsShowGrainline() const -> bool
//---------------------------------------------------------------------------------------------------------------------
auto DialogSaveLayout::MakeHelpFormatList() -> QString
{
QString out(QStringLiteral("\n"));
auto out = QStringLiteral("\n");
const auto formats = InitFormats();
for (int i = 0; i < formats.size(); ++i)
{
@ -891,7 +891,7 @@ void DialogSaveLayout::WriteSettings() const
settings->SetTiledPDFMargins(margins, unit);
// 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);
settings->SetTiledPDFPaperHeight(size.height(), Unit::Mm);

View File

@ -7567,7 +7567,7 @@ void MainWindow::UpdateWindowTitle()
setWindowFilePath(VAbstractValApplication::VApp()->GetPatternPath());
#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;
if (not VAbstractValApplication::VApp()->GetPatternPath().isEmpty())
{

View File

@ -144,7 +144,7 @@ void QmuFormulaBase::SetSepForTr(bool osSeparator, bool fromUser)
{
if (fromUser)
{
const QLocale loc = QLocale();
const QLocale loc;
setLocale(loc);
SetArgSep(';');
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);
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 =
(static_cast<qulonglong>(vmStats.active_count) + static_cast<qulonglong>(vmStats.inactive_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 QPointF center = static_cast<QPointF>(GetCenter());
const auto center = static_cast<QPointF>(GetCenter());
QLineF lineP1P2(pStart, center);
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));
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 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>
{
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;
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.
for (auto t : qAsConst(ts))
{
const QPointF p0 = static_cast<QPointF>(GetP1());
const QPointF p1 = static_cast<QPointF>(GetP2());
const QPointF p2 = static_cast<QPointF>(GetP3());
const QPointF p3 = static_cast<QPointF>(GetP4());
const auto p0 = static_cast<QPointF>(GetP1());
const auto p1 = static_cast<QPointF>(GetP2());
const auto p2 = static_cast<QPointF>(GetP3());
const auto p3 = static_cast<QPointF>(GetP4());
// 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() +
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);
#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;
if (not m_curFile.isEmpty())
{

View File

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

View File

@ -45,7 +45,7 @@ Q_GLOBAL_STATIC(QMutex, svgPathTokenizerMutex) // NOLINT
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

View File

@ -1051,7 +1051,7 @@ void VCommonSettings::SetCSVSeparator(const QChar &separator)
auto VCommonSettings::GetCSVSeparator() const -> QChar
{
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)
{
case 0:
@ -1596,7 +1596,7 @@ void VCommonSettings::SetTiledPDFMargins(const QMarginsF &value, const Unit &uni
//---------------------------------------------------------------------------------------------------------------------
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();
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)
{
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))
{
candidate = VSAPoint(p);
@ -864,7 +864,7 @@ auto VPiecePath::RemoveEdge(quint32 index) const -> VPiecePath
path.Clear();
// 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)
{
VPieceNode p1;

View File

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

View File

@ -269,9 +269,9 @@ void DialogHeight::PointNameChanged()
try
{
const QPointF basePoint = static_cast<QPointF>(*data->GeometricObject<VPointF>(basePointId));
const QPointF p1Line = static_cast<QPointF>(*data->GeometricObject<VPointF>(p1LineId));
const QPointF p2Line = static_cast<QPointF>(*data->GeometricObject<VPointF>(p2LineId));
const auto basePoint = static_cast<QPointF>(*data->GeometricObject<VPointF>(basePointId));
const auto p1Line = static_cast<QPointF>(*data->GeometricObject<VPointF>(p1LineId));
const auto p2Line = static_cast<QPointF>(*data->GeometricObject<VPointF>(p2LineId));
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());
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));
rowNode.SetAngleType(angle);
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 *
{
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;
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 *
{
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 QPointF sPoint = static_cast<QPointF>(secondPoint);
const auto sPoint = static_cast<QPointF>(secondPoint);
CreateDestination(initData, fPoint, sPoint);

View File

@ -135,7 +135,7 @@ auto VToolRotation::Create(VToolRotationInitData &initData) -> VToolRotation *
calcAngle = CheckFormula(initData.id, initData.angle, initData.data);
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)
{

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 offset1 = (weight / (3 * t * t * (1 - t))) * delta;
const QPointF p2 = static_cast<QPointF>(spline->GetP2()) + offset0;
const QPointF p3 = static_cast<QPointF>(spline->GetP3()) + offset1;
const auto p2 = static_cast<QPointF>(spline->GetP2()) + offset0;
const auto p3 = static_cast<QPointF>(spline->GetP3()) + offset1;
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 offset1 = (weight / (3 * t * t * (1 - t))) * delta;
const QPointF p2 = static_cast<QPointF>(spline.GetP2()) + offset0;
const QPointF p3 = static_cast<QPointF>(spline.GetP3()) + offset1;
const auto p2 = static_cast<QPointF>(spline.GetP2()) + offset0;
const auto p3 = static_cast<QPointF>(spline.GetP3()) + offset1;
oldPosition = event->scenePos(); // Now mouse here

View File

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

View File

@ -34,8 +34,10 @@
#include "../../../../dialogs/tools/dialogpointfromarcandtangent.h"
#include "../../../../dialogs/tools/dialogtool.h"
#include "../../../../visualization/visualization.h"
#include "../../../../visualization/line/vistoolpointfromarcandtangent.h"
#include "../../../../visualization/visualization.h"
#include "../../../vabstracttool.h"
#include "../../vdrawtool.h"
#include "../ifc/exception/vexception.h"
#include "../ifc/exception/vexceptionobjecterror.h"
#include "../ifc/ifcdef.h"
@ -44,8 +46,6 @@
#include "../vgeometry/vpointf.h"
#include "../vpatterndb/vcontainer.h"
#include "../vwidgets/vmaingraphicsscene.h"
#include "../../../vabstracttool.h"
#include "../../vdrawtool.h"
#include "vtoolsinglepoint.h"
template <class T> class QSharedPointer;
@ -112,15 +112,16 @@ auto VToolPointFromArcAndTangent::Create(VToolPointFromArcAndTangentInitData ini
const VPointF tPoint = *initData.data->GeometricObject<VPointF>(initData.tangentPointId);
QPointF point;
const bool success = VToolPointFromArcAndTangent::FindPoint(static_cast<QPointF>(tPoint), &arc,
initData.crossPoint, &point);
const bool success =
VToolPointFromArcAndTangent::FindPoint(static_cast<QPointF>(tPoint), &arc, initData.crossPoint, &point);
if (not success)
{
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());
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
VAbstractApplication::VApp()->IsPedantic()
? throw VExceptionObjectError(errorMsg)
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
}
auto *p = new VPointF(point, initData.name, initData.mx, initData.my);
@ -160,7 +161,7 @@ auto VToolPointFromArcAndTangent::FindPoint(const QPointF &p, const VArc *arc, c
SCASSERT(intersectionPoint != nullptr)
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 int res = VGObject::ContactPoints(p, center, radius, p1, p2);

View File

@ -33,7 +33,11 @@
#include <new>
#include "../../../../dialogs/tools/dialogpointofintersectionarcs.h"
#include "../../../../dialogs/tools/dialogtool.h"
#include "../../../../visualization/line/vistoolpointofintersectionarcs.h"
#include "../../../../visualization/visualization.h"
#include "../../../vabstracttool.h"
#include "../../vdrawtool.h"
#include "../ifc/exception/vexception.h"
#include "../ifc/exception/vexceptionobjecterror.h"
#include "../ifc/ifcdef.h"
@ -42,10 +46,6 @@
#include "../vgeometry/vpointf.h"
#include "../vpatterndb/vcontainer.h"
#include "../vwidgets/vmaingraphicsscene.h"
#include "../../../../dialogs/tools/dialogtool.h"
#include "../../../../visualization/visualization.h"
#include "../../../vabstracttool.h"
#include "../../vdrawtool.h"
#include "vtoolsinglepoint.h"
template <class T> class QSharedPointer;
@ -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")
.arg(initData.name, firstArc->ObjectName(), secondArc->ObjectName());
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
VAbstractApplication::VApp()->IsPedantic()
? throw VExceptionObjectError(errorMsg)
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
}
auto *p = new VPointF(point, initData.name, initData.mx, initData.my);
@ -160,8 +161,8 @@ auto VToolPointOfIntersectionArcs::FindPoint(const VArc *arc1, const VArc *arc2,
SCASSERT(intersectionPoint != nullptr)
QPointF p1, p2;
const QPointF centerArc1 = static_cast<QPointF>(arc1->GetCenter());
const QPointF centerArc2 = static_cast<QPointF>(arc2->GetCenter());
const auto centerArc1 = static_cast<QPointF>(arc1->GetCenter());
const auto centerArc2 = static_cast<QPointF>(arc2->GetCenter());
const int res = VGObject::IntersectionCircles(centerArc1, arc1->GetRadius(), centerArc2, arc2->GetRadius(), p1, p2);
QLineF r1Arc1(centerArc1, p1);

View File

@ -584,7 +584,7 @@ void VNodePoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
};
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)));
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)
{
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(&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)
{
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(&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)
{
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(&p2, dx, dy, p, angle);
@ -658,7 +658,7 @@ auto AddNodeSplinePath(const VPieceNode &node, const VToolUnionDetailsInitData &
QScopedPointer<VPointF> const p4(new VPointF(spline.GetP4()));
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(&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)
{
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(&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)
{
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(&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)
{
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(&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)
{
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(&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)
{
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 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);
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)
{

View File

@ -147,7 +147,7 @@ void StyleHelper::drawIconWithShadow(const QIcon &icon, const QRect &rect, QPain
for (int x = 0; x < im.width(); ++x)
{
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;
}

View File

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