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:
Paddle
2023-10-18 16:05:36 +02:00
committed by abdullahtahiriyo
parent aaa962944b
commit 7f1fe0a3f7
3 changed files with 10 additions and 6 deletions

View File

@@ -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"