dismiss on focus out if a View was clicked

BUG:334810
This commit is contained in:
Marco Martin 2014-05-15 14:40:03 +02:00
parent 80be35661c
commit 5600cb0fea

View File

@ -22,6 +22,7 @@
#include "dialog.h"
#include "../declarativeimports/core/framesvgitem.h"
#include "dialogshadows_p.h"
#include "view.h"
#include <QApplication>
#include <QQuickItem>
@ -793,7 +794,7 @@ void Dialog::focusOutEvent(QFocusEvent *ev)
const QWindow *focusWindow = QGuiApplication::focusWindow();
bool childHasFocus = (focusWindow && focusWindow->isActive() && isAncestorOf(focusWindow));
if (!parentHasFocus && !childHasFocus) {
if (qobject_cast<const View *>(focusWindow) || (!parentHasFocus && !childHasFocus)) {
qDebug() << "DIALOG: hiding dialog.";
setVisible(false);
emit windowDeactivated();