Skip to content

Commit 992b1bb

Browse files
committed
qt: keep focus on "Hide" while ModalOverlay is visible
During the initial sync, the Tab moves the focus to the widgets of the main window, even when the ModalOverlay is visible. This creates some weird rectangular *selections on the screen*. This PR fixes this by keeping the focus on the "Hide" button while the ModalOverlay is visible. Fixes #783
1 parent baed5ed commit 992b1bb

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/qt/modaloverlay.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ ModalOverlay::ModalOverlay(bool enable_wallet, QWidget* parent)
2323
parent->installEventFilter(this);
2424
raise();
2525
}
26+
ui->closeButton->installEventFilter(this);
2627

2728
blockProcessTime.clear();
2829
setVisible(false);
@@ -58,6 +59,11 @@ bool ModalOverlay::eventFilter(QObject * obj, QEvent * ev) {
5859
raise();
5960
}
6061
}
62+
63+
if (obj == ui->closeButton && ev->type() == QEvent::FocusOut && layerIsVisible) {
64+
ui->closeButton->setFocus(Qt::OtherFocusReason);
65+
}
66+
6167
return QWidget::eventFilter(obj, ev);
6268
}
6369

@@ -185,6 +191,10 @@ void ModalOverlay::showHide(bool hide, bool userRequested)
185191
m_animation.setEndValue(QPoint(0, hide ? height() : 0));
186192
m_animation.start(QAbstractAnimation::KeepWhenStopped);
187193
layerIsVisible = !hide;
194+
195+
if (layerIsVisible) {
196+
ui->closeButton->setFocus(Qt::OtherFocusReason);
197+
}
188198
}
189199

190200
void ModalOverlay::closeClicked()

0 commit comments

Comments
 (0)