mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-04 03:40:14 +00:00
fixed column handling in table (had problems with filtered out columns before)
This commit is contained in:
parent
55e7e71c11
commit
4327b81bc3
@ -44,20 +44,30 @@ void CSVWorld::Table::contextMenuEvent (QContextMenuEvent *event)
|
|||||||
|
|
||||||
std::vector<std::string> CSVWorld::Table::listRevertableSelectedIds() const
|
std::vector<std::string> CSVWorld::Table::listRevertableSelectedIds() const
|
||||||
{
|
{
|
||||||
/// \todo columns filtering fixes
|
/// \todo Do not use hardcoded column numbers
|
||||||
QModelIndexList selectedRows = selectionModel()->selectedRows();
|
|
||||||
|
|
||||||
std::vector<std::string> revertableIds;
|
std::vector<std::string> revertableIds;
|
||||||
|
|
||||||
for (QModelIndexList::const_iterator iter (selectedRows.begin()); iter!=selectedRows.end(); ++iter)
|
if (mProxyModel->columnCount()>0)
|
||||||
{
|
{
|
||||||
std::string id = mProxyModel->data (*iter).toString().toStdString();
|
QModelIndexList selectedRows = selectionModel()->selectedRows();
|
||||||
|
|
||||||
CSMWorld::RecordBase::State state =
|
for (QModelIndexList::const_iterator iter (selectedRows.begin()); iter!=selectedRows.end();
|
||||||
static_cast<CSMWorld::RecordBase::State> (mModel->data (mModel->getModelIndex (id, 1)).toInt());
|
++iter)
|
||||||
|
{
|
||||||
|
QModelIndex index = mProxyModel->mapToSource (mProxyModel->index (iter->row(), 0));
|
||||||
|
|
||||||
if (state!=CSMWorld::RecordBase::State_BaseOnly)
|
CSMWorld::RecordBase::State state =
|
||||||
revertableIds.push_back (id);
|
static_cast<CSMWorld::RecordBase::State> (
|
||||||
|
mModel->data (mModel->index (index.row(), 1)).toInt());
|
||||||
|
|
||||||
|
if (state!=CSMWorld::RecordBase::State_BaseOnly)
|
||||||
|
{
|
||||||
|
std::string id = mModel->data (mModel->index (index.row(), 0)).
|
||||||
|
toString().toUtf8().constData();
|
||||||
|
|
||||||
|
revertableIds.push_back (id);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return revertableIds;
|
return revertableIds;
|
||||||
@ -65,20 +75,30 @@ std::vector<std::string> CSVWorld::Table::listRevertableSelectedIds() const
|
|||||||
|
|
||||||
std::vector<std::string> CSVWorld::Table::listDeletableSelectedIds() const
|
std::vector<std::string> CSVWorld::Table::listDeletableSelectedIds() const
|
||||||
{
|
{
|
||||||
/// \todo columns filtering fixes
|
/// \todo Do not use hardcoded column numbers
|
||||||
QModelIndexList selectedRows = selectionModel()->selectedRows();
|
|
||||||
|
|
||||||
std::vector<std::string> deletableIds;
|
std::vector<std::string> deletableIds;
|
||||||
|
|
||||||
for (QModelIndexList::const_iterator iter (selectedRows.begin()); iter!=selectedRows.end(); ++iter)
|
if (mProxyModel->columnCount()>0)
|
||||||
{
|
{
|
||||||
std::string id = mProxyModel->data (*iter).toString().toStdString();
|
QModelIndexList selectedRows = selectionModel()->selectedRows();
|
||||||
|
|
||||||
CSMWorld::RecordBase::State state =
|
for (QModelIndexList::const_iterator iter (selectedRows.begin()); iter!=selectedRows.end();
|
||||||
static_cast<CSMWorld::RecordBase::State> (mModel->data (mModel->getModelIndex (id, 1)).toInt());
|
++iter)
|
||||||
|
{
|
||||||
|
QModelIndex index = mProxyModel->mapToSource (mProxyModel->index (iter->row(), 0));
|
||||||
|
|
||||||
if (state!=CSMWorld::RecordBase::State_Deleted)
|
CSMWorld::RecordBase::State state =
|
||||||
deletableIds.push_back (id);
|
static_cast<CSMWorld::RecordBase::State> (
|
||||||
|
mModel->data (mModel->index (index.row(), 1)).toInt());
|
||||||
|
|
||||||
|
if (state!=CSMWorld::RecordBase::State_Deleted)
|
||||||
|
{
|
||||||
|
std::string id = mModel->data (mModel->index (index.row(), 0)).
|
||||||
|
toString().toUtf8().constData();
|
||||||
|
|
||||||
|
deletableIds.push_back (id);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return deletableIds;
|
return deletableIds;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user