1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-12 03:36:32 +00:00
OpenMW/apps/opencs/view/world/nestedtable.cpp

52 lines
1.6 KiB
C++
Raw Normal View History

2014-06-29 19:12:31 +00:00
#include "nestedtable.hpp"
#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
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
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> (
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,
undoStack,
2014-06-29 19:12:31 +00:00
this);
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
}
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();
}