summaryrefslogtreecommitdiffstats
path: root/pokemodr/TileDelegate.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pokemodr/TileDelegate.cpp')
-rw-r--r--pokemodr/TileDelegate.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/pokemodr/TileDelegate.cpp b/pokemodr/TileDelegate.cpp
index 1fb26541..ce6a67eb 100644
--- a/pokemodr/TileDelegate.cpp
+++ b/pokemodr/TileDelegate.cpp
@@ -38,13 +38,17 @@ QWidget* TileDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem&
void TileDelegate::setEditorData(QWidget* editor, const QModelIndex& index) const
{
for (int i = 0; i < static_cast<ObjectUI*>(editor->parent())->getOriginal()->getPokemod().getTileCount(); ++i)
- static_cast<KComboBox*>(editor)->addItem(ImageCache::open(static_cast<ObjectUI*>(editor->parent())->getOriginal()->getPokemod().getTile(i).getPic()), static_cast<MapUI*>(editor->parent())->getOriginal()->getPokemod().getTile(i).getName());
+ {
+ const Tile& t = static_cast<ObjectUI*>(editor->parent())->getOriginal()->getPokemod().getTile(i);
+ static_cast<KComboBox*>(editor)->addItem(ImageCache::open(t.getPic()), t.getName());
+ static_cast<KComboBox*>(editor)->setItemData(i, QVariant(t.getId()));
+ }
static_cast<KComboBox*>(editor)->setCurrentIndex(index.data(Qt::EditRole).toInt());
}
void TileDelegate::setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const
{
- static_cast<TilemapModel*>(model)->setData(index, static_cast<KComboBox*>(editor)->currentIndex());
+ static_cast<TilemapModel*>(model)->setData(index, static_cast<KComboBox*>(editor)->itemData(static_cast<KComboBox*>(editor)->currentIndex()));
}
void TileDelegate::updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex&) const