2012-12-03 21:03:02 +00:00
|
|
|
|
|
|
|
#include "tablesubview.hpp"
|
|
|
|
|
2013-07-23 19:59:02 +00:00
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
2012-12-11 12:22:43 +00:00
|
|
|
#include "../../model/doc/document.hpp"
|
|
|
|
|
2012-12-03 21:03:02 +00:00
|
|
|
#include "table.hpp"
|
2013-07-25 12:29:56 +00:00
|
|
|
#include "tablebottombox.hpp"
|
2013-07-26 10:34:30 +00:00
|
|
|
#include "creator.hpp"
|
2012-12-03 21:03:02 +00:00
|
|
|
|
2012-12-11 12:22:43 +00:00
|
|
|
CSVWorld::TableSubView::TableSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document,
|
2013-07-26 10:34:30 +00:00
|
|
|
Creator *creator)
|
2012-12-03 21:03:02 +00:00
|
|
|
: SubView (id)
|
|
|
|
{
|
2013-07-26 10:34:30 +00:00
|
|
|
bool createAndDelete = creator!=0;
|
|
|
|
delete creator;
|
|
|
|
|
2013-07-23 19:59:02 +00:00
|
|
|
QVBoxLayout *layout = new QVBoxLayout;
|
|
|
|
|
|
|
|
layout->setContentsMargins (QMargins (0, 0, 0, 0));
|
|
|
|
|
|
|
|
layout->addWidget (
|
|
|
|
mTable = new Table (id, document.getData(), document.getUndoStack(), createAndDelete), 2);
|
|
|
|
|
2013-07-25 12:29:56 +00:00
|
|
|
layout->addWidget (mBottom = new TableBottomBox (this), 0);
|
|
|
|
|
2013-07-23 19:59:02 +00:00
|
|
|
QWidget *widget = new QWidget;
|
|
|
|
|
|
|
|
widget->setLayout (layout);
|
|
|
|
|
|
|
|
setWidget (widget);
|
2012-12-13 12:35:08 +00:00
|
|
|
|
2013-07-21 15:53:39 +00:00
|
|
|
connect (mTable, SIGNAL (editRequest (int)), this, SLOT (editRequest (int)));
|
2013-07-25 12:29:56 +00:00
|
|
|
|
|
|
|
connect (mTable, SIGNAL (selectionSizeChanged (int)),
|
|
|
|
mBottom, SLOT (selectionSizeChanged (int)));
|
|
|
|
connect (mTable, SIGNAL (tableSizeChanged (int, int, int)),
|
|
|
|
mBottom, SLOT (tableSizeChanged (int, int, int)));
|
|
|
|
|
|
|
|
mTable->tableSizeUpdate();
|
|
|
|
mTable->selectionSizeUpdate();
|
2012-12-03 21:03:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CSVWorld::TableSubView::setEditLock (bool locked)
|
|
|
|
{
|
|
|
|
mTable->setEditLock (locked);
|
2012-12-13 12:35:08 +00:00
|
|
|
}
|
|
|
|
|
2013-07-21 15:53:39 +00:00
|
|
|
void CSVWorld::TableSubView::editRequest (int row)
|
2012-12-13 12:35:08 +00:00
|
|
|
{
|
2013-07-21 15:53:39 +00:00
|
|
|
focusId (mTable->getUniversalId (row));
|
2013-06-15 11:40:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CSVWorld::TableSubView::updateEditorSetting(const QString &settingName, const QString &settingValue)
|
|
|
|
{
|
2013-07-21 15:53:39 +00:00
|
|
|
mTable->updateEditorSetting(settingName, settingValue);
|
2013-06-15 11:40:18 +00:00
|
|
|
}
|
2013-07-25 12:29:56 +00:00
|
|
|
|
|
|
|
void CSVWorld::TableSubView::setStatusBar (bool show)
|
|
|
|
{
|
|
|
|
mBottom->setStatusBar (show);
|
|
|
|
}
|