mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 20:53:50 +00:00
delete record button
This commit is contained in:
parent
7296b09357
commit
95afca0558
2 changed files with 26 additions and 1 deletions
|
@ -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…
Reference in a new issue