Fixed bugs.
--HG-- branch : feature
This commit is contained in:
parent
74b84740eb
commit
2069713ff6
|
@ -480,7 +480,7 @@ void VToolOptionsPropertyBrowser::AddPropertyCrossPoint(Tool *i, const QString &
|
|||
{
|
||||
VEnumProperty* itemProperty = new VEnumProperty(propertyName);
|
||||
itemProperty->setLiterals(QStringList()<< tr("First point") << tr("Second point"));
|
||||
itemProperty->setValue(static_cast<int>(i->GetCrossCirclesPoint()));
|
||||
itemProperty->setValue(static_cast<int>(i->GetCrossCirclesPoint())-1);
|
||||
AddProperty(itemProperty, AttrCrossPoint);
|
||||
}
|
||||
|
||||
|
@ -490,7 +490,7 @@ void VToolOptionsPropertyBrowser::AddPropertyVCrossPoint(Tool *i, const QString
|
|||
{
|
||||
auto itemProperty = new VEnumProperty(propertyName);
|
||||
itemProperty->setLiterals(QStringList()<< tr("Highest point") << tr("Lowest point"));
|
||||
itemProperty->setValue(static_cast<int>(i->GetVCrossPoint()));
|
||||
itemProperty->setValue(static_cast<int>(i->GetVCrossPoint())-1);
|
||||
AddProperty(itemProperty, AttrVCrossPoint);
|
||||
}
|
||||
|
||||
|
@ -500,7 +500,7 @@ void VToolOptionsPropertyBrowser::AddPropertyHCrossPoint(Tool *i, const QString
|
|||
{
|
||||
auto itemProperty = new VEnumProperty(propertyName);
|
||||
itemProperty->setLiterals(QStringList()<< tr("Leftmost point") << tr("Rightmost point"));
|
||||
itemProperty->setValue(static_cast<int>(i->GetHCrossPoint()));
|
||||
itemProperty->setValue(static_cast<int>(i->GetHCrossPoint())-1);
|
||||
AddProperty(itemProperty, AttrHCrossPoint);
|
||||
}
|
||||
|
||||
|
@ -629,9 +629,9 @@ Type VToolOptionsPropertyBrowser::GetCrossPoint(const QVariant &value)
|
|||
{
|
||||
switch(val)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
cross = static_cast<Type>(val);
|
||||
cross = static_cast<Type>(val+1);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -2037,7 +2037,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolPointOfIntersectionArcs()
|
|||
VToolPointOfIntersectionArcs *i = qgraphicsitem_cast<VToolPointOfIntersectionArcs *>(currentItem);
|
||||
|
||||
idToProperty[AttrName]->setValue(i->name());
|
||||
idToProperty[AttrCrossPoint]->setValue(static_cast<int>(i->GetCrossCirclesPoint()));
|
||||
idToProperty[AttrCrossPoint]->setValue(static_cast<int>(i->GetCrossCirclesPoint())-1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -2046,7 +2046,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolPointOfIntersectionCircles()
|
|||
VToolPointOfIntersectionCircles *i = qgraphicsitem_cast<VToolPointOfIntersectionCircles *>(currentItem);
|
||||
|
||||
idToProperty[AttrName]->setValue(i->name());
|
||||
idToProperty[AttrCrossPoint]->setValue(static_cast<int>(i->GetCrossCirclesPoint()));
|
||||
idToProperty[AttrCrossPoint]->setValue(static_cast<int>(i->GetCrossCirclesPoint())-1);
|
||||
|
||||
QVariant c1Radius;
|
||||
c1Radius.setValue(i->GetFirstCircleRadius());
|
||||
|
@ -2063,8 +2063,8 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolPointOfIntersectionCurves()
|
|||
auto i = qgraphicsitem_cast<VToolPointOfIntersectionCurves *>(currentItem);
|
||||
|
||||
idToProperty[AttrName]->setValue(i->name());
|
||||
idToProperty[AttrVCrossPoint]->setValue(static_cast<int>(i->GetVCrossPoint()));
|
||||
idToProperty[AttrHCrossPoint]->setValue(static_cast<int>(i->GetHCrossPoint()));
|
||||
idToProperty[AttrVCrossPoint]->setValue(static_cast<int>(i->GetVCrossPoint())-1);
|
||||
idToProperty[AttrHCrossPoint]->setValue(static_cast<int>(i->GetHCrossPoint())-1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -2073,7 +2073,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolPointFromCircleAndTangent()
|
|||
VToolPointFromCircleAndTangent *i = qgraphicsitem_cast<VToolPointFromCircleAndTangent *>(currentItem);
|
||||
|
||||
idToProperty[AttrName]->setValue(i->name());
|
||||
idToProperty[AttrCrossPoint]->setValue(static_cast<int>(i->GetCrossCirclesPoint()));
|
||||
idToProperty[AttrCrossPoint]->setValue(static_cast<int>(i->GetCrossCirclesPoint())-1);
|
||||
|
||||
QVariant cRadius;
|
||||
cRadius.setValue(i->GetCircleRadius());
|
||||
|
@ -2086,7 +2086,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolPointFromArcAndTangent()
|
|||
VToolPointFromArcAndTangent *i = qgraphicsitem_cast<VToolPointFromArcAndTangent *>(currentItem);
|
||||
|
||||
idToProperty[AttrName]->setValue(i->name());
|
||||
idToProperty[AttrCrossPoint]->setValue(static_cast<int>(i->GetCrossCirclesPoint()));
|
||||
idToProperty[AttrCrossPoint]->setValue(static_cast<int>(i->GetCrossCirclesPoint())-1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -46,6 +46,7 @@ DialogPointOfIntersectionCurves::DialogPointOfIntersectionCurves(const VContaine
|
|||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
|
||||
InitOkCancelApply(ui);
|
||||
CheckState();
|
||||
|
||||
FillComboBoxCurves(ui->comboBoxCurve1);
|
||||
FillComboBoxCurves(ui->comboBoxCurve2);
|
||||
|
@ -53,6 +54,10 @@ DialogPointOfIntersectionCurves::DialogPointOfIntersectionCurves(const VContaine
|
|||
FillComboBoxHCrossCurvesPoint(ui->comboBoxHCorrection);
|
||||
|
||||
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointOfIntersectionCurves::NamePointChanged);
|
||||
connect(ui->comboBoxCurve1, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
|
||||
this, &DialogPointOfIntersectionCurves::CurveChanged);
|
||||
connect(ui->comboBoxCurve2, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
|
||||
this, &DialogPointOfIntersectionCurves::CurveChanged);
|
||||
|
||||
vis = new VisToolPointOfIntersectionCurves(data);
|
||||
}
|
||||
|
@ -80,7 +85,7 @@ quint32 DialogPointOfIntersectionCurves::GetFirstCurveId() const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointOfIntersectionCurves::SetFirstCurveId(const quint32 &value)
|
||||
{
|
||||
setCurrentPointId(ui->comboBoxCurve1, value);
|
||||
setCurrentCurveId(ui->comboBoxCurve1, value);
|
||||
|
||||
auto point = qobject_cast<VisToolPointOfIntersectionCurves *>(vis);
|
||||
SCASSERT(point != nullptr);
|
||||
|
@ -96,7 +101,7 @@ quint32 DialogPointOfIntersectionCurves::GetSecondCurveId() const
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointOfIntersectionCurves::SetSecondCurveId(const quint32 &value)
|
||||
{
|
||||
setCurrentPointId(ui->comboBoxCurve2, value);
|
||||
setCurrentCurveId(ui->comboBoxCurve2, value);
|
||||
|
||||
auto point = qobject_cast<VisToolPointOfIntersectionCurves *>(vis);
|
||||
SCASSERT(point != nullptr);
|
||||
|
@ -202,3 +207,34 @@ void DialogPointOfIntersectionCurves::SaveData()
|
|||
point->setHCrossPoint(GetHCrossPoint());
|
||||
point->RefreshGeometry();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointOfIntersectionCurves::CheckState()
|
||||
{
|
||||
SCASSERT(bOk != nullptr);
|
||||
bOk->setEnabled(flagName && flagError);
|
||||
// In case dialog hasn't apply button
|
||||
if ( bApply != nullptr)
|
||||
{
|
||||
bApply->setEnabled(bOk->isEnabled());
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointOfIntersectionCurves::CurveChanged()
|
||||
{
|
||||
QColor color = okColor;
|
||||
if (getCurrentObjectId(ui->comboBoxCurve1) == getCurrentObjectId(ui->comboBoxCurve2))
|
||||
{
|
||||
flagError = false;
|
||||
color = errorColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
flagError = true;
|
||||
color = okColor;
|
||||
}
|
||||
ChangeColor(ui->labelCurve1, color);
|
||||
ChangeColor(ui->labelCurve2, color);
|
||||
CheckState();
|
||||
}
|
||||
|
|
|
@ -67,6 +67,10 @@ protected:
|
|||
* @brief SaveData Put dialog data in local variables
|
||||
*/
|
||||
virtual void SaveData() Q_DECL_OVERRIDE;
|
||||
virtual void CheckState() Q_DECL_OVERRIDE;
|
||||
|
||||
private slots:
|
||||
void CurveChanged();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogPointOfIntersectionCurves)
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<widget class="QLabel" name="labelCurve1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -44,7 +44,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<widget class="QLabel" name="labelCurve2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
|
|
Loading…
Reference in New Issue
Block a user