From 1f1774b5e12f17eade42d916608763252c809ea3 Mon Sep 17 00:00:00 2001 From: Marek Kochanowicz Date: Sat, 8 Mar 2014 16:54:05 +0100 Subject: [PATCH] changing the enumdelegate seteditordata --- apps/opencs/view/world/enumdelegate.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/opencs/view/world/enumdelegate.cpp b/apps/opencs/view/world/enumdelegate.cpp index fc9b7ee3b..b882e20e6 100644 --- a/apps/opencs/view/world/enumdelegate.cpp +++ b/apps/opencs/view/world/enumdelegate.cpp @@ -60,7 +60,14 @@ void CSVWorld::EnumDelegate::setEditorData (QWidget *editor, const QModelIndex& { if (QComboBox *comboBox = dynamic_cast (editor)) { - int value = index.data (Qt::EditRole).toInt(); + QVariant data = index.data (Qt::EditRole); + + if (!data.isValid()) + { + data = index.data (Qt::DisplayRole); + } + + int value = data.toInt(); std::size_t size = mValues.size();