summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews/qitemdelegate.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/itemviews/qitemdelegate.cpp')
-rw-r--r--src/gui/itemviews/qitemdelegate.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/gui/itemviews/qitemdelegate.cpp b/src/gui/itemviews/qitemdelegate.cpp
index 336ca79..bd6dc62 100644
--- a/src/gui/itemviews/qitemdelegate.cpp
+++ b/src/gui/itemviews/qitemdelegate.cpp
@@ -1226,21 +1226,19 @@ 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.
if (QDragManager::self() && QDragManager::self()->object != 0)
return false;
#endif
- // Opening a modal dialog will start a new eventloop
- // that will process the deleteLater event.
- if (QApplication::activeModalWidget()
- && !QApplication::activeModalWidget()->isAncestorOf(editor)
- && qobject_cast<QDialog*>(QApplication::activeModalWidget()))
- return false;
+
emit commitData(editor);
emit closeEditor(editor, NoHint);
}
@@ -1298,8 +1296,14 @@ bool QItemDelegate::editorEvent(QEvent *event,
return false;
}
- Qt::CheckState state = (static_cast<Qt::CheckState>(value.toInt()) == Qt::Checked
+ Qt::CheckState state;
+ if ( flags & Qt::ItemIsTristate ) {
+ state = static_cast<Qt::CheckState>( (value.toInt() + 1) % 3 );
+ } else {
+ state = (static_cast<Qt::CheckState>(value.toInt()) == Qt::Checked
? Qt::Unchecked : Qt::Checked);
+ }
+
return model->setData(index, state, Qt::CheckStateRole);
}