Better way to check suffix.
--HG-- branch : feature
This commit is contained in:
parent
702245f9fb
commit
0052a883a4
|
@ -682,19 +682,19 @@ void VToolOptionsPropertyBrowser::SetOperationSuffix(const QString &suffix)
|
|||
}
|
||||
|
||||
QRegularExpression rx(NameRegExp());
|
||||
const QVector<QString> names = item->GetNames(suffix);
|
||||
for (int i=0; i < names.size(); ++i)
|
||||
const QStringList uniqueNames = VContainer::AllUniqueNames();
|
||||
for (int i=0; i < uniqueNames.size(); ++i)
|
||||
{
|
||||
if (not rx.match(names.at(i)).hasMatch() || not VContainer::IsUnique(names.at(i)))
|
||||
const QString name = uniqueNames.at(i) + suffix;
|
||||
if (not rx.match(name).hasMatch() || not VContainer::IsUnique(name))
|
||||
{
|
||||
idToProperty[AttrSuffix]->setValue(item->Suffix());
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
|
||||
item->SetSuffix(suffix);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning()<<"Can't cast item";
|
||||
|
|
|
@ -351,52 +351,6 @@ void VToolRotation::ExtractData(VAbstractPattern *doc, const QDomElement &domEle
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<QString> VToolRotation::GetNames(const QString &suffix) const
|
||||
{
|
||||
QVector<QString> names;
|
||||
for (int i = 0; i < source.size(); ++i)
|
||||
{
|
||||
const QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(source.at(i));
|
||||
|
||||
// This check helps to find missed objects in the switch
|
||||
Q_STATIC_ASSERT_X(static_cast<int>(GOType::Unknown) == 7, "Not all objects were handled.");
|
||||
|
||||
#if defined(Q_CC_GNU)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wswitch-default"
|
||||
#endif
|
||||
switch(static_cast<GOType>(obj->getType()))
|
||||
{
|
||||
case GOType::Point:
|
||||
{
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(source.at(i));
|
||||
names.append(point->name() + suffix);
|
||||
break;
|
||||
}
|
||||
case GOType::Arc:
|
||||
case GOType::EllipticalArc:
|
||||
case GOType::Spline:
|
||||
case GOType::SplinePath:
|
||||
case GOType::CubicBezier:
|
||||
case GOType::CubicBezierPath:
|
||||
{
|
||||
const QSharedPointer<VAbstractCurve> curve =
|
||||
VAbstractTool::data.GeometricObject<VAbstractCurve>(source.at(i));
|
||||
names.append(curve->name() + suffix);
|
||||
break;
|
||||
}
|
||||
case GOType::Unknown:
|
||||
break;
|
||||
}
|
||||
#if defined(Q_CC_GNU)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
return names;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VToolRotation::getTagName() const
|
||||
{
|
||||
|
|
|
@ -59,7 +59,6 @@ public:
|
|||
const Document &parse, const Source &typeCreation);
|
||||
static void ExtractData(VAbstractPattern *doc, const QDomElement &domElement, QVector<quint32> &source,
|
||||
QVector<DestinationItem> &destination);
|
||||
QVector<QString> GetNames(const QString &suffix) const;
|
||||
static const QString ToolType;
|
||||
static const QString TagItem;
|
||||
static const QString TagSource;
|
||||
|
|
Loading…
Reference in New Issue
Block a user