mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-29 18:20:58 +02:00
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
This commit is contained in:
@ -23,6 +23,7 @@ ModalOverlay::ModalOverlay(bool enable_wallet, QWidget* parent)
|
||||
parent->installEventFilter(this);
|
||||
raise();
|
||||
}
|
||||
ui->closeButton->installEventFilter(this);
|
||||
|
||||
blockProcessTime.clear();
|
||||
setVisible(false);
|
||||
@ -58,6 +59,11 @@ bool ModalOverlay::eventFilter(QObject * obj, QEvent * ev) {
|
||||
raise();
|
||||
}
|
||||
}
|
||||
|
||||
if (obj == ui->closeButton && ev->type() == QEvent::FocusOut && layerIsVisible) {
|
||||
ui->closeButton->setFocus(Qt::OtherFocusReason);
|
||||
}
|
||||
|
||||
return QWidget::eventFilter(obj, ev);
|
||||
}
|
||||
|
||||
@ -185,6 +191,10 @@ void ModalOverlay::showHide(bool hide, bool userRequested)
|
||||
m_animation.setEndValue(QPoint(0, hide ? height() : 0));
|
||||
m_animation.start(QAbstractAnimation::KeepWhenStopped);
|
||||
layerIsVisible = !hide;
|
||||
|
||||
if (layerIsVisible) {
|
||||
ui->closeButton->setFocus(Qt::OtherFocusReason);
|
||||
}
|
||||
}
|
||||
|
||||
void ModalOverlay::closeClicked()
|
||||
|
Reference in New Issue
Block a user