1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 21:23:52 +00:00
This commit is contained in:
Marek Kochanowicz 2014-03-11 18:38:37 +01:00
parent 5ad572346b
commit 81f32976e3

View file

@ -260,6 +260,10 @@ CSVWorld::DialogueSubView::DialogueSubView (const CSMWorld::UniversalId& id, CSM
mDispatcher(this, dynamic_cast<CSMWorld::IdTable*>(document.getData().getTableModel (id)), document.getUndoStack())
{
CSMWorld::IdTable* model = dynamic_cast<CSMWorld::IdTable*>(document.getData().getTableModel (id));
const QModelIndex indexToFocus(model->getModelIndex (id.getId(), 0));
const int focusedRow = indexToFocus.row();
QWidget *widget = new QWidget (this);
setWidget (widget);
@ -280,9 +284,7 @@ CSVWorld::DialogueSubView::DialogueSubView (const CSMWorld::UniversalId& id, CSM
widget->setLayout (mainLayout);
QAbstractItemModel *model = document.getData().getTableModel (id);
int columns = model->columnCount();
const int columns = model->columnCount();
mWidgetMapper = new QDataWidgetMapper (this);
mWidgetMapper->setModel (model);
@ -301,7 +303,7 @@ CSVWorld::DialogueSubView::DialogueSubView (const CSMWorld::UniversalId& id, CSM
(model->headerData (i, Qt::Horizontal, CSMWorld::ColumnBase::Role_Display).toInt());
mDispatcher.makeDelegate(display);
QWidget *editor = mDispatcher.makeEditor(display, (model->index (0, i)));
QWidget *editor = mDispatcher.makeEditor(display, (model->index (focusedRow, i)));
if (editor)
{
@ -325,8 +327,7 @@ CSVWorld::DialogueSubView::DialogueSubView (const CSMWorld::UniversalId& id, CSM
}
}
mWidgetMapper->setCurrentModelIndex (
dynamic_cast<CSMWorld::IdTable&> (*model).getModelIndex (id.getId(), 0));
mWidgetMapper->setCurrentModelIndex (indexToFocus);
}
void CSVWorld::DialogueSubView::setEditLock (bool locked)