Check if internal cursor stack is empty.

--HG--
branch : feature
This commit is contained in:
dismine 2014-08-29 16:57:12 +03:00
parent 44d1465881
commit b2b7854598
3 changed files with 40 additions and 12 deletions

View File

@ -52,11 +52,14 @@ DialogEditWrongFormula::DialogEditWrongFormula(const VContainer *data, const qui
//Disable Qt::WaitCursor
#ifndef QT_NO_CURSOR
if (QApplication::overrideCursor() != nullptr)
{
if (QApplication::overrideCursor()->shape() == Qt::WaitCursor)
{
restoreCursor = true;
QApplication::restoreOverrideCursor();
}
}
#endif
}

View File

@ -85,7 +85,8 @@ void VFormulaPropertyEditor::setFormula(const VFormula& formula)
//---------------------------------------------------------------------------------------------------------------------
void VFormulaPropertyEditor::onToolButtonClicked()
{
DialogEditWrongFormula* tmpWidget = new DialogEditWrongFormula(formula.getData(), formula.getToolId());
DialogEditWrongFormula* tmpWidget = new DialogEditWrongFormula(formula.getData(), formula.getToolId(),
qApp->getMainWindow());
tmpWidget->setCheckZero(formula.getCheckZero());
tmpWidget->setPostfix(formula.getPostfix());
tmpWidget->setFormula(formula.getFormula(FormulaType::FromUser));

View File

@ -151,6 +151,14 @@ void VToolOptionsPropertyBrowser::userChangedData(VProperty *property)
i->setFormulaLength(variant.value<VFormula>().getFormula(FormulaType::FromUser));
}
}
else if (id == QLatin1String("formulaAngle"))
{
VFormula formula = variant.value<VFormula>();
if (formula.error() == false)
{
i->setFormulaAngle(variant.value<VFormula>().getFormula(FormulaType::FromUser));
}
}
break;
}
default:
@ -216,9 +224,17 @@ void VToolOptionsPropertyBrowser::UpdateOptions()
formula.setCheckZero(true);
formula.setToolId(i->getId());
formula.setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit()));
QVariant value;
value.setValue(formula);
idToProperty[QLatin1String("formulaLength")]->setValue(value);
QVariant valueFormula;
valueFormula.setValue(formula);
idToProperty[QLatin1String("formulaLength")]->setValue(valueFormula);
VFormula formulaAngle(i->getFormulaAngle(), i->getData());
formulaAngle.setCheckZero(false);
formulaAngle.setToolId(i->getId());
formulaAngle.setPostfix(QStringLiteral("°"));
QVariant valueAngle;
valueAngle.setValue(formulaAngle);
idToProperty[QLatin1String("formulaAngle")]->setValue(valueAngle);
break;
}
@ -286,12 +302,20 @@ void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item)
AddProperty(lineTypeProperty, QLatin1String("lineType"));
VFormulaProperty* itemLength = new VFormulaProperty(tr("Length"));
VFormula formula(i->getFormulaLength(), i->getData());
formula.setCheckZero(true);
formula.setToolId(i->getId());
formula.setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit()));
itemLength->setFormula(formula);
VFormula formulaLength(i->getFormulaLength(), i->getData());
formulaLength.setCheckZero(true);
formulaLength.setToolId(i->getId());
formulaLength.setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit()));
itemLength->setFormula(formulaLength);
AddProperty(itemLength, QLatin1String("formulaLength"));
VFormulaProperty* itemAngle = new VFormulaProperty(tr("Angle"));
VFormula formulaAngle(i->getFormulaAngle(), i->getData());
formulaAngle.setCheckZero(false);
formulaAngle.setToolId(i->getId());
formulaAngle.setPostfix(QStringLiteral("°"));
itemAngle->setFormula(formulaAngle);
AddProperty(itemAngle, QLatin1String("formulaAngle"));
break;
}
case VGraphicsSimpleTextItem::Type: