Refactoring. Hide compatibility layer behind a function.
toVector(). --HG-- branch : develop
This commit is contained in:
parent
7e3c7e0f88
commit
658eafc3d3
|
@ -49,6 +49,7 @@
|
|||
#include "vlayoutpaper_p.h"
|
||||
#include "vposition.h"
|
||||
#include "../ifc/exception/vexceptionterminatedposition.h"
|
||||
#include "../vmisc/compatibility.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VLayoutPaper::VLayoutPaper()
|
||||
|
@ -411,7 +412,7 @@ QVector<VLayoutPiece> VLayoutPaper::GetDetails() const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VLayoutPaper::SetDetails(const QList<VLayoutPiece> &details)
|
||||
{
|
||||
d->details = details.toVector();
|
||||
d->details = ConvertToVector(details);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -519,7 +519,7 @@ QVector<T> VLayoutPiece::Map(QVector<T> points) const
|
|||
{
|
||||
SwapItemsAt(list, k, s-(1+k));
|
||||
}
|
||||
points = list.toVector();
|
||||
points = ConvertToVector(list);
|
||||
}
|
||||
return points;
|
||||
}
|
||||
|
|
|
@ -102,6 +102,17 @@ inline QSet<T> ConvertToSet(const C &container)
|
|||
#endif
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template <typename T, template <typename> class C>
|
||||
inline QVector<T> ConvertToVector(const C<T> &container)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
||||
return QVector<T>(container.begin(), container.end());
|
||||
#else
|
||||
return container.toVector();
|
||||
#endif
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
inline void SwapItemsAt(T &container, int i, int j)
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "../vgeometry/vpointf.h"
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vmisc/vcommonsettings.h"
|
||||
#include "../vmisc/compatibility.h"
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
#include "../vwidgets/vabstractmainwindow.h"
|
||||
#include "../vwidgets/vmaingraphicsscene.h"
|
||||
|
@ -143,7 +144,7 @@ void DialogFlippingByAxis::SetSuffix(const QString &value)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<quint32> DialogFlippingByAxis::GetObjects() const
|
||||
{
|
||||
return objects.toVector();
|
||||
return ConvertToVector(objects);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -164,7 +165,7 @@ void DialogFlippingByAxis::ShowDialog(bool click)
|
|||
|
||||
VisToolFlippingByAxis *operation = qobject_cast<VisToolFlippingByAxis *>(vis);
|
||||
SCASSERT(operation != nullptr)
|
||||
operation->SetObjects(objects.toVector());
|
||||
operation->SetObjects(ConvertToVector(objects));
|
||||
operation->VisualMode();
|
||||
|
||||
scene->ToggleArcSelection(false);
|
||||
|
@ -290,7 +291,7 @@ void DialogFlippingByAxis::SaveData()
|
|||
VisToolFlippingByAxis *operation = qobject_cast<VisToolFlippingByAxis *>(vis);
|
||||
SCASSERT(operation != nullptr)
|
||||
|
||||
operation->SetObjects(objects.toVector());
|
||||
operation->SetObjects(ConvertToVector(objects));
|
||||
operation->SetOriginPointId(GetOriginPointId());
|
||||
operation->SetAxisType(GetAxisType());
|
||||
operation->RefreshGeometry();
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "../vgeometry/vpointf.h"
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vmisc/vcommonsettings.h"
|
||||
#include "../vmisc/compatibility.h"
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
#include "../vwidgets/vabstractmainwindow.h"
|
||||
#include "../vwidgets/vmaingraphicsscene.h"
|
||||
|
@ -138,7 +139,7 @@ void DialogFlippingByLine::SetSuffix(const QString &value)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<quint32> DialogFlippingByLine::GetObjects() const
|
||||
{
|
||||
return objects.toVector();
|
||||
return ConvertToVector(objects);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -159,7 +160,7 @@ void DialogFlippingByLine::ShowDialog(bool click)
|
|||
|
||||
VisToolFlippingByLine *operation = qobject_cast<VisToolFlippingByLine *>(vis);
|
||||
SCASSERT(operation != nullptr)
|
||||
operation->SetObjects(objects.toVector());
|
||||
operation->SetObjects(ConvertToVector(objects));
|
||||
operation->VisualMode();
|
||||
|
||||
scene->ToggleArcSelection(false);
|
||||
|
@ -314,7 +315,7 @@ void DialogFlippingByLine::SaveData()
|
|||
VisToolFlippingByLine *operation = qobject_cast<VisToolFlippingByLine *>(vis);
|
||||
SCASSERT(operation != nullptr)
|
||||
|
||||
operation->SetObjects(objects.toVector());
|
||||
operation->SetObjects(ConvertToVector(objects));
|
||||
operation->SetFirstLinePointId(GetFirstLinePointId());
|
||||
operation->SetSecondLinePointId(GetSecondLinePointId());
|
||||
operation->RefreshGeometry();
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
#include "../vgeometry/vpointf.h"
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vmisc/vcommonsettings.h"
|
||||
#include "../vmisc/compatibility.h"
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
#include "../vpatterndb/vtranslatevars.h"
|
||||
#include "../vwidgets/vabstractmainwindow.h"
|
||||
|
@ -253,7 +254,7 @@ void DialogMove::SetRotationOrigPointId(const quint32 &value)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<quint32> DialogMove::GetObjects() const
|
||||
{
|
||||
return objects.toVector();
|
||||
return ConvertToVector(objects);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -275,7 +276,7 @@ void DialogMove::ShowDialog(bool click)
|
|||
|
||||
VisToolMove *operation = qobject_cast<VisToolMove *>(vis);
|
||||
SCASSERT(operation != nullptr)
|
||||
operation->SetObjects(objects.toVector());
|
||||
operation->SetObjects(ConvertToVector(objects));
|
||||
operation->VisualMode();
|
||||
|
||||
VAbstractMainWindow *window = qobject_cast<VAbstractMainWindow *>(qApp->getMainWindow());
|
||||
|
@ -497,7 +498,7 @@ void DialogMove::SaveData()
|
|||
VisToolMove *operation = qobject_cast<VisToolMove *>(vis);
|
||||
SCASSERT(operation != nullptr)
|
||||
|
||||
operation->SetObjects(objects.toVector());
|
||||
operation->SetObjects(ConvertToVector(objects));
|
||||
operation->SetAngle(formulaAngle);
|
||||
operation->SetLength(formulaLength);
|
||||
operation->SetRotationAngle(formulaRotationAngle);
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
#include "../vgeometry/vpointf.h"
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vmisc/vcommonsettings.h"
|
||||
#include "../vmisc/compatibility.h"
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
#include "../vpatterndb/vtranslatevars.h"
|
||||
#include "../vwidgets/vabstractmainwindow.h"
|
||||
|
@ -166,7 +167,7 @@ void DialogRotation::SetSuffix(const QString &value)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<quint32> DialogRotation::GetObjects() const
|
||||
{
|
||||
return objects.toVector();
|
||||
return ConvertToVector(objects);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -187,7 +188,7 @@ void DialogRotation::ShowDialog(bool click)
|
|||
|
||||
VisToolRotation *operation = qobject_cast<VisToolRotation *>(vis);
|
||||
SCASSERT(operation != nullptr)
|
||||
operation->SetObjects(objects.toVector());
|
||||
operation->SetObjects(ConvertToVector(objects));
|
||||
operation->VisualMode();
|
||||
|
||||
scene->ToggleArcSelection(false);
|
||||
|
@ -261,7 +262,7 @@ void DialogRotation::ChosenObject(quint32 id, const SceneObject &type)
|
|||
// It's not really logical for a user that a center of rotation no need to select.
|
||||
// To fix this issue we just silently remove it from the list.
|
||||
objects.removeOne(id);
|
||||
operation->SetObjects(objects.toVector());
|
||||
operation->SetObjects(ConvertToVector(objects));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -380,7 +381,7 @@ void DialogRotation::SaveData()
|
|||
VisToolRotation *operation = qobject_cast<VisToolRotation *>(vis);
|
||||
SCASSERT(operation != nullptr)
|
||||
|
||||
operation->SetObjects(objects.toVector());
|
||||
operation->SetObjects(ConvertToVector(objects));
|
||||
operation->SetOriginPointId(GetOrigPointId());
|
||||
operation->SetAngle(formulaAngle);
|
||||
operation->RefreshGeometry();
|
||||
|
|
Loading…
Reference in New Issue
Block a user