mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 08:23:53 +00:00
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
|
||||
table tablesubview scriptsubview util regionmapsubview tablebottombox creator genericcreator
|
||||
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
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include <QScrollArea>
|
||||
#include <QPushButton>
|
||||
#include <QToolButton>
|
||||
#include <QTableView>
|
||||
#include <QDebug>
|
||||
|
||||
#include "../../model/world/nestedtablemodel.hpp"
|
||||
|
@ -34,6 +33,7 @@
|
|||
#include "recordstatusdelegate.hpp"
|
||||
#include "util.hpp"
|
||||
#include "tablebottombox.hpp"
|
||||
#include "nestedtable.hpp"
|
||||
/*
|
||||
==============================NotEditableSubDelegate==========================================
|
||||
*/
|
||||
|
@ -406,9 +406,7 @@ void CSVWorld::EditWidget::remake(int row)
|
|||
{
|
||||
mNestedModels.push_back(new CSMWorld::NestedTableModel (mTable->index(row, i), display, mTable));
|
||||
|
||||
QTableView* table = new QTableView();
|
||||
|
||||
table->setModel(*(mNestedModels.rbegin()));
|
||||
NestedTable* table = new NestedTable(mUndoStack, *(mNestedModels.rbegin()), this);
|
||||
|
||||
tablesLayout->addWidget(table);
|
||||
} else
|
||||
|
|
|
@ -1,20 +1,35 @@
|
|||
#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::setModel(model);
|
||||
setModel(model);
|
||||
setAcceptDrops(true);
|
||||
|
||||
int columns = mModel->columnCount();
|
||||
int columns = model->columnCount(QModelIndex());
|
||||
|
||||
for(int i = 0 ; i < columns; ++i)
|
||||
{
|
||||
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,
|
||||
document.getUndoStack(),
|
||||
undoStack,
|
||||
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
|
||||
#define CSV_WORLD_TABLE_H
|
||||
#define CSV_WORLD_NESTEDTABLE_H
|
||||
|
||||
#include <QTableView>
|
||||
#include <QtGui/qevent.h>
|
||||
|
@ -10,6 +10,12 @@ class QAction;
|
|||
namespace CSMWorld
|
||||
{
|
||||
class NestedTableModel;
|
||||
class UniversalId;
|
||||
}
|
||||
|
||||
namespace CSMDoc
|
||||
{
|
||||
class Document;
|
||||
}
|
||||
|
||||
namespace CSVWorld
|
||||
|
@ -18,13 +24,13 @@ namespace CSVWorld
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
std::vector<CommandDelegate*> mDelegates;
|
||||
QAction *mAddNewRowAction;
|
||||
QAction *mRemoveRowAction;
|
||||
CSMWorld::CommandDispatcher *mDispatcher;
|
||||
|
||||
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:
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
|
@ -32,3 +38,5 @@ namespace CSVWorld
|
|||
void dragMoveEvent(QDragMoveEvent *event);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue