|
|
|
@ -177,10 +177,11 @@ void CSVWorld::DialogueDelegateDispatcherProxy::tableMimeDataDropped(const std::
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
CSVWorld::DialogueDelegateDispatcher::DialogueDelegateDispatcher(QObject* parent,
|
|
|
|
|
CSMWorld::IdTable* table, CSMDoc::Document& document, QAbstractItemModel *model) :
|
|
|
|
|
CSMWorld::IdTable* table, CSMWorld::CommandDispatcher& commandDispatcher,
|
|
|
|
|
CSMDoc::Document& document, QAbstractItemModel *model) :
|
|
|
|
|
mParent(parent),
|
|
|
|
|
mTable(model ? model : table),
|
|
|
|
|
mDocument (document),
|
|
|
|
|
mCommandDispatcher (commandDispatcher), mDocument (document),
|
|
|
|
|
mNotEditableDelegate(table, parent)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
@ -192,7 +193,7 @@ CSVWorld::CommandDelegate* CSVWorld::DialogueDelegateDispatcher::makeDelegate(CS
|
|
|
|
|
if (delegateIt == mDelegates.end())
|
|
|
|
|
{
|
|
|
|
|
delegate = CommandDelegateFactoryCollection::get().makeDelegate (
|
|
|
|
|
display, mDocument, mParent);
|
|
|
|
|
display, &mCommandDispatcher, mDocument, mParent);
|
|
|
|
|
mDelegates.insert(std::make_pair(display, delegate));
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
@ -352,13 +353,16 @@ CSVWorld::EditWidget::~EditWidget()
|
|
|
|
|
delete mNestedTableDispatcher;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CSVWorld::EditWidget::EditWidget(QWidget *parent, int row, CSMWorld::IdTable* table, CSMDoc::Document& document, bool createAndDelete) :
|
|
|
|
|
mDispatcher(this, table, document),
|
|
|
|
|
CSVWorld::EditWidget::EditWidget(QWidget *parent,
|
|
|
|
|
int row, CSMWorld::IdTable* table, CSMWorld::CommandDispatcher& commandDispatcher,
|
|
|
|
|
CSMDoc::Document& document, bool createAndDelete) :
|
|
|
|
|
mDispatcher(this, table, commandDispatcher, document),
|
|
|
|
|
mNestedTableDispatcher(NULL),
|
|
|
|
|
QScrollArea(parent),
|
|
|
|
|
mWidgetMapper(NULL),
|
|
|
|
|
mNestedTableMapper(NULL),
|
|
|
|
|
mMainWidget(NULL),
|
|
|
|
|
mCommandDispatcher (commandDispatcher),
|
|
|
|
|
mDocument (document),
|
|
|
|
|
mTable(table)
|
|
|
|
|
{
|
|
|
|
@ -442,7 +446,14 @@ void CSVWorld::EditWidget::remake(int row)
|
|
|
|
|
{
|
|
|
|
|
mNestedModels.push_back(new CSMWorld::NestedTableProxyModel (mTable->index(row, i), display, dynamic_cast<CSMWorld::IdTree*>(mTable)));
|
|
|
|
|
|
|
|
|
|
NestedTable* table = new NestedTable(mDocument, mNestedModels.back(), this);
|
|
|
|
|
int idColumn = mTable->findColumnIndex (CSMWorld::Columns::ColumnId_Id);
|
|
|
|
|
int typeColumn = mTable->findColumnIndex (CSMWorld::Columns::ColumnId_RecordType);
|
|
|
|
|
|
|
|
|
|
CSMWorld::UniversalId id = CSMWorld::UniversalId(
|
|
|
|
|
static_cast<CSMWorld::UniversalId::Type> (mTable->data (mTable->index (row, typeColumn)).toInt()),
|
|
|
|
|
mTable->data (mTable->index (row, idColumn)).toString().toUtf8().constData());
|
|
|
|
|
|
|
|
|
|
NestedTable* table = new NestedTable(mDocument, id, mNestedModels.back(), this);
|
|
|
|
|
// FIXME: does not work well when enum delegates are used
|
|
|
|
|
//table->resizeColumnsToContents();
|
|
|
|
|
table->setEditTriggers(QAbstractItemView::SelectedClicked | QAbstractItemView::CurrentChanged);
|
|
|
|
@ -499,7 +510,7 @@ void CSVWorld::EditWidget::remake(int row)
|
|
|
|
|
mNestedTableMapper->setModel(mNestedModels.back());
|
|
|
|
|
// FIXME: lack MIME support?
|
|
|
|
|
mNestedTableDispatcher =
|
|
|
|
|
new DialogueDelegateDispatcher (this, mTable, mDocument, mNestedModels.back());
|
|
|
|
|
new DialogueDelegateDispatcher (this, mTable, mCommandDispatcher, mDocument, mNestedModels.back());
|
|
|
|
|
mNestedTableMapper->setItemDelegate(mNestedTableDispatcher);
|
|
|
|
|
|
|
|
|
|
int columnCount =
|
|
|
|
@ -626,7 +637,8 @@ CSVWorld::DialogueSubView::DialogueSubView (const CSMWorld::UniversalId& id, CSM
|
|
|
|
|
|
|
|
|
|
mMainLayout = new QVBoxLayout(mainWidget);
|
|
|
|
|
|
|
|
|
|
mEditWidget = new EditWidget(mainWidget, mTable->getModelIndex(mCurrentId, 0).row(), mTable, document, false);
|
|
|
|
|
mEditWidget = new EditWidget(mainWidget,
|
|
|
|
|
mTable->getModelIndex(mCurrentId, 0).row(), mTable, mCommandDispatcher, document, false);
|
|
|
|
|
connect(mEditWidget, SIGNAL(tableMimeDataDropped(QWidget*, const QModelIndex&, const CSMWorld::UniversalId&, const CSMDoc::Document*)),
|
|
|
|
|
this, SLOT(tableMimeDataDropped(QWidget*, const QModelIndex&, const CSMWorld::UniversalId&, const CSMDoc::Document*)));
|
|
|
|
|
|
|
|
|
|