2014-06-29 19:12:31 +00:00
|
|
|
#include "nestedtable.hpp"
|
2014-06-30 11:09:10 +00:00
|
|
|
#include "../../model/world/nestedtablemodel.hpp"
|
|
|
|
#include "../../model/world/universalid.hpp"
|
|
|
|
#include "util.hpp"
|
2014-06-29 19:12:31 +00:00
|
|
|
|
2014-06-30 12:12:57 +00:00
|
|
|
#include <QHeaderView>
|
2014-06-30 18:06:18 +00:00
|
|
|
#include <QContextMenuEvent>
|
2014-06-30 12:12:57 +00:00
|
|
|
|
2014-06-30 11:09:10 +00:00
|
|
|
CSVWorld::NestedTable::NestedTable(QUndoStack& undoStack,
|
|
|
|
CSMWorld::NestedTableModel* model,
|
|
|
|
QWidget* parent)
|
2014-06-30 14:03:38 +00:00
|
|
|
: QTableView(parent),
|
|
|
|
mUndoStack(undoStack)
|
2014-06-29 19:12:31 +00:00
|
|
|
{
|
2014-06-30 12:12:57 +00:00
|
|
|
|
|
|
|
setSelectionBehavior (QAbstractItemView::SelectRows);
|
|
|
|
setSelectionMode (QAbstractItemView::ExtendedSelection);
|
|
|
|
|
|
|
|
horizontalHeader()->setResizeMode (QHeaderView::Interactive);
|
|
|
|
verticalHeader()->hide();
|
2014-06-29 19:12:31 +00:00
|
|
|
|
2014-06-30 11:09:10 +00:00
|
|
|
int columns = model->columnCount(QModelIndex());
|
2014-06-29 19:12:31 +00:00
|
|
|
|
|
|
|
for(int i = 0 ; i < columns; ++i)
|
|
|
|
{
|
|
|
|
CSMWorld::ColumnBase::Display display = static_cast<CSMWorld::ColumnBase::Display> (
|
2014-06-30 11:09:10 +00:00
|
|
|
model->headerData (i, Qt::Horizontal, CSMWorld::ColumnBase::Role_Display).toInt());
|
2014-06-30 12:12:57 +00:00
|
|
|
|
2014-06-29 19:12:31 +00:00
|
|
|
CommandDelegate *delegate = CommandDelegateFactoryCollection::get().makeDelegate(display,
|
2014-06-30 11:09:10 +00:00
|
|
|
undoStack,
|
2014-06-29 19:12:31 +00:00
|
|
|
this);
|
2014-06-30 11:09:10 +00:00
|
|
|
|
|
|
|
setItemDelegateForColumn(i, delegate);
|
2014-06-29 19:12:31 +00:00
|
|
|
}
|
2014-06-30 12:12:57 +00:00
|
|
|
|
|
|
|
setModel(model);
|
|
|
|
setAcceptDrops(true);
|
2014-06-29 19:12:31 +00:00
|
|
|
}
|
2014-06-30 11:09:10 +00:00
|
|
|
|
|
|
|
void CSVWorld::NestedTable::dragEnterEvent(QDragEnterEvent *event)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSVWorld::NestedTable::dragMoveEvent(QDragMoveEvent *event)
|
|
|
|
{
|
|
|
|
}
|
2014-06-30 18:06:18 +00:00
|
|
|
|
|
|
|
void CSVWorld::NestedTable::contextMenuEvent (QContextMenuEvent *event)
|
|
|
|
{
|
|
|
|
QModelIndexList selectedRows = selectionModel()->selectedRows();
|
|
|
|
}
|