Skip to content

Commit

Permalink
Fix issue with focusing text editor inside scalable wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkanovikov committed Sep 25, 2021
1 parent 00e153f commit 53bbb1b
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,17 @@ bool ScalableWrapper::event(QEvent* _event)
// Прочие стандартные обработчики событий
//
default: {
result = QGraphicsView::event(_event);

//
// Переустанавливаем фокус в редактор, иначе в нём пропадает курсор
//
if (_event->type() == QEvent::FocusIn) {
d->editor->clearFocus();
d->editor->setFocus();
} else if (_event->type() == QEvent::FocusOut) {
}

result = QGraphicsView::event(_event);

if (_event->type() == QEvent::FocusOut) {
d->editor->clearFocus();
}

Expand Down Expand Up @@ -388,8 +390,7 @@ bool ScalableWrapper::eventFilter(QObject* _object, QEvent* _event)
//
// Возвращаем фокус редактору, если он его потерял
//
if (_object == d->editor.data() && _event->type() == QEvent::FocusOut) {
d->editor->clearFocus();
if (_object == d->editor.data() && _event->type() == QEvent::FocusOut && hasFocus()) {
d->editor->setFocus();
}

Expand Down

0 comments on commit 53bbb1b

Please sign in to comment.