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