forked from teamnwah/openmw-tes3coop
added nestedtable for displaying nested content.
This commit is contained in:
parent
8c6a0d9a4f
commit
5eac32e3d3
4 changed files with 35 additions and 14 deletions
|
@ -61,7 +61,7 @@ opencs_hdrs_noqt (view/doc
|
||||||
opencs_units (view/world
|
opencs_units (view/world
|
||||||
table tablesubview scriptsubview util regionmapsubview tablebottombox creator genericcreator
|
table tablesubview scriptsubview util regionmapsubview tablebottombox creator genericcreator
|
||||||
cellcreator referenceablecreator referencecreator scenesubview scenetoolbar scenetool
|
cellcreator referenceablecreator referencecreator scenesubview scenetoolbar scenetool
|
||||||
scenetoolmode infocreator scriptedit dialoguesubview previewsubview regionmap dragrecordtable
|
scenetoolmode infocreator scriptedit dialoguesubview previewsubview regionmap dragrecordtable nestedtable
|
||||||
)
|
)
|
||||||
|
|
||||||
opencs_units (view/render
|
opencs_units (view/render
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
#include <QTableView>
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#include "../../model/world/nestedtablemodel.hpp"
|
#include "../../model/world/nestedtablemodel.hpp"
|
||||||
|
@ -34,6 +33,7 @@
|
||||||
#include "recordstatusdelegate.hpp"
|
#include "recordstatusdelegate.hpp"
|
||||||
#include "util.hpp"
|
#include "util.hpp"
|
||||||
#include "tablebottombox.hpp"
|
#include "tablebottombox.hpp"
|
||||||
|
#include "nestedtable.hpp"
|
||||||
/*
|
/*
|
||||||
==============================NotEditableSubDelegate==========================================
|
==============================NotEditableSubDelegate==========================================
|
||||||
*/
|
*/
|
||||||
|
@ -406,9 +406,7 @@ void CSVWorld::EditWidget::remake(int row)
|
||||||
{
|
{
|
||||||
mNestedModels.push_back(new CSMWorld::NestedTableModel (mTable->index(row, i), display, mTable));
|
mNestedModels.push_back(new CSMWorld::NestedTableModel (mTable->index(row, i), display, mTable));
|
||||||
|
|
||||||
QTableView* table = new QTableView();
|
NestedTable* table = new NestedTable(mUndoStack, *(mNestedModels.rbegin()), this);
|
||||||
|
|
||||||
table->setModel(*(mNestedModels.rbegin()));
|
|
||||||
|
|
||||||
tablesLayout->addWidget(table);
|
tablesLayout->addWidget(table);
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -1,20 +1,35 @@
|
||||||
#include "nestedtable.hpp"
|
#include "nestedtable.hpp"
|
||||||
|
#include "../../model/world/nestedtablemodel.hpp"
|
||||||
|
#include "../../model/world/universalid.hpp"
|
||||||
|
#include "util.hpp"
|
||||||
|
|
||||||
NestedTable::NestedTable(CSMDoc::Document& document, CSMWorld::NestedTableModel* model, const CSMWorld::UniversalId& id, QWidget* parent)
|
CSVWorld::NestedTable::NestedTable(QUndoStack& undoStack,
|
||||||
|
CSMWorld::NestedTableModel* model,
|
||||||
|
QWidget* parent)
|
||||||
: QTableView(parent)
|
: QTableView(parent)
|
||||||
{
|
{
|
||||||
QTableView::setModel(model);
|
setModel(model);
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
|
|
||||||
int columns = mModel->columnCount();
|
int columns = model->columnCount(QModelIndex());
|
||||||
|
|
||||||
for(int i = 0 ; i < columns; ++i)
|
for(int i = 0 ; i < columns; ++i)
|
||||||
{
|
{
|
||||||
CSMWorld::ColumnBase::Display display = static_cast<CSMWorld::ColumnBase::Display> (
|
CSMWorld::ColumnBase::Display display = static_cast<CSMWorld::ColumnBase::Display> (
|
||||||
mModel->headerData (i, Qt::Horizontal, CSMWorld::ColumnBase::Role_Display).toInt());
|
model->headerData (i, Qt::Horizontal, CSMWorld::ColumnBase::Role_Display).toInt());
|
||||||
|
|
||||||
CommandDelegate *delegate = CommandDelegateFactoryCollection::get().makeDelegate(display,
|
CommandDelegate *delegate = CommandDelegateFactoryCollection::get().makeDelegate(display,
|
||||||
document.getUndoStack(),
|
undoStack,
|
||||||
this);
|
this);
|
||||||
|
|
||||||
|
setItemDelegateForColumn(i, delegate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVWorld::NestedTable::dragEnterEvent(QDragEnterEvent *event)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSVWorld::NestedTable::dragMoveEvent(QDragMoveEvent *event)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef CSV_WORLD_NESTEDTABLE_H
|
#ifndef CSV_WORLD_NESTEDTABLE_H
|
||||||
#define CSV_WORLD_TABLE_H
|
#define CSV_WORLD_NESTEDTABLE_H
|
||||||
|
|
||||||
#include <QTableView>
|
#include <QTableView>
|
||||||
#include <QtGui/qevent.h>
|
#include <QtGui/qevent.h>
|
||||||
|
@ -10,6 +10,12 @@ class QAction;
|
||||||
namespace CSMWorld
|
namespace CSMWorld
|
||||||
{
|
{
|
||||||
class NestedTableModel;
|
class NestedTableModel;
|
||||||
|
class UniversalId;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace CSMDoc
|
||||||
|
{
|
||||||
|
class Document;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace CSVWorld
|
namespace CSVWorld
|
||||||
|
@ -18,13 +24,13 @@ namespace CSVWorld
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
std::vector<CommandDelegate*> mDelegates;
|
|
||||||
QAction *mAddNewRowAction;
|
QAction *mAddNewRowAction;
|
||||||
QAction *mRemoveRowAction;
|
QAction *mRemoveRowAction;
|
||||||
CSMWorld::CommandDispatcher *mDispatcher;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NestedTable(CSMDoc::Document& document, CSMWorld::NestedTableModel* model, const CSMWorld::UniversalId& id, QWidget* parent = NULL);
|
NestedTable(QUndoStack& undoStack,
|
||||||
|
CSMWorld::NestedTableModel* model,
|
||||||
|
QWidget* parent = NULL);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void dragEnterEvent(QDragEnterEvent *event);
|
void dragEnterEvent(QDragEnterEvent *event);
|
||||||
|
@ -32,3 +38,5 @@ namespace CSVWorld
|
||||||
void dragMoveEvent(QDragMoveEvent *event);
|
void dragMoveEvent(QDragMoveEvent *event);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue