New method RemoveAllChild.

--HG--
branch : develop
This commit is contained in:
dismine 2013-10-25 14:16:07 +03:00
parent 473c90c72c
commit d20667f056
3 changed files with 10 additions and 5 deletions

View File

@ -136,6 +136,14 @@ const VContainer *VAbstractTool::getData()const{
return &data; return &data;
} }
void VAbstractTool::RemoveAllChild(QDomElement &domElement){
if ( domElement.hasChildNodes() ){
while ( domElement.childNodes().length() >= 1 ){
domElement.removeChild( domElement.firstChild() );
}
}
}
void VAbstractTool::LineCoefficients(const QLineF &line, qreal *a, qreal *b, qreal *c){ void VAbstractTool::LineCoefficients(const QLineF &line, qreal *a, qreal *b, qreal *c){
//коефіцієнти для рівняння відрізку //коефіцієнти для рівняння відрізку
*a = line.p2().y() - line.p1().y(); *a = line.p2().y() - line.p1().y();

View File

@ -55,6 +55,7 @@ protected:
void AddAttribute(QDomElement &domElement, const QString &name, const QString &value); void AddAttribute(QDomElement &domElement, const QString &name, const QString &value);
const VContainer *getData() const; const VContainer *getData() const;
virtual void RemoveReferens(){} virtual void RemoveReferens(){}
void RemoveAllChild(QDomElement &domElement);
private: private:
Q_DISABLE_COPY(VAbstractTool) Q_DISABLE_COPY(VAbstractTool)
}; };

View File

@ -296,11 +296,7 @@ void VToolDetail::FullUpdateFromGui(int result){
domElement.setAttribute("supplement", QString().setNum(det.getSupplement())); domElement.setAttribute("supplement", QString().setNum(det.getSupplement()));
domElement.setAttribute("closed", QString().setNum(det.getClosed())); domElement.setAttribute("closed", QString().setNum(det.getClosed()));
domElement.setAttribute("width", QString().setNum(det.getWidth())); domElement.setAttribute("width", QString().setNum(det.getWidth()));
if ( domElement.hasChildNodes() ){ RemoveAllChild(domElement);
while ( domElement.childNodes().length() >= 1 ){
domElement.removeChild( domElement.firstChild() );
}
}
for(qint32 i = 0; i < det.CountNode(); ++i){ for(qint32 i = 0; i < det.CountNode(); ++i){
AddNode(domElement, det[i]); AddNode(domElement, det[i]);
} }