diff --git a/apps/opencs/view/world/recordstatusdelegate.cpp b/apps/opencs/view/world/recordstatusdelegate.cpp index 4e137e635..a0ffd3063 100644 --- a/apps/opencs/view/world/recordstatusdelegate.cpp +++ b/apps/opencs/view/world/recordstatusdelegate.cpp @@ -16,7 +16,7 @@ CSVWorld::CommandDelegate *CSVWorld::RecordStatusDelegateFactory::makeDelegate ( return new RecordStatusDelegate (mValues, mIcons, undoStack, parent); } -void CSVWorld::RecordStatusDelegate::updateEditorSetting (const QString &settingName, const QString &settingValue) +bool CSVWorld::RecordStatusDelegate::updateEditorSetting (const QString &settingName, const QString &settingValue) { if (settingName == "Record Status Display") { @@ -28,7 +28,11 @@ void CSVWorld::RecordStatusDelegate::updateEditorSetting (const QString &setting else if (settingValue == "Text Only") mDisplayMode = Mode_TextOnly; + + return true; } + + return false; } CSVWorld::RecordStatusDelegateFactory::RecordStatusDelegateFactory() diff --git a/apps/opencs/view/world/recordstatusdelegate.hpp b/apps/opencs/view/world/recordstatusdelegate.hpp index a0b279bbc..d9126fee0 100644 --- a/apps/opencs/view/world/recordstatusdelegate.hpp +++ b/apps/opencs/view/world/recordstatusdelegate.hpp @@ -21,7 +21,7 @@ namespace CSVWorld const IconList& icons, QUndoStack& undoStack, QObject *parent = 0); - void updateEditorSetting (const QString &settingName, const QString &settingValue); + virtual bool updateEditorSetting (const QString &settingName, const QString &settingValue); }; diff --git a/apps/opencs/view/world/refidtypedelegate.cpp b/apps/opencs/view/world/refidtypedelegate.cpp index d89d2cd31..40bf88584 100755 --- a/apps/opencs/view/world/refidtypedelegate.cpp +++ b/apps/opencs/view/world/refidtypedelegate.cpp @@ -51,7 +51,7 @@ CSVWorld::RefIdTypeDelegateFactory::UidTypeList CSVWorld::RefIdTypeDelegateFacto return list; } -void CSVWorld::RefIdTypeDelegate::updateEditorSetting (const QString &settingName, const QString &settingValue) +bool CSVWorld::RefIdTypeDelegate::updateEditorSetting (const QString &settingName, const QString &settingValue) { if (settingName == "Referenceable ID Type Display") { @@ -63,5 +63,9 @@ void CSVWorld::RefIdTypeDelegate::updateEditorSetting (const QString &settingNam else if (settingValue == "Text Only") mDisplayMode = Mode_TextOnly; + + return true; } + + return false; } diff --git a/apps/opencs/view/world/refidtypedelegate.hpp b/apps/opencs/view/world/refidtypedelegate.hpp index 0b6b8e079..384aebb98 100755 --- a/apps/opencs/view/world/refidtypedelegate.hpp +++ b/apps/opencs/view/world/refidtypedelegate.hpp @@ -13,7 +13,7 @@ namespace CSVWorld public: RefIdTypeDelegate (const ValueList &mValues, const IconList &icons, QUndoStack& undoStack, QObject *parent); - void updateEditorSetting (const QString &settingName, const QString &settingValue); + virtual bool updateEditorSetting (const QString &settingName, const QString &settingValue); }; diff --git a/apps/opencs/view/world/table.cpp b/apps/opencs/view/world/table.cpp index 315f4c742..d7d4dd5ca 100644 --- a/apps/opencs/view/world/table.cpp +++ b/apps/opencs/view/world/table.cpp @@ -207,22 +207,11 @@ void CSVWorld::Table::deleteRecord() void CSVWorld::Table::updateEditorSetting (const QString &settingName, const QString &settingValue) { - if (settingName == "Record Status Display") - { - RecordStatusDelegate &rsDelegate = dynamic_cast (*itemDelegateForColumn(1)); + int columns = mModel->columnCount(); - rsDelegate.updateEditorSetting (settingName, settingValue); - emit dataChanged(mModel->index(0,1), mModel->index(mModel->rowCount()-1, 1)); - } - - if (settingName == "Referenceable ID Type Display") - { - RefIdTypeDelegate *refidDelegate = dynamic_cast (itemDelegateForColumn(2)); - - if (refidDelegate) - { - refidDelegate->updateEditorSetting (settingName, settingValue); - emit dataChanged(mModel->index(0,1), mModel->index(mModel->rowCount()-1, 1)); - } - } + for (int i=0; i (*delegate). + updateEditorSetting (settingName, settingValue)) + emit dataChanged (mModel->index (0, i), mModel->index (mModel->rowCount()-1, i)); } diff --git a/apps/opencs/view/world/util.cpp b/apps/opencs/view/world/util.cpp index 5bbedbf3d..97af3b99c 100644 --- a/apps/opencs/view/world/util.cpp +++ b/apps/opencs/view/world/util.cpp @@ -134,4 +134,10 @@ void CSVWorld::CommandDelegate::setEditLock (bool locked) bool CSVWorld::CommandDelegate::isEditLocked() const { return mEditLock; +} + +bool CSVWorld::CommandDelegate::updateEditorSetting (const QString &settingName, + const QString &settingValue) +{ + return false; } \ No newline at end of file diff --git a/apps/opencs/view/world/util.hpp b/apps/opencs/view/world/util.hpp index 251564e96..87f118cd7 100644 --- a/apps/opencs/view/world/util.hpp +++ b/apps/opencs/view/world/util.hpp @@ -108,6 +108,9 @@ namespace CSVWorld bool isEditLocked() const; + virtual bool updateEditorSetting (const QString &settingName, const QString &settingValue); + ///< \return Does column require update? + private slots: virtual void slotUpdateEditorSetting (const QString &settingName, const QString &settingValue) {}