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 //Disable Qt::WaitCursor
#ifndef QT_NO_CURSOR #ifndef QT_NO_CURSOR
if (QApplication::overrideCursor() != nullptr)
{
if (QApplication::overrideCursor()->shape() == Qt::WaitCursor) if (QApplication::overrideCursor()->shape() == Qt::WaitCursor)
{ {
restoreCursor = true; restoreCursor = true;
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
} }
}
#endif #endif
} }

View File

@ -85,7 +85,8 @@ void VFormulaPropertyEditor::setFormula(const VFormula& formula)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VFormulaPropertyEditor::onToolButtonClicked() 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->setCheckZero(formula.getCheckZero());
tmpWidget->setPostfix(formula.getPostfix()); tmpWidget->setPostfix(formula.getPostfix());
tmpWidget->setFormula(formula.getFormula(FormulaType::FromUser)); 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)); 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; break;
} }
default: default:
@ -216,9 +224,17 @@ void VToolOptionsPropertyBrowser::UpdateOptions()
formula.setCheckZero(true); formula.setCheckZero(true);
formula.setToolId(i->getId()); formula.setToolId(i->getId());
formula.setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit())); formula.setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit()));
QVariant value; QVariant valueFormula;
value.setValue(formula); valueFormula.setValue(formula);
idToProperty[QLatin1String("formulaLength")]->setValue(value); 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; break;
} }
@ -286,12 +302,20 @@ void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item)
AddProperty(lineTypeProperty, QLatin1String("lineType")); AddProperty(lineTypeProperty, QLatin1String("lineType"));
VFormulaProperty* itemLength = new VFormulaProperty(tr("Length")); VFormulaProperty* itemLength = new VFormulaProperty(tr("Length"));
VFormula formula(i->getFormulaLength(), i->getData()); VFormula formulaLength(i->getFormulaLength(), i->getData());
formula.setCheckZero(true); formulaLength.setCheckZero(true);
formula.setToolId(i->getId()); formulaLength.setToolId(i->getId());
formula.setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit())); formulaLength.setPostfix(VDomDocument::UnitsToStr(qApp->patternUnit()));
itemLength->setFormula(formula); itemLength->setFormula(formulaLength);
AddProperty(itemLength, QLatin1String("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; break;
} }
case VGraphicsSimpleTextItem::Type: case VGraphicsSimpleTextItem::Type: