EditableDatumLabel : Change the 'invisibleToMouse' to 'visibleToMouse' to avoid double negation.
Also add parameter to startEdit to set this setting. Defaulting to false. So that we don't have to set manually again and again in tool settings.
This commit is contained in:
@@ -130,7 +130,7 @@ void EditableDatumLabel::deactivate()
|
||||
}
|
||||
}
|
||||
|
||||
void EditableDatumLabel::startEdit(double val, QObject* eventFilteringObj)
|
||||
void EditableDatumLabel::startEdit(double val, QObject* eventFilteringObj, bool visibleToMouse)
|
||||
{
|
||||
QWidget* mdi = viewer->parentWidget();
|
||||
|
||||
@@ -147,6 +147,10 @@ void EditableDatumLabel::startEdit(double val, QObject* eventFilteringObj)
|
||||
spinBox->installEventFilter(eventFilteringObj);
|
||||
}
|
||||
|
||||
if (!visibleToMouse) {
|
||||
setSpinboxVisibleToMouse(visibleToMouse);
|
||||
}
|
||||
|
||||
spinBox->show();
|
||||
setSpinboxValue(val);
|
||||
//Note: adjustSize apparently uses the Min/Max values to set the size. So if we don't set them to INT_MAX, the spinbox are much too big.
|
||||
@@ -340,9 +344,9 @@ void EditableDatumLabel::setLabelAutoDistanceReverse(bool val)
|
||||
autoDistanceReverse = val;
|
||||
}
|
||||
|
||||
void EditableDatumLabel::setSpinboxInvisibleToMouse(bool val)
|
||||
void EditableDatumLabel::setSpinboxVisibleToMouse(bool val)
|
||||
{
|
||||
spinBox->setAttribute(Qt::WA_TransparentForMouseEvents, val);
|
||||
spinBox->setAttribute(Qt::WA_TransparentForMouseEvents, !val);
|
||||
}
|
||||
|
||||
#include "moc_EditableDatumLabel.cpp"
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
void activate();
|
||||
void deactivate();
|
||||
|
||||
void startEdit(double val, QObject* eventFilteringObj = nullptr);
|
||||
void startEdit(double val, QObject* eventFilteringObj = nullptr, bool visibleToMouse = false);
|
||||
void stopEdit();
|
||||
bool isInEdit();
|
||||
double getValue();
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
void setLabelRange(double val);
|
||||
void setLabelRecommendedDistance();
|
||||
void setLabelAutoDistanceReverse(bool val);
|
||||
void setSpinboxInvisibleToMouse(bool val);
|
||||
void setSpinboxVisibleToMouse(bool val);
|
||||
|
||||
// NOLINTBEGIN
|
||||
SoDatumLabel* label;
|
||||
|
||||
@@ -529,7 +529,7 @@ void InteractiveScale::collectPoint(const SbVec3f& pos3d)
|
||||
|
||||
midPoint = (points[0] + points[1]) / 2;
|
||||
|
||||
measureLabel->startEdit(getDistance(points[1]), this);
|
||||
measureLabel->startEdit(getDistance(points[1]), this, true);
|
||||
|
||||
Q_EMIT enableApplyBtn();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user