mirror of
https://github.com/lubosz/overte.git
synced 2025-04-27 19:55:28 +02:00
adding focus back on _glWidget
This commit is contained in:
parent
386d945eeb
commit
84055a6f0d
1 changed files with 5 additions and 9 deletions
|
@ -4162,15 +4162,9 @@ bool Application::event(QEvent* event) {
|
|||
focusOutEvent(static_cast<QFocusEvent*>(event));
|
||||
return true;
|
||||
case QEvent::FocusIn:
|
||||
{ //testing to see if we can set focus when focus is not set to root window.
|
||||
auto offscreenUi = getOffscreenUI();
|
||||
auto activeFocusItem = offscreenUi->getWindow()->activeFocusItem();
|
||||
|
||||
if (activeFocusItem == NULL) {
|
||||
offscreenUi->getRootItem()->setEnabled(true);
|
||||
offscreenUi->getRootItem()->setFocus(true, Qt::FocusReason::ActiveWindowFocusReason);
|
||||
}
|
||||
|
||||
{ //testing to see if we can set focus when focus is not set to root window.
|
||||
_glWidget->activateWindow();
|
||||
_glWidget->setFocus();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -8782,6 +8776,8 @@ bool Application::isThrottleRendering() const {
|
|||
|
||||
bool Application::hasFocus() const {
|
||||
bool result = (QApplication::activeWindow() != nullptr);
|
||||
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
// On Windows, QWidget::activateWindow() - as called in setFocus() - makes the application's taskbar icon flash but doesn't
|
||||
// take user focus away from their current window. So also check whether the application is the user's current foreground
|
||||
|
|
Loading…
Reference in a new issue