Skip to content

Commit 6ae903e

Browse files
committed
Merge #795: Keep focus on "Hide" while ModalOverlay is visible
992b1bb qt: keep focus on "Hide" while ModalOverlay is visible (Jadi) Pull request description: 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 ACKs for top commit: pablomartin4btc: Concept & approach ACK 992b1bb hebasto: re-ACK 992b1bb Tree-SHA512: f702a3fd51db4bc10780bccf76394e35a6b5fb45db72c9c23cd10d777106b08c61077d2d989003838921e76d2cb44f809399f31df76448e4305a6c2a71b5c6a3
2 parents 01ed492 + 992b1bb commit 6ae903e

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
@@ -25,6 +25,7 @@ ModalOverlay::ModalOverlay(bool enable_wallet, QWidget* parent)
2525
parent->installEventFilter(this);
2626
raise();
2727
}
28+
ui->closeButton->installEventFilter(this);
2829

2930
blockProcessTime.clear();
3031
setVisible(false);
@@ -60,6 +61,11 @@ bool ModalOverlay::eventFilter(QObject * obj, QEvent * ev) {
6061
raise();
6162
}
6263
}
64+
65+
if (obj == ui->closeButton && ev->type() == QEvent::FocusOut && layerIsVisible) {
66+
ui->closeButton->setFocus(Qt::OtherFocusReason);
67+
}
68+
6369
return QWidget::eventFilter(obj, ev);
6470
}
6571

@@ -187,6 +193,10 @@ void ModalOverlay::showHide(bool hide, bool userRequested)
187193
m_animation.setEndValue(QPoint(0, hide ? height() : 0));
188194
m_animation.start(QAbstractAnimation::KeepWhenStopped);
189195
layerIsVisible = !hide;
196+
197+
if (layerIsVisible) {
198+
ui->closeButton->setFocus(Qt::OtherFocusReason);
199+
}
190200
}
191201

192202
void ModalOverlay::closeClicked()

0 commit comments

Comments
 (0)