Fixed bug with change name of drawing.

--HG--
branch : develop
This commit is contained in:
dismine 2013-10-10 13:00:04 +03:00
parent ca61b27599
commit 80b5fe6d5e
3 changed files with 19 additions and 6 deletions

View File

@ -198,8 +198,12 @@ void MainWindow::OptionDraw(){
}
delete dlg;
index = comboBoxDraws->findText(doc->GetNameActivDraw());
doc->SetNameDraw(nameDraw);
if(doc->SetNameDraw(nameDraw)){
comboBoxDraws->setItemText(index, nameDraw);
} else {
QMessageBox::warning(this, tr("Error saving change!!!"), tr("Can't save new name of drawing"));
}
}
template <typename Dialog, typename Func>

View File

@ -169,11 +169,20 @@ void VDomDocument::ChangeActivDraw(const QString& name, Document::Documents pars
}
}
void VDomDocument::SetNameDraw(const QString& name){
bool VDomDocument::SetNameDraw(const QString& name){
Q_ASSERT_X(!name.isEmpty(), "SetNameDraw", "name draw is empty");
QString oldName = nameActivDraw;
QDomElement element;
if(GetActivDrawElement(element)){
nameActivDraw = name;
element.setAttribute("name", nameActivDraw);
emit haveChange();
emit ChangedNameDraw(oldName, nameActivDraw);
return true;
} else {
qWarning()<<"Can't find activ draw"<<Q_FUNC_INFO;
return false;
}
}
void VDomDocument::SetActivDraw(const QString& name){

View File

@ -55,7 +55,7 @@ public:
bool GetActivModelingElement(QDomElement &element);
bool GetActivDetailsElement(QDomElement &element);
bool appendDraw(const QString& name);
void SetNameDraw(const QString& name);
bool SetNameDraw(const QString& name);
void Parse(Document::Documents parse, VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail);
QHash<qint64, VDataTool*>* getTools();
QVector<VToolRecord> *getHistory();