Sketcher: Make TAB lock the label if user has typed previously
This commit is contained in:
@@ -215,9 +215,15 @@ bool EditableDatumLabel::eventFilter(QObject* watched, QEvent* event)
|
||||
{
|
||||
if (event->type() == QEvent::KeyPress) {
|
||||
auto* keyEvent = static_cast<QKeyEvent*>(event);
|
||||
if (keyEvent->key() == Qt::Key_Return || keyEvent->key() == Qt::Key_Enter) {
|
||||
if (keyEvent->key() == Qt::Key_Return || keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Tab) {
|
||||
|
||||
if (auto* spinBox = qobject_cast<QAbstractSpinBox*>(watched)) {
|
||||
// if tab has been pressed and user did not type anything previously,
|
||||
// then just cycle but don't lock anything, otherwise we lock the label
|
||||
if (keyEvent->key() == Qt::Key_Tab && !this->isSet) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// for ctrl + enter we accept values as they are
|
||||
if (keyEvent->modifiers() & Qt::ControlModifier) {
|
||||
Q_EMIT this->finishEditingOnAllOVPs();
|
||||
|
||||
Reference in New Issue
Block a user