EditableDatumLabel : prevent re-activation or re-startEdit.
This commit is contained in:
@@ -95,7 +95,7 @@ EditableDatumLabel::~EditableDatumLabel()
|
|||||||
|
|
||||||
void EditableDatumLabel::activate()
|
void EditableDatumLabel::activate()
|
||||||
{
|
{
|
||||||
if (!viewer) {
|
if (!viewer || isActive()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,6 +133,10 @@ void EditableDatumLabel::deactivate()
|
|||||||
|
|
||||||
void EditableDatumLabel::startEdit(double val, QObject* eventFilteringObj, bool visibleToMouse)
|
void EditableDatumLabel::startEdit(double val, QObject* eventFilteringObj, bool visibleToMouse)
|
||||||
{
|
{
|
||||||
|
if (isInEdit()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QWidget* mdi = viewer->parentWidget();
|
QWidget* mdi = viewer->parentWidget();
|
||||||
|
|
||||||
label->string = " ";
|
label->string = " ";
|
||||||
@@ -183,13 +187,18 @@ void EditableDatumLabel::stopEdit()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EditableDatumLabel::isInEdit()
|
bool EditableDatumLabel::isActive() const
|
||||||
{
|
{
|
||||||
return spinBox;
|
return cameraSensor != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EditableDatumLabel::isInEdit() const
|
||||||
|
{
|
||||||
|
return spinBox != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double EditableDatumLabel::getValue()
|
double EditableDatumLabel::getValue() const
|
||||||
{
|
{
|
||||||
// We use value rather than spinBox->rawValue() in case edit stopped.
|
// We use value rather than spinBox->rawValue() in case edit stopped.
|
||||||
return value;
|
return value;
|
||||||
@@ -328,11 +337,13 @@ void EditableDatumLabel::setLabelDistance(double val)
|
|||||||
label->param1 = float(val);
|
label->param1 = float(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOLINTNEXTLINE
|
||||||
void EditableDatumLabel::setLabelStartAngle(double val)
|
void EditableDatumLabel::setLabelStartAngle(double val)
|
||||||
{
|
{
|
||||||
label->param2 = float(val);
|
label->param2 = float(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOLINTNEXTLINE
|
||||||
void EditableDatumLabel::setLabelRange(double val)
|
void EditableDatumLabel::setLabelRange(double val)
|
||||||
{
|
{
|
||||||
label->param3 = float(val);
|
label->param3 = float(val);
|
||||||
|
|||||||
@@ -53,8 +53,9 @@ public:
|
|||||||
|
|
||||||
void startEdit(double val, QObject* eventFilteringObj = nullptr, bool visibleToMouse = false);
|
void startEdit(double val, QObject* eventFilteringObj = nullptr, bool visibleToMouse = false);
|
||||||
void stopEdit();
|
void stopEdit();
|
||||||
bool isInEdit();
|
bool isActive() const;
|
||||||
double getValue();
|
bool isInEdit() const;
|
||||||
|
double getValue() const;
|
||||||
void setSpinboxValue(double val, const Base::Unit& unit = Base::Unit::Length);
|
void setSpinboxValue(double val, const Base::Unit& unit = Base::Unit::Length);
|
||||||
void setPlacement(const Base::Placement& plc);
|
void setPlacement(const Base::Placement& plc);
|
||||||
void setColor(SbColor color);
|
void setColor(SbColor color);
|
||||||
|
|||||||
Reference in New Issue
Block a user