summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews/qstyleditemdelegate.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/itemviews/qstyleditemdelegate.cpp')
-rw-r--r--src/gui/itemviews/qstyleditemdelegate.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gui/itemviews/qstyleditemdelegate.cpp b/src/gui/itemviews/qstyleditemdelegate.cpp
index f64a8ea..c739812 100644
--- a/src/gui/itemviews/qstyleditemdelegate.cpp
+++ b/src/gui/itemviews/qstyleditemdelegate.cpp
@@ -746,8 +746,13 @@ bool QStyledItemDelegate::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);
}