Move templates outside class definition.
--HG-- branch : develop
This commit is contained in:
parent
d4e13bfe34
commit
75e9bd0ed5
|
@ -82,19 +82,10 @@ public:
|
||||||
QDomElement elementById(const QString& id);
|
QDomElement elementById(const QString& id);
|
||||||
QDomElement elementById(quint32 id);
|
QDomElement elementById(quint32 id);
|
||||||
void removeAllChilds(QDomElement &element);
|
void removeAllChilds(QDomElement &element);
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
/**
|
void SetAttribute(QDomElement &domElement, const QString &name, const T &value) const;
|
||||||
* @brief SetAttribute set attribute in pattern file. Replace "," by ".".
|
|
||||||
* @param domElement element in xml tree.
|
|
||||||
* @param name name of attribute.
|
|
||||||
* @param value value of attribute.
|
|
||||||
*/
|
|
||||||
void SetAttribute(QDomElement &domElement, const QString &name, const T &value) const
|
|
||||||
{
|
|
||||||
QString val = QString().setNum(value);
|
|
||||||
val = val.replace(",", ".");
|
|
||||||
domElement.setAttribute(name, val);
|
|
||||||
}
|
|
||||||
quint32 GetParametrUInt(const QDomElement& domElement, const QString &name, const QString &defValue) const;
|
quint32 GetParametrUInt(const QDomElement& domElement, const QString &name, const QString &defValue) const;
|
||||||
bool GetParametrBool(const QDomElement& domElement, const QString &name, const QString &defValue) const;
|
bool GetParametrBool(const QDomElement& domElement, const QString &name, const QString &defValue) const;
|
||||||
QString GetParametrString(const QDomElement& domElement, const QString &name,
|
QString GetParametrString(const QDomElement& domElement, const QString &name,
|
||||||
|
@ -133,6 +124,21 @@ private:
|
||||||
bool find(const QDomElement &node, const QString& id);
|
bool find(const QDomElement &node, const QString& id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
template <typename T>
|
||||||
|
/**
|
||||||
|
* @brief SetAttribute set attribute in pattern file. Replace "," by ".".
|
||||||
|
* @param domElement element in xml tree.
|
||||||
|
* @param name name of attribute.
|
||||||
|
* @param value value of attribute.
|
||||||
|
*/
|
||||||
|
inline void VDomDocument::SetAttribute(QDomElement &domElement, const QString &name, const T &value) const
|
||||||
|
{
|
||||||
|
QString val = QString().setNum(value);
|
||||||
|
val = val.replace(",", ".");
|
||||||
|
domElement.setAttribute(name, val);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
template <>
|
template <>
|
||||||
inline void VDomDocument::SetAttribute<QString>(QDomElement &domElement, const QString &name,
|
inline void VDomDocument::SetAttribute<QString>(QDomElement &domElement, const QString &name,
|
||||||
|
|
|
@ -106,19 +106,10 @@ public:
|
||||||
void SetArgSep(char_type cArgSep);
|
void SetArgSep(char_type cArgSep);
|
||||||
QChar GetArgSep() const;
|
QChar GetArgSep() const;
|
||||||
void Q_NORETURN Error(EErrorCodes a_iErrc, int a_iPos = -1, const QString &a_strTok = QString() ) const;
|
void Q_NORETURN Error(EErrorCodes a_iErrc, int a_iPos = -1, const QString &a_strTok = QString() ) const;
|
||||||
/**
|
|
||||||
* @fn void qmu::QmuParserBase::DefineFun(const string_type &a_strName, fun_type0 a_pFun,
|
|
||||||
* bool a_bAllowOpt = true)
|
|
||||||
* @brief Define a parser function without arguments.
|
|
||||||
* @param a_strName Name of the function
|
|
||||||
* @param a_pFun Pointer to the callback function
|
|
||||||
* @param a_bAllowOpt A flag indicating this function may be optimized
|
|
||||||
*/
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void DefineFun(const QString &a_strName, T a_pFun, bool a_bAllowOpt = true)
|
void DefineFun(const QString &a_strName, T a_pFun, bool a_bAllowOpt = true);
|
||||||
{
|
|
||||||
AddCallback( a_strName, QmuParserCallback(a_pFun, a_bAllowOpt), m_FunDef, ValidNameChars() );
|
|
||||||
}
|
|
||||||
void setAllowSubexpressions(bool value);
|
void setAllowSubexpressions(bool value);
|
||||||
|
|
||||||
std::locale getLocale() const;
|
std::locale getLocale() const;
|
||||||
|
@ -263,6 +254,21 @@ private:
|
||||||
void StackDump(const QStack<token_type > &a_stVal, const QStack<token_type > &a_stOprt) const;
|
void StackDump(const QStack<token_type > &a_stVal, const QStack<token_type > &a_stOprt) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @fn void qmu::QmuParserBase::DefineFun(const string_type &a_strName, fun_type0 a_pFun,
|
||||||
|
* bool a_bAllowOpt = true)
|
||||||
|
* @brief Define a parser function without arguments.
|
||||||
|
* @param a_strName Name of the function
|
||||||
|
* @param a_pFun Pointer to the callback function
|
||||||
|
* @param a_bAllowOpt A flag indicating this function may be optimized
|
||||||
|
*/
|
||||||
|
template<typename T>
|
||||||
|
inline void QmuParserBase::DefineFun(const QString &a_strName, T a_pFun, bool a_bAllowOpt)
|
||||||
|
{
|
||||||
|
AddCallback( a_strName, QmuParserCallback(a_pFun, a_bAllowOpt), m_FunDef, ValidNameChars() );
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief Initialize the token reader.
|
* @brief Initialize the token reader.
|
||||||
|
|
|
@ -132,7 +132,7 @@ inline void VAbstractApplication::setPatternType(const MeasurementsType &pattern
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
template <typename T>
|
template <typename T>
|
||||||
QString VAbstractApplication::LocaleToString(const T &value)
|
inline QString VAbstractApplication::LocaleToString(const T &value)
|
||||||
{
|
{
|
||||||
QLocale loc;
|
QLocale loc;
|
||||||
qApp->Settings()->GetOsSeparator() ? loc = QLocale::system() : loc = QLocale(QLocale::C);
|
qApp->Settings()->GetOsSeparator() ? loc = QLocale::system() : loc = QLocale(QLocale::C);
|
||||||
|
|
|
@ -224,88 +224,24 @@ protected:
|
||||||
|
|
||||||
bool SetObject(const quint32 &id, QComboBox *box, const QString &toolTip);
|
bool SetObject(const quint32 &id, QComboBox *box, const QString &toolTip);
|
||||||
void DeployFormula(QPlainTextEdit *formula, QPushButton *buttonGrowLength, int formulaBaseHeight);
|
void DeployFormula(QPlainTextEdit *formula, QPushButton *buttonGrowLength, int formulaBaseHeight);
|
||||||
template <typename T>
|
|
||||||
void InitArrow(T *ui)
|
|
||||||
{
|
|
||||||
SCASSERT(ui != nullptr);
|
|
||||||
spinBoxAngle = ui->doubleSpinBoxAngle;
|
|
||||||
connect(ui->toolButtonArrowDown, &QPushButton::clicked, this, &DialogTool::ArrowDown);
|
|
||||||
connect(ui->toolButtonArrowUp, &QPushButton::clicked, this, &DialogTool::ArrowUp);
|
|
||||||
connect(ui->toolButtonArrowLeft, &QPushButton::clicked, this, &DialogTool::ArrowLeft);
|
|
||||||
connect(ui->toolButtonArrowRight, &QPushButton::clicked, this, &DialogTool::ArrowRight);
|
|
||||||
connect(ui->toolButtonArrowLeftUp, &QPushButton::clicked, this, &DialogTool::ArrowLeftUp);
|
|
||||||
connect(ui->toolButtonArrowLeftDown, &QPushButton::clicked, this, &DialogTool::ArrowLeftDown);
|
|
||||||
connect(ui->toolButtonArrowRightUp, &QPushButton::clicked, this, &DialogTool::ArrowRightUp);
|
|
||||||
connect(ui->toolButtonArrowRightDown, &QPushButton::clicked, this, &DialogTool::ArrowRightDown);
|
|
||||||
}
|
|
||||||
template <typename T>
|
|
||||||
/**
|
|
||||||
* @brief InitOkCancelApply initialise OK / Cancel and Apply buttons
|
|
||||||
* @param ui Dialog container
|
|
||||||
*/
|
|
||||||
void InitOkCancelApply(T *ui)
|
|
||||||
{
|
|
||||||
InitOkCancel(ui);
|
|
||||||
bApply = ui->buttonBox->button(QDialogButtonBox::Apply);
|
|
||||||
SCASSERT(bApply != nullptr);
|
|
||||||
connect(bApply, &QPushButton::clicked, this, &DialogTool::DialogApply);
|
|
||||||
}
|
|
||||||
template <typename T>
|
|
||||||
/**
|
|
||||||
* @brief InitOkCancel initialise OK and Cancel buttons
|
|
||||||
* @param ui Dialog container
|
|
||||||
*/
|
|
||||||
void InitOkCancel(T *ui)
|
|
||||||
{
|
|
||||||
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
|
||||||
SCASSERT(bOk != nullptr);
|
|
||||||
connect(bOk, &QPushButton::clicked, this, &DialogTool::DialogAccepted);
|
|
||||||
|
|
||||||
QPushButton *bCancel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
|
||||||
SCASSERT(bCancel != nullptr);
|
|
||||||
connect(bCancel, &QPushButton::clicked, this, &DialogTool::DialogRejected);
|
|
||||||
|
|
||||||
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
|
||||||
}
|
|
||||||
template <typename T>
|
|
||||||
/**
|
|
||||||
* @brief InitFormulaUI initialise ui object for formula fild
|
|
||||||
* @param ui Dialog container
|
|
||||||
*/
|
|
||||||
void InitFormulaUI(T *ui)
|
|
||||||
{
|
|
||||||
labelResultCalculation = ui->labelResultCalculation;
|
|
||||||
plainTextEditFormula = ui->plainTextEditFormula;
|
|
||||||
labelEditFormula = ui->labelEditFormula;
|
|
||||||
}
|
|
||||||
template <typename T>
|
|
||||||
void AddVisualization()
|
|
||||||
{
|
|
||||||
if (prepare == false)
|
|
||||||
{
|
|
||||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
|
||||||
SCASSERT(scene != nullptr);
|
|
||||||
|
|
||||||
T *toolVis = qobject_cast<T *>(vis);
|
|
||||||
SCASSERT(toolVis != nullptr);
|
|
||||||
|
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, toolVis, &Visualization::SetFactor);
|
|
||||||
scene->addItem(toolVis);
|
|
||||||
toolVis->RefreshGeometry();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void DeleteVisualization()
|
void InitArrow(T *ui);
|
||||||
{
|
|
||||||
T *toolVis = qobject_cast<T *>(vis);
|
|
||||||
SCASSERT(toolVis != nullptr);
|
|
||||||
|
|
||||||
if (qApp->getCurrentScene()->items().contains(toolVis))
|
template <typename T>
|
||||||
{ // In some cases scene delete object yourself. If not make check program will crash.
|
void InitOkCancelApply(T *ui);
|
||||||
delete vis;
|
|
||||||
}
|
template <typename T>
|
||||||
}
|
void InitOkCancel(T *ui);
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void InitFormulaUI(T *ui);
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void AddVisualization();
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void DeleteVisualization();
|
||||||
|
|
||||||
void ChangeColor(QWidget *widget, const QColor &color);
|
void ChangeColor(QWidget *widget, const QColor &color);
|
||||||
virtual void ShowVisualization() {}
|
virtual void ShowVisualization() {}
|
||||||
|
@ -330,4 +266,97 @@ inline VAbstractTool *DialogTool::GetAssociatedTool()
|
||||||
return this->associatedTool;
|
return this->associatedTool;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
template <typename T>
|
||||||
|
inline void DialogTool::InitArrow(T *ui)
|
||||||
|
{
|
||||||
|
SCASSERT(ui != nullptr);
|
||||||
|
spinBoxAngle = ui->doubleSpinBoxAngle;
|
||||||
|
connect(ui->toolButtonArrowDown, &QPushButton::clicked, this, &DialogTool::ArrowDown);
|
||||||
|
connect(ui->toolButtonArrowUp, &QPushButton::clicked, this, &DialogTool::ArrowUp);
|
||||||
|
connect(ui->toolButtonArrowLeft, &QPushButton::clicked, this, &DialogTool::ArrowLeft);
|
||||||
|
connect(ui->toolButtonArrowRight, &QPushButton::clicked, this, &DialogTool::ArrowRight);
|
||||||
|
connect(ui->toolButtonArrowLeftUp, &QPushButton::clicked, this, &DialogTool::ArrowLeftUp);
|
||||||
|
connect(ui->toolButtonArrowLeftDown, &QPushButton::clicked, this, &DialogTool::ArrowLeftDown);
|
||||||
|
connect(ui->toolButtonArrowRightUp, &QPushButton::clicked, this, &DialogTool::ArrowRightUp);
|
||||||
|
connect(ui->toolButtonArrowRightDown, &QPushButton::clicked, this, &DialogTool::ArrowRightDown);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
template <typename T>
|
||||||
|
/**
|
||||||
|
* @brief InitOkCancelApply initialise OK / Cancel and Apply buttons
|
||||||
|
* @param ui Dialog container
|
||||||
|
*/
|
||||||
|
inline void DialogTool::InitOkCancelApply(T *ui)
|
||||||
|
{
|
||||||
|
InitOkCancel(ui);
|
||||||
|
bApply = ui->buttonBox->button(QDialogButtonBox::Apply);
|
||||||
|
SCASSERT(bApply != nullptr);
|
||||||
|
connect(bApply, &QPushButton::clicked, this, &DialogTool::DialogApply);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
template <typename T>
|
||||||
|
/**
|
||||||
|
* @brief InitOkCancel initialise OK and Cancel buttons
|
||||||
|
* @param ui Dialog container
|
||||||
|
*/
|
||||||
|
inline void DialogTool::InitOkCancel(T *ui)
|
||||||
|
{
|
||||||
|
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||||
|
SCASSERT(bOk != nullptr);
|
||||||
|
connect(bOk, &QPushButton::clicked, this, &DialogTool::DialogAccepted);
|
||||||
|
|
||||||
|
QPushButton *bCancel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||||
|
SCASSERT(bCancel != nullptr);
|
||||||
|
connect(bCancel, &QPushButton::clicked, this, &DialogTool::DialogRejected);
|
||||||
|
|
||||||
|
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
template <typename T>
|
||||||
|
/**
|
||||||
|
* @brief InitFormulaUI initialise ui object for formula fild
|
||||||
|
* @param ui Dialog container
|
||||||
|
*/
|
||||||
|
inline void DialogTool::InitFormulaUI(T *ui)
|
||||||
|
{
|
||||||
|
labelResultCalculation = ui->labelResultCalculation;
|
||||||
|
plainTextEditFormula = ui->plainTextEditFormula;
|
||||||
|
labelEditFormula = ui->labelEditFormula;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
template <typename T>
|
||||||
|
inline void DialogTool::AddVisualization()
|
||||||
|
{
|
||||||
|
if (prepare == false)
|
||||||
|
{
|
||||||
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr);
|
||||||
|
|
||||||
|
T *toolVis = qobject_cast<T *>(vis);
|
||||||
|
SCASSERT(toolVis != nullptr);
|
||||||
|
|
||||||
|
connect(scene, &VMainGraphicsScene::NewFactor, toolVis, &Visualization::SetFactor);
|
||||||
|
scene->addItem(toolVis);
|
||||||
|
toolVis->RefreshGeometry();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
template <typename T>
|
||||||
|
inline void DialogTool::DeleteVisualization()
|
||||||
|
{
|
||||||
|
T *toolVis = qobject_cast<T *>(vis);
|
||||||
|
SCASSERT(toolVis != nullptr);
|
||||||
|
|
||||||
|
if (qApp->getCurrentScene()->items().contains(toolVis))
|
||||||
|
{ // In some cases scene delete object yourself. If not make check program will crash.
|
||||||
|
delete vis;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // DIALOGTOOL_H
|
#endif // DIALOGTOOL_H
|
||||||
|
|
|
@ -94,7 +94,15 @@ protected:
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void ShowToolVisualization(bool show)
|
void ShowToolVisualization(bool show);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(VAbstractSpline)
|
||||||
|
};
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
template <typename T>
|
||||||
|
inline void VAbstractSpline::ShowToolVisualization(bool show)
|
||||||
{
|
{
|
||||||
if (show)
|
if (show)
|
||||||
{
|
{
|
||||||
|
@ -127,8 +135,4 @@ protected:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
Q_DISABLE_COPY(VAbstractSpline)
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // VABSTRACTSPLINE_H
|
#endif // VABSTRACTSPLINE_H
|
||||||
|
|
|
@ -81,7 +81,15 @@ protected:
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void ShowToolVisualization(bool show)
|
void ShowToolVisualization(bool show);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(VToolCut)
|
||||||
|
};
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
template <typename T>
|
||||||
|
inline void VToolCut::ShowToolVisualization(bool show)
|
||||||
{
|
{
|
||||||
if (show)
|
if (show)
|
||||||
{
|
{
|
||||||
|
@ -115,8 +123,5 @@ protected:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private:
|
|
||||||
Q_DISABLE_COPY(VToolCut)
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // VTOOLCUT_H
|
#endif // VTOOLCUT_H
|
||||||
|
|
|
@ -191,16 +191,7 @@ protected:
|
||||||
static int ConfirmDeletion();
|
static int ConfirmDeletion();
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void AddVisualization()
|
void AddVisualization();
|
||||||
{
|
|
||||||
T *visual = new T(getData());
|
|
||||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
|
||||||
SCASSERT(scene != nullptr)
|
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
|
||||||
scene->addItem(visual);
|
|
||||||
|
|
||||||
vis = visual;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void SetVisualization()=0;
|
virtual void SetVisualization()=0;
|
||||||
void ToolCreation(const Source &typeCreation);
|
void ToolCreation(const Source &typeCreation);
|
||||||
|
@ -227,4 +218,18 @@ inline const VContainer *VAbstractTool::getData() const
|
||||||
{
|
{
|
||||||
return &data;
|
return &data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
template <typename T>
|
||||||
|
inline void VAbstractTool::AddVisualization()
|
||||||
|
{
|
||||||
|
T *visual = new T(getData());
|
||||||
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
|
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||||
|
scene->addItem(visual);
|
||||||
|
|
||||||
|
vis = visual;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // VABSTRACTTOOL_H
|
#endif // VABSTRACTTOOL_H
|
||||||
|
|
|
@ -83,7 +83,17 @@ protected:
|
||||||
Qt::PenStyle style = Qt::SolidLine, Qt::PenCapStyle cap = Qt::SquareCap);
|
Qt::PenStyle style = Qt::SolidLine, Qt::PenCapStyle cap = Qt::SquareCap);
|
||||||
|
|
||||||
template <typename Item>
|
template <typename Item>
|
||||||
void AddItem(Item *item)
|
void AddItem(Item *item);
|
||||||
|
|
||||||
|
template <class Item>
|
||||||
|
Item *InitItem(const QColor &color, QGraphicsItem *parent);
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(Visualization)
|
||||||
|
};
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
template <typename Item>
|
||||||
|
inline void Visualization::AddItem(Item *item)
|
||||||
{
|
{
|
||||||
SCASSERT(item != nullptr);
|
SCASSERT(item != nullptr);
|
||||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
@ -94,8 +104,9 @@ protected:
|
||||||
connect(scene, &VMainGraphicsScene::mouseMove, item, &Visualization::MousePos);
|
connect(scene, &VMainGraphicsScene::mouseMove, item, &Visualization::MousePos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
template <class Item>
|
template <class Item>
|
||||||
Item *InitItem(const QColor &color, QGraphicsItem *parent)
|
inline Item *Visualization::InitItem(const QColor &color, QGraphicsItem *parent)
|
||||||
{
|
{
|
||||||
Item *item = new Item(parent);
|
Item *item = new Item(parent);
|
||||||
item->setPen(QPen(color, qApp->toPixel(WidthHairLine(*data->GetPatternUnit()))/factor));
|
item->setPen(QPen(color, qApp->toPixel(WidthHairLine(*data->GetPatternUnit()))/factor));
|
||||||
|
@ -104,8 +115,5 @@ protected:
|
||||||
item->setVisible(false);
|
item->setVisible(false);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
private:
|
|
||||||
Q_DISABLE_COPY(Visualization)
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // VISUALIZATION_H
|
#endif // VISUALIZATION_H
|
||||||
|
|
Loading…
Reference in New Issue
Block a user