diff options
-rw-r--r-- | src/gui/itemviews/qitemdelegate.cpp | 9 | ||||
-rw-r--r-- | src/gui/itemviews/qstyleditemdelegate.cpp | 9 |
2 files changed, 6 insertions, 12 deletions
diff --git a/src/gui/itemviews/qitemdelegate.cpp b/src/gui/itemviews/qitemdelegate.cpp index 2dd5540..7d0f7c6 100644 --- a/src/gui/itemviews/qitemdelegate.cpp +++ b/src/gui/itemviews/qitemdelegate.cpp @@ -1222,12 +1222,9 @@ bool QItemDelegate::eventFilter(QObject *object, QEvent *event) } else if (event->type() == QEvent::FocusOut || event->type() == QEvent::Hide) { //the Hide event will take care of he editors that are in fact complete dialogs if (!editor->isActiveWindow() || (QApplication::focusWidget() != editor)) { - QWidget *w = QApplication::focusWidget(); - while (w) { // don't worry about focus changes internally in the editor - if (w == editor) - return false; - w = w->parentWidget(); - } + if (editor->isAncestorOf(QApplication::focusWidget())) + return false; // don't worry about focus changes internally in the editor + #ifndef QT_NO_DRAGANDDROP // The window may lose focus during an drag operation. // i.e when dragging involves the taskbar on Windows. diff --git a/src/gui/itemviews/qstyleditemdelegate.cpp b/src/gui/itemviews/qstyleditemdelegate.cpp index edca724..75f2d61 100644 --- a/src/gui/itemviews/qstyleditemdelegate.cpp +++ b/src/gui/itemviews/qstyleditemdelegate.cpp @@ -674,12 +674,9 @@ bool QStyledItemDelegate::eventFilter(QObject *object, QEvent *event) } else if (event->type() == QEvent::FocusOut || event->type() == QEvent::Hide) { //the Hide event will take care of he editors that are in fact complete dialogs if (!editor->isActiveWindow() || (QApplication::focusWidget() != editor)) { - QWidget *w = QApplication::focusWidget(); - while (w) { // don't worry about focus changes internally in the editor - if (w == editor) - return false; - w = w->parentWidget(); - } + if (editor->isAncestorOf(QApplication::focusWidget())) + return false; // don't worry about focus changes internally in the editor + #ifndef QT_NO_DRAGANDDROP // The window may lose focus during an drag operation. // i.e when dragging involves the taskbar on Windows. |