forked from teamnwah/openmw-tes3coop
disabling works
This commit is contained in:
parent
c97172d89c
commit
4a623ace71
2 changed files with 19 additions and 11 deletions
|
@ -363,7 +363,7 @@ void CSVWorld::EditWidget::remake(int row)
|
||||||
|
|
||||||
mWidgetMapper->setCurrentModelIndex(mTable->index(row, 0));
|
mWidgetMapper->setCurrentModelIndex(mTable->index(row, 0));
|
||||||
|
|
||||||
this->setMinimumWidth(300);
|
this->setMinimumWidth(325); //TODO find better way to set the width
|
||||||
this->setWidget(mMainWidget);
|
this->setWidget(mMainWidget);
|
||||||
this->setWidgetResizable(true);
|
this->setWidgetResizable(true);
|
||||||
}
|
}
|
||||||
|
@ -385,7 +385,7 @@ CSVWorld::DialogueSubView::DialogueSubView (const CSMWorld::UniversalId& id, CSM
|
||||||
mDocument(document)
|
mDocument(document)
|
||||||
|
|
||||||
{
|
{
|
||||||
connect(mTable, SIGNAL(dataChanged ( const QModelIndex &, const QModelIndex &)), this, SLOT(dataChanged()));
|
connect(mTable, SIGNAL(dataChanged (const QModelIndex&, const QModelIndex&)), this, SLOT(dataChanged(const QModelIndex&)));
|
||||||
mRow = mTable->getModelIndex (id.getId(), 0).row();
|
mRow = mTable->getModelIndex (id.getId(), 0).row();
|
||||||
QWidget *mainWidget = new QWidget(this);
|
QWidget *mainWidget = new QWidget(this);
|
||||||
|
|
||||||
|
@ -403,14 +403,12 @@ CSVWorld::DialogueSubView::DialogueSubView (const CSMWorld::UniversalId& id, CSM
|
||||||
connect(mEditWidget, SIGNAL(tableMimeDataDropped(QWidget*, const QModelIndex&, const CSMWorld::UniversalId&, const CSMDoc::Document*)),
|
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*)));
|
this, SLOT(tableMimeDataDropped(QWidget*, const QModelIndex&, const CSMWorld::UniversalId&, const CSMDoc::Document*)));
|
||||||
|
|
||||||
|
|
||||||
mMainLayout->addLayout(buttonsLayout);
|
mMainLayout->addLayout(buttonsLayout);
|
||||||
mMainLayout->addWidget(mEditWidget);
|
mMainLayout->addWidget(mEditWidget);
|
||||||
mEditWidget->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
|
mEditWidget->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
|
||||||
|
|
||||||
|
dataChanged(mTable->index(mRow, 0));
|
||||||
setWidget(mainWidget);
|
setWidget(mainWidget);
|
||||||
|
|
||||||
dataChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWorld::DialogueSubView::prevId()
|
void CSVWorld::DialogueSubView::prevId()
|
||||||
|
@ -478,10 +476,19 @@ void CSVWorld::DialogueSubView::nextId()
|
||||||
void CSVWorld::DialogueSubView::setEditLock (bool locked)
|
void CSVWorld::DialogueSubView::setEditLock (bool locked)
|
||||||
{
|
{
|
||||||
mLocked = locked;
|
mLocked = locked;
|
||||||
|
CSMWorld::RecordBase::State state = static_cast<CSMWorld::RecordBase::State>(mTable->data (mTable->index (mRow, 1)).toInt());
|
||||||
|
if (state == CSMWorld::RecordBase::State_Deleted || state == CSMWorld::RecordBase::State_Erased)
|
||||||
|
{
|
||||||
|
mEditWidget->setDisabled(true);
|
||||||
|
} else
|
||||||
|
{
|
||||||
mEditWidget->setDisabled(mLocked);
|
mEditWidget->setDisabled(mLocked);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CSVWorld::DialogueSubView::dataChanged()
|
void CSVWorld::DialogueSubView::dataChanged(const QModelIndex & index)
|
||||||
|
{
|
||||||
|
if (index.row() == mRow)
|
||||||
{
|
{
|
||||||
CSMWorld::RecordBase::State state = static_cast<CSMWorld::RecordBase::State>(mTable->data (mTable->index (mRow, 1)).toInt());
|
CSMWorld::RecordBase::State state = static_cast<CSMWorld::RecordBase::State>(mTable->data (mTable->index (mRow, 1)).toInt());
|
||||||
if (state == CSMWorld::RecordBase::State_Deleted || state == CSMWorld::RecordBase::State_Erased)
|
if (state == CSMWorld::RecordBase::State_Deleted || state == CSMWorld::RecordBase::State_Erased)
|
||||||
|
@ -492,6 +499,7 @@ void CSVWorld::DialogueSubView::dataChanged()
|
||||||
mEditWidget->setDisabled(mLocked);
|
mEditWidget->setDisabled(mLocked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CSVWorld::DialogueSubView::tableMimeDataDropped(QWidget* editor,
|
void CSVWorld::DialogueSubView::tableMimeDataDropped(QWidget* editor,
|
||||||
const QModelIndex& index,
|
const QModelIndex& index,
|
||||||
|
|
|
@ -179,7 +179,7 @@ namespace CSVWorld
|
||||||
|
|
||||||
void prevId();
|
void prevId();
|
||||||
|
|
||||||
void dataChanged();
|
void dataChanged(const QModelIndex & index);
|
||||||
///\brief we need to care for deleting currently edited record
|
///\brief we need to care for deleting currently edited record
|
||||||
|
|
||||||
void tableMimeDataDropped(QWidget* editor, const QModelIndex& index,
|
void tableMimeDataDropped(QWidget* editor, const QModelIndex& index,
|
||||||
|
|
Loading…
Reference in a new issue