constFirst() introduced since Qt 5.6.
--HG-- branch : develop
This commit is contained in:
parent
e9d77c747b
commit
d5a1f96bdd
|
@ -277,11 +277,7 @@ QVector<QPointF> VEllipticalArc::GetPoints() const
|
||||||
const QList<QPolygonF> sub = path.toSubpathPolygons();
|
const QList<QPolygonF> sub = path.toSubpathPolygons();
|
||||||
if (not sub.isEmpty())
|
if (not sub.isEmpty())
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
polygon = ConstFirst (path.toSubpathPolygons());
|
||||||
polygon = path.toSubpathPolygons().constFirst();
|
|
||||||
#else
|
|
||||||
polygon = path.toSubpathPolygons().first(); // clazy:exclude=detaching-temporary
|
|
||||||
#endif
|
|
||||||
if (not polygon.isEmpty())
|
if (not polygon.isEmpty())
|
||||||
{
|
{
|
||||||
polygon.removeFirst(); // remove point (0;0)
|
polygon.removeFirst(); // remove point (0;0)
|
||||||
|
|
|
@ -326,18 +326,7 @@ const VSplinePoint &VSplinePath::at(int indx) const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal VSplinePath::GetStartAngle() const
|
qreal VSplinePath::GetStartAngle() const
|
||||||
{
|
{
|
||||||
if (CountPoints() > 0)
|
return CountPoints() > 0 ? ConstFirst (GetSplinePath()).Angle2() : 0;
|
||||||
{
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
|
||||||
return GetSplinePath().constFirst().Angle2();
|
|
||||||
#else
|
|
||||||
return GetSplinePath().first().Angle2(); // clazy:exclude=detaching-temporary
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -360,66 +349,27 @@ qreal VSplinePath::GetEndAngle() const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal VSplinePath::GetC1Length() const
|
qreal VSplinePath::GetC1Length() const
|
||||||
{
|
{
|
||||||
if (CountPoints() > 0)
|
return CountPoints() > 0 ? ConstFirst (GetSplinePath()).Length2() : 0;
|
||||||
{
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
|
||||||
return GetSplinePath().constFirst().Length2();
|
|
||||||
#else
|
|
||||||
return GetSplinePath().first().Length2(); // clazy:exclude=detaching-temporary
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal VSplinePath::GetC2Length() const
|
qreal VSplinePath::GetC2Length() const
|
||||||
{
|
{
|
||||||
if (CountPoints() > 0)
|
return CountPoints() > 0 ? ConstFirst (GetSplinePath()).Length1() : 0;
|
||||||
{
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
|
||||||
return GetSplinePath().constLast().Length1();
|
|
||||||
#else
|
|
||||||
return GetSplinePath().last().Length1(); // clazy:exclude=detaching-temporary
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPointF VSplinePath::FirstPoint() const
|
VPointF VSplinePath::FirstPoint() const
|
||||||
{
|
{
|
||||||
if (not d->path.isEmpty())
|
return not d->path.isEmpty() ? ConstFirst (d->path).P() : VPointF();
|
||||||
{
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
|
||||||
return d->path.constFirst().P();
|
|
||||||
#else
|
|
||||||
return d->path.first().P(); // clazy:exclude=detaching-temporary
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return VPointF();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPointF VSplinePath::LastPoint() const
|
VPointF VSplinePath::LastPoint() const
|
||||||
{
|
{
|
||||||
const qint32 count = CountSubSpl();
|
const qint32 count = CountSubSpl();
|
||||||
if (count >= 1)
|
return count >= 1 ? d->path.at(count).P() :// Take last point of the last real spline
|
||||||
{
|
VPointF();
|
||||||
return d->path.at(count).P();// Take last point of the last real spline
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return VPointF();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -249,7 +249,7 @@ QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer
|
||||||
if (nodeIndex != -1)
|
if (nodeIndex != -1)
|
||||||
{
|
{
|
||||||
layoutPassmark.lines = passmark.BuiltInSAPassmark(piece, pattern);
|
layoutPassmark.lines = passmark.BuiltInSAPassmark(piece, pattern);
|
||||||
layoutPassmark.baseLine = passmark.BuiltInSAPassmarkBaseLine(piece).constFirst();
|
layoutPassmark.baseLine = ConstFirst (passmark.BuiltInSAPassmarkBaseLine(piece));
|
||||||
layoutPassmark.type = pData.passmarkLineType;
|
layoutPassmark.type = pData.passmarkLineType;
|
||||||
layoutPassmark.isBuiltIn = true;
|
layoutPassmark.isBuiltIn = true;
|
||||||
|
|
||||||
|
|
|
@ -356,6 +356,17 @@ enum class GSizes : unsigned char { ALL,
|
||||||
#endif // defined(__cplusplus)
|
#endif // defined(__cplusplus)
|
||||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
|
#endif // QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
const auto & ConstFirst (const T &container)
|
||||||
|
{
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
||||||
|
return container.constFirst();
|
||||||
|
#else
|
||||||
|
return container.first(); // clazy:exclude=detaching-temporary
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool IsOptionSet(int argc, char *argv[], const char *option);
|
bool IsOptionSet(int argc, char *argv[], const char *option);
|
||||||
void InitHighDpiScaling(int argc, char *argv[]);
|
void InitHighDpiScaling(int argc, char *argv[]);
|
||||||
|
|
||||||
|
|
|
@ -1010,26 +1010,11 @@ void VCommonSettings::SetHideLabels(bool value)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VCommonSettings::GetLabelDateFormat() const
|
QString VCommonSettings::GetLabelDateFormat() const
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
|
||||||
const QString format = value(*settingLabelDateFormat,
|
const QString format = value(*settingLabelDateFormat,
|
||||||
VCommonSettings::PredefinedDateFormats().constFirst()).toString();
|
ConstFirst (VCommonSettings::PredefinedDateFormats())).toString();
|
||||||
#else
|
|
||||||
const QString format = value(*settingLabelDateFormat, VCommonSettings::PredefinedDateFormats().first()).toString(); // clazy:exclude=detaching-temporary
|
|
||||||
#endif
|
|
||||||
const QStringList allFormats = VCommonSettings::PredefinedDateFormats() + GetUserDefinedDateFormats();
|
const QStringList allFormats = VCommonSettings::PredefinedDateFormats() + GetUserDefinedDateFormats();
|
||||||
|
|
||||||
if (allFormats.contains(format))
|
return allFormats.contains(format) ? format : ConstFirst (VCommonSettings::PredefinedDateFormats());
|
||||||
{
|
|
||||||
return format;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
|
||||||
return VCommonSettings::PredefinedDateFormats().constFirst();
|
|
||||||
#else
|
|
||||||
return VCommonSettings::PredefinedDateFormats().first(); // clazy:exclude=detaching-temporary
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -1081,26 +1066,11 @@ void VCommonSettings::SetUserDefinedDateFormats(const QStringList &formats)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VCommonSettings::GetLabelTimeFormat() const
|
QString VCommonSettings::GetLabelTimeFormat() const
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
|
||||||
const QString format = value(*settingLabelTimeFormat,
|
const QString format = value(*settingLabelTimeFormat,
|
||||||
VCommonSettings::PredefinedTimeFormats().constFirst()).toString();
|
ConstFirst (VCommonSettings::PredefinedTimeFormats())).toString();
|
||||||
#else
|
|
||||||
const QString format = value(*settingLabelTimeFormat, VCommonSettings::PredefinedTimeFormats().first()).toString(); // clazy:exclude=detaching-temporary
|
|
||||||
#endif
|
|
||||||
const QStringList allFormats = VCommonSettings::PredefinedTimeFormats() + GetUserDefinedTimeFormats();
|
const QStringList allFormats = VCommonSettings::PredefinedTimeFormats() + GetUserDefinedTimeFormats();
|
||||||
|
|
||||||
if (allFormats.contains(format))
|
return allFormats.contains(format) ? format : ConstFirst (VCommonSettings::PredefinedTimeFormats());
|
||||||
{
|
|
||||||
return format;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
|
||||||
return VCommonSettings::PredefinedTimeFormats().constFirst();
|
|
||||||
#else
|
|
||||||
return VCommonSettings::PredefinedTimeFormats().first(); // clazy:exclude=detaching-temporary
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue
Block a user