DrawSketchController: Fix crazy focus behavior in tool widget (see in the translate tool).
This commit is contained in:
@@ -520,7 +520,7 @@ protected:
|
||||
virtual void afterEnforceControlParameters()
|
||||
{
|
||||
// Give focus to current on-view parameter. In case user interacted outside of 3dview.
|
||||
if (parameterWithFocus >= 0) {
|
||||
if (focusAutoPassing && parameterWithFocus >= 0) {
|
||||
setFocusToOnViewParameter(parameterWithFocus);
|
||||
}
|
||||
}
|
||||
@@ -736,6 +736,8 @@ protected:
|
||||
return keymanager.get();
|
||||
}
|
||||
|
||||
bool focusAutoPassing = true;
|
||||
|
||||
private:
|
||||
/** @name helper functions */
|
||||
//@{
|
||||
|
||||
@@ -147,7 +147,13 @@ public:
|
||||
{
|
||||
adaptDrawingToParameterChange(parameterindex, value); // specialisation interface
|
||||
|
||||
// we block the auto passing of focus back to OVP that would occur in mouseMove
|
||||
// triggered in finishControlsChanged
|
||||
ControllerBase::focusAutoPassing = false;
|
||||
|
||||
ControllerBase::finishControlsChanged();
|
||||
|
||||
ControllerBase::focusAutoPassing = true;
|
||||
}
|
||||
|
||||
void parameterFocusOut(int parameterindex)
|
||||
|
||||
@@ -157,13 +157,14 @@ bool SketcherToolDefaultWidget::eventFilter(QObject* object, QEvent* event)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (event->type() == QEvent::FocusOut) {
|
||||
for (int i = 0; i < nParameters; i++) {
|
||||
auto parameterSpinBox = getParameterSpinBox(i);
|
||||
|
||||
if (object == parameterSpinBox) {
|
||||
signalParameterFocusOut(i);
|
||||
break;
|
||||
else if (event->type() == QEvent::KeyPress) {
|
||||
QKeyEvent* ke = static_cast<QKeyEvent*>(event);
|
||||
if (ke->key() == Qt::Key_Tab || ke->key() == Qt::Key_Return) {
|
||||
for (int i = 0; i < nParameters; i++) {
|
||||
if (object == getParameterSpinBox(i)) {
|
||||
signalParameterFocusOut(i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user