Merge pull request #15877 from amerhifi/bugz-690

case BUGZ-690 & BUGZ382 : adding a null check escape to the activeItem. On right click back to …
This commit is contained in:
Amer 2019-07-09 09:17:30 -07:00 committed by GitHub
commit 749a78680d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4164,6 +4164,13 @@ bool Application::event(QEvent* event) {
case QEvent::FocusOut:
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.
_glWidget->activateWindow();
_glWidget->setFocus();
return true;
}
case QEvent::TouchBegin:
touchBeginEvent(static_cast<QTouchEvent*>(event));
event->accept();
@ -5125,7 +5132,7 @@ void Application::idle() {
// If the offscreen Ui has something active that is NOT the root, then assume it has keyboard focus.
if (offscreenUi && offscreenUi->getWindow()) {
auto activeFocusItem = offscreenUi->getWindow()->activeFocusItem();
if (_keyboardDeviceHasFocus && activeFocusItem != offscreenUi->getRootItem()) {
if (_keyboardDeviceHasFocus && (activeFocusItem != NULL && activeFocusItem != offscreenUi->getRootItem())) {
_keyboardMouseDevice->pluginFocusOutEvent();
_keyboardDeviceHasFocus = false;
synthesizeKeyReleasEvents();
@ -8772,6 +8779,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