delete record button

actorid
Marek Kochanowicz 11 years ago
parent 7296b09357
commit 95afca0558

@ -418,6 +418,7 @@ CSVWorld::DialogueSubView::DialogueSubView (const CSMWorld::UniversalId& id, CSM
connect(prevButton, SIGNAL(clicked()), this, SLOT(prevId()));
connect(revertButton, SIGNAL(clicked()), this, SLOT(revertRecord()));
connect(deleteButton, SIGNAL(clicked()), this, SLOT(deleteRecord()));
mMainLayout = new QVBoxLayout(mainWidget);
@ -550,7 +551,30 @@ void CSVWorld::DialogueSubView::revertRecord()
{
if (mTable->rowCount() == 0)
{
mEditWidget->setDisabled(true);
mEditWidget->setDisabled(true); //closing the editor is other option
return;
}
if (mRow >= mTable->rowCount())
{
prevId();
} else {
dataChanged(mTable->index(mRow, 0));
}
}
}
}
void CSVWorld::DialogueSubView::deleteRecord()
{
int rows = mTable->rowCount();
if (!mLocked && mTable->columnCount() > 0 && mRow < mTable->rowCount() )
{
mUndoStack.push(new CSMWorld::DeleteCommand(*mTable, mTable->data(mTable->index (mRow, 0)).toString().toStdString()));
if (rows != mTable->rowCount())
{
if (mTable->rowCount() == 0)
{
mEditWidget->setDisabled(true); //closing the editor is other option
return;
}
if (mRow >= mTable->rowCount())

@ -180,6 +180,7 @@ namespace CSVWorld
void prevId();
void revertRecord();
void deleteRecord();
void dataChanged(const QModelIndex & index);
///\brief we need to care for deleting currently edited record

Loading…
Cancel
Save