Resolved issue #976. The pattern does not open.
--HG-- branch : develop
This commit is contained in:
parent
4355d18fb3
commit
030c513784
|
@ -4745,22 +4745,40 @@ bool MainWindow::LoadPattern(QString fileName, const QString& customMeasureFile)
|
||||||
m_curFileFormatVersion = converter->GetCurrentFormatVersion();
|
m_curFileFormatVersion = converter->GetCurrentFormatVersion();
|
||||||
m_curFileFormatVersionStr = converter->GetFormatVersionStr();
|
m_curFileFormatVersionStr = converter->GetFormatVersionStr();
|
||||||
doc->setXMLContent(converter->Convert());
|
doc->setXMLContent(converter->Convert());
|
||||||
|
}
|
||||||
|
|
||||||
if (!customMeasureFile.isEmpty())
|
if (!customMeasureFile.isEmpty())
|
||||||
{
|
{
|
||||||
doc->SetMPath(RelativeMPath(fileName, customMeasureFile));
|
doc->SetMPath(RelativeMPath(fileName, customMeasureFile));
|
||||||
}
|
}
|
||||||
qApp->setPatternUnit(doc->MUnit());
|
qApp->setPatternUnit(doc->MUnit());
|
||||||
|
|
||||||
|
QString path = AbsoluteMPath(fileName, doc->MPath());
|
||||||
|
QString fixedMPath;
|
||||||
|
|
||||||
|
// See issue #976. Pattern can lost link to measurements
|
||||||
|
if (path.isEmpty() && doc->RequiresMeasurements())
|
||||||
|
{
|
||||||
|
const QString fakeName = QStringLiteral("unknown_measurements.vit");
|
||||||
|
// Check if exist
|
||||||
|
fixedMPath = CheckPathToMeasurements(fileName, fakeName);
|
||||||
|
if (fixedMPath.isEmpty())
|
||||||
|
{
|
||||||
|
qApp->setOpeningPattern();// End opening file
|
||||||
|
Clear();
|
||||||
|
qCCritical(vMainWindow, "%s", qUtf8Printable(tr("The measurements file '%1' could not be found.")
|
||||||
|
.arg(fakeName)));
|
||||||
|
if (not VApplication::IsGUIMode())
|
||||||
|
{
|
||||||
|
qApp->exit(V_EX_NOINPUT);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!customMeasureFile.isEmpty())
|
path = AbsoluteMPath(fileName, doc->MPath());
|
||||||
{
|
|
||||||
doc->SetMPath(RelativeMPath(fileName, customMeasureFile));
|
|
||||||
}
|
}
|
||||||
qApp->setPatternUnit(doc->MUnit());
|
|
||||||
}
|
}
|
||||||
const QString path = AbsoluteMPath(fileName, doc->MPath());
|
|
||||||
QString fixedMPath;
|
|
||||||
|
|
||||||
if (not path.isEmpty())
|
if (not path.isEmpty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -298,6 +298,12 @@ VAbstractPattern::~VAbstractPattern()
|
||||||
toolsOnRemove.clear();
|
toolsOnRemove.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool VAbstractPattern::RequiresMeasurements() const
|
||||||
|
{
|
||||||
|
return not ListMeasurements().isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QStringList VAbstractPattern::ListMeasurements() const
|
QStringList VAbstractPattern::ListMeasurements() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -86,6 +86,7 @@ public:
|
||||||
explicit VAbstractPattern(QObject *parent = nullptr);
|
explicit VAbstractPattern(QObject *parent = nullptr);
|
||||||
virtual ~VAbstractPattern();
|
virtual ~VAbstractPattern();
|
||||||
|
|
||||||
|
bool RequiresMeasurements() const;
|
||||||
QStringList ListMeasurements() const;
|
QStringList ListMeasurements() const;
|
||||||
QVector<VFormulaField> ListExpressions() const;
|
QVector<VFormulaField> ListExpressions() const;
|
||||||
QVector<VFormulaField> ListIncrementExpressions() const;
|
QVector<VFormulaField> ListIncrementExpressions() const;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user