1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 00:35:23 +00:00
OpenMW/apps/opencs/view/world/nestedtable.cpp

46 lines
1.4 KiB
C++
Raw Normal View History

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