summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-07-31 11:56:37 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-07-31 11:56:37 (GMT)
commit991c2299078978d38692b3499580eb86d0ed7d9b (patch)
tree752b7885e32ef454c3d36f3795a5007fb59e08f9 /src
parent18d9902a2c5650e48a33b09ef68596479e7cb9ff (diff)
downloadQt-991c2299078978d38692b3499580eb86d0ed7d9b.zip
Qt-991c2299078978d38692b3499580eb86d0ed7d9b.tar.gz
Qt-991c2299078978d38692b3499580eb86d0ed7d9b.tar.bz2
Revert "Small simplification of code in ItemViews (delegate)"
This reverts commit 95560abfdd3a1755b69f238eff2954d164dff6a5. Fix comboboxes used as editor. isAncestor() stops at windows. we want to go tought the whole widget chain, including parent windows Use case: examples/itemviews/coloreditorfactory/coloreditorfactory Task-number: 259034
Diffstat (limited to 'src')
-rw-r--r--src/gui/itemviews/qitemdelegate.cpp9
-rw-r--r--src/gui/itemviews/qstyleditemdelegate.cpp9
2 files changed, 12 insertions, 6 deletions
diff --git a/src/gui/itemviews/qitemdelegate.cpp b/src/gui/itemviews/qitemdelegate.cpp
index 336ca79..aff715c 100644
--- a/src/gui/itemviews/qitemdelegate.cpp
+++ b/src/gui/itemviews/qitemdelegate.cpp
@@ -1226,9 +1226,12 @@ bool QItemDelegate::eventFilter(QObject *object, QEvent *event)
} else if (event->type() == QEvent::FocusOut || (event->type() == QEvent::Hide && editor->isWindow())) {
//the Hide event will take care of he editors that are in fact complete dialogs
if (!editor->isActiveWindow() || (QApplication::focusWidget() != editor)) {
- if (editor->isAncestorOf(QApplication::focusWidget()))
- return false; // don't worry about focus changes internally in the 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();
+ }
#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 bd8fdac..7ec2afe 100644
--- a/src/gui/itemviews/qstyleditemdelegate.cpp
+++ b/src/gui/itemviews/qstyleditemdelegate.cpp
@@ -674,9 +674,12 @@ bool QStyledItemDelegate::eventFilter(QObject *object, QEvent *event)
} else if (event->type() == QEvent::FocusOut || (event->type() == QEvent::Hide && editor->isWindow())) {
//the Hide event will take care of he editors that are in fact complete dialogs
if (!editor->isActiveWindow() || (QApplication::focusWidget() != editor)) {
- if (editor->isAncestorOf(QApplication::focusWidget()))
- return false; // don't worry about focus changes internally in the 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();
+ }
#ifndef QT_NO_DRAGANDDROP
// The window may lose focus during an drag operation.
// i.e when dragging involves the taskbar on Windows.