mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-27 12:35:46 +00:00
Nested model supports editing now.
This commit is contained in:
parent
5eac32e3d3
commit
c96d48fb91
@ -80,3 +80,14 @@ QVariant CSMWorld::NestedTableModel::headerData(int section,
|
|||||||
{
|
{
|
||||||
return mMainModel->nestedHeaderData(mParentColumn, section, orientation, role);
|
return mMainModel->nestedHeaderData(mParentColumn, section, orientation, role);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool CSMWorld::NestedTableModel::setData ( const QModelIndex & index, const QVariant & value, int role)
|
||||||
|
{
|
||||||
|
return mMainModel->setData(mapToSource(index), value, role);
|
||||||
|
}
|
||||||
|
|
||||||
|
Qt::ItemFlags CSMWorld::NestedTableModel::flags(const QModelIndex& index) const
|
||||||
|
{
|
||||||
|
return mMainModel->flags(mMainModel->index(0, mParentColumn));
|
||||||
|
}
|
||||||
|
@ -45,6 +45,10 @@ namespace CSMWorld
|
|||||||
|
|
||||||
virtual QVariant headerData ( int section, Qt::Orientation orientation, int role ) const;
|
virtual QVariant headerData ( int section, Qt::Orientation orientation, int role ) const;
|
||||||
|
|
||||||
|
virtual bool setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole );
|
||||||
|
|
||||||
|
virtual Qt::ItemFlags flags(const QModelIndex& index) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupHeaderVectors(ColumnBase::Display columnId);
|
void setupHeaderVectors(ColumnBase::Display columnId);
|
||||||
};
|
};
|
||||||
|
@ -3,13 +3,19 @@
|
|||||||
#include "../../model/world/universalid.hpp"
|
#include "../../model/world/universalid.hpp"
|
||||||
#include "util.hpp"
|
#include "util.hpp"
|
||||||
|
|
||||||
|
#include <QHeaderView>
|
||||||
|
|
||||||
CSVWorld::NestedTable::NestedTable(QUndoStack& undoStack,
|
CSVWorld::NestedTable::NestedTable(QUndoStack& undoStack,
|
||||||
CSMWorld::NestedTableModel* model,
|
CSMWorld::NestedTableModel* model,
|
||||||
QWidget* parent)
|
QWidget* parent)
|
||||||
: QTableView(parent)
|
: QTableView(parent)
|
||||||
{
|
{
|
||||||
setModel(model);
|
|
||||||
setAcceptDrops(true);
|
setSelectionBehavior (QAbstractItemView::SelectRows);
|
||||||
|
setSelectionMode (QAbstractItemView::ExtendedSelection);
|
||||||
|
|
||||||
|
horizontalHeader()->setResizeMode (QHeaderView::Interactive);
|
||||||
|
verticalHeader()->hide();
|
||||||
|
|
||||||
int columns = model->columnCount(QModelIndex());
|
int columns = model->columnCount(QModelIndex());
|
||||||
|
|
||||||
@ -24,6 +30,9 @@ CSVWorld::NestedTable::NestedTable(QUndoStack& undoStack,
|
|||||||
|
|
||||||
setItemDelegateForColumn(i, delegate);
|
setItemDelegateForColumn(i, delegate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setModel(model);
|
||||||
|
setAcceptDrops(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWorld::NestedTable::dragEnterEvent(QDragEnterEvent *event)
|
void CSVWorld::NestedTable::dragEnterEvent(QDragEnterEvent *event)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user