mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-30 20:41:23 +00:00
use IdTypeDelegate in report table
This commit is contained in:
parent
1c4a4b4f26
commit
a6ea670255
3 changed files with 21 additions and 0 deletions
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
#include "../../model/tools/reportmodel.hpp"
|
#include "../../model/tools/reportmodel.hpp"
|
||||||
|
|
||||||
|
#include "../../view/world/idtypedelegate.hpp"
|
||||||
|
|
||||||
CSVTools::ReportSubView::ReportSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document)
|
CSVTools::ReportSubView::ReportSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document)
|
||||||
: CSVDoc::SubView (id), mModel (document.getReport (id))
|
: CSVDoc::SubView (id), mModel (document.getReport (id))
|
||||||
{
|
{
|
||||||
|
@ -18,6 +20,11 @@ CSVTools::ReportSubView::ReportSubView (const CSMWorld::UniversalId& id, CSMDoc:
|
||||||
mTable->setSelectionBehavior (QAbstractItemView::SelectRows);
|
mTable->setSelectionBehavior (QAbstractItemView::SelectRows);
|
||||||
mTable->setSelectionMode (QAbstractItemView::ExtendedSelection);
|
mTable->setSelectionMode (QAbstractItemView::ExtendedSelection);
|
||||||
|
|
||||||
|
mIdTypeDelegate = CSVWorld::IdTypeDelegateFactory().makeDelegate (
|
||||||
|
document.getUndoStack(), this);
|
||||||
|
|
||||||
|
mTable->setItemDelegateForColumn (0, mIdTypeDelegate);
|
||||||
|
|
||||||
connect (mTable, SIGNAL (doubleClicked (const QModelIndex&)), this, SLOT (show (const QModelIndex&)));
|
connect (mTable, SIGNAL (doubleClicked (const QModelIndex&)), this, SLOT (show (const QModelIndex&)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +33,11 @@ void CSVTools::ReportSubView::setEditLock (bool locked)
|
||||||
// ignored. We don't change document state anyway.
|
// ignored. We don't change document state anyway.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVTools::ReportSubView::updateEditorSetting (const QString& key, const QString& value)
|
||||||
|
{
|
||||||
|
mIdTypeDelegate->updateEditorSetting (key, value);
|
||||||
|
}
|
||||||
|
|
||||||
void CSVTools::ReportSubView::show (const QModelIndex& index)
|
void CSVTools::ReportSubView::show (const QModelIndex& index)
|
||||||
{
|
{
|
||||||
focusId (mModel->getUniversalId (index.row()));
|
focusId (mModel->getUniversalId (index.row()));
|
||||||
|
|
|
@ -16,6 +16,11 @@ namespace CSMTools
|
||||||
class ReportModel;
|
class ReportModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace CSVWorld
|
||||||
|
{
|
||||||
|
class CommandDelegate;
|
||||||
|
}
|
||||||
|
|
||||||
namespace CSVTools
|
namespace CSVTools
|
||||||
{
|
{
|
||||||
class Table;
|
class Table;
|
||||||
|
@ -26,6 +31,7 @@ namespace CSVTools
|
||||||
|
|
||||||
CSMTools::ReportModel *mModel;
|
CSMTools::ReportModel *mModel;
|
||||||
QTableView *mTable;
|
QTableView *mTable;
|
||||||
|
CSVWorld::CommandDelegate *mIdTypeDelegate;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -33,6 +39,8 @@ namespace CSVTools
|
||||||
|
|
||||||
virtual void setEditLock (bool locked);
|
virtual void setEditLock (bool locked);
|
||||||
|
|
||||||
|
virtual void updateEditorSetting (const QString&, const QString&);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void show (const QModelIndex& index);
|
void show (const QModelIndex& index);
|
||||||
|
|
|
@ -9,6 +9,7 @@ CSVWorld::IdTypeDelegate::IdTypeDelegate
|
||||||
|
|
||||||
bool CSVWorld::IdTypeDelegate::updateEditorSetting (const QString &settingName, const QString &settingValue)
|
bool CSVWorld::IdTypeDelegate::updateEditorSetting (const QString &settingName, const QString &settingValue)
|
||||||
{
|
{
|
||||||
|
/// \todo make the setting key a member variable, that is initialised from a constructor argument
|
||||||
if (settingName == "Referenceable ID Type Display")
|
if (settingName == "Referenceable ID Type Display")
|
||||||
{
|
{
|
||||||
if (settingValue == "Icon and Text")
|
if (settingValue == "Icon and Text")
|
||||||
|
|
Loading…
Reference in a new issue