forked from mirror/openmw-tes3mp
replaced settings change notifications for columns with a more robust implementation
This commit is contained in:
parent
0cb7d186e7
commit
2497c18702
7 changed files with 27 additions and 21 deletions
|
@ -16,7 +16,7 @@ CSVWorld::CommandDelegate *CSVWorld::RecordStatusDelegateFactory::makeDelegate (
|
||||||
return new RecordStatusDelegate (mValues, mIcons, undoStack, parent);
|
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")
|
if (settingName == "Record Status Display")
|
||||||
{
|
{
|
||||||
|
@ -28,7 +28,11 @@ void CSVWorld::RecordStatusDelegate::updateEditorSetting (const QString &setting
|
||||||
|
|
||||||
else if (settingValue == "Text Only")
|
else if (settingValue == "Text Only")
|
||||||
mDisplayMode = Mode_TextOnly;
|
mDisplayMode = Mode_TextOnly;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSVWorld::RecordStatusDelegateFactory::RecordStatusDelegateFactory()
|
CSVWorld::RecordStatusDelegateFactory::RecordStatusDelegateFactory()
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace CSVWorld
|
||||||
const IconList& icons,
|
const IconList& icons,
|
||||||
QUndoStack& undoStack, QObject *parent = 0);
|
QUndoStack& undoStack, QObject *parent = 0);
|
||||||
|
|
||||||
void updateEditorSetting (const QString &settingName, const QString &settingValue);
|
virtual bool updateEditorSetting (const QString &settingName, const QString &settingValue);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ CSVWorld::RefIdTypeDelegateFactory::UidTypeList CSVWorld::RefIdTypeDelegateFacto
|
||||||
return list;
|
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")
|
if (settingName == "Referenceable ID Type Display")
|
||||||
{
|
{
|
||||||
|
@ -63,5 +63,9 @@ void CSVWorld::RefIdTypeDelegate::updateEditorSetting (const QString &settingNam
|
||||||
|
|
||||||
else if (settingValue == "Text Only")
|
else if (settingValue == "Text Only")
|
||||||
mDisplayMode = Mode_TextOnly;
|
mDisplayMode = Mode_TextOnly;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace CSVWorld
|
||||||
public:
|
public:
|
||||||
RefIdTypeDelegate (const ValueList &mValues, const IconList &icons, QUndoStack& undoStack, QObject *parent);
|
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);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -207,22 +207,11 @@ void CSVWorld::Table::deleteRecord()
|
||||||
|
|
||||||
void CSVWorld::Table::updateEditorSetting (const QString &settingName, const QString &settingValue)
|
void CSVWorld::Table::updateEditorSetting (const QString &settingName, const QString &settingValue)
|
||||||
{
|
{
|
||||||
if (settingName == "Record Status Display")
|
int columns = mModel->columnCount();
|
||||||
{
|
|
||||||
RecordStatusDelegate &rsDelegate = dynamic_cast <CSVWorld::RecordStatusDelegate &> (*itemDelegateForColumn(1));
|
|
||||||
|
|
||||||
rsDelegate.updateEditorSetting (settingName, settingValue);
|
for (int i=0; i<columns; ++i)
|
||||||
emit dataChanged(mModel->index(0,1), mModel->index(mModel->rowCount()-1, 1));
|
if (QAbstractItemDelegate *delegate = itemDelegateForColumn (i))
|
||||||
}
|
if (dynamic_cast<CommandDelegate&> (*delegate).
|
||||||
|
updateEditorSetting (settingName, settingValue))
|
||||||
if (settingName == "Referenceable ID Type Display")
|
emit dataChanged (mModel->index (0, i), mModel->index (mModel->rowCount()-1, i));
|
||||||
{
|
|
||||||
RefIdTypeDelegate *refidDelegate = dynamic_cast <CSVWorld::RefIdTypeDelegate *> (itemDelegateForColumn(2));
|
|
||||||
|
|
||||||
if (refidDelegate)
|
|
||||||
{
|
|
||||||
refidDelegate->updateEditorSetting (settingName, settingValue);
|
|
||||||
emit dataChanged(mModel->index(0,1), mModel->index(mModel->rowCount()-1, 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,4 +134,10 @@ void CSVWorld::CommandDelegate::setEditLock (bool locked)
|
||||||
bool CSVWorld::CommandDelegate::isEditLocked() const
|
bool CSVWorld::CommandDelegate::isEditLocked() const
|
||||||
{
|
{
|
||||||
return mEditLock;
|
return mEditLock;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CSVWorld::CommandDelegate::updateEditorSetting (const QString &settingName,
|
||||||
|
const QString &settingValue)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
}
|
}
|
|
@ -108,6 +108,9 @@ namespace CSVWorld
|
||||||
|
|
||||||
bool isEditLocked() const;
|
bool isEditLocked() const;
|
||||||
|
|
||||||
|
virtual bool updateEditorSetting (const QString &settingName, const QString &settingValue);
|
||||||
|
///< \return Does column require update?
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
virtual void slotUpdateEditorSetting (const QString &settingName, const QString &settingValue) {}
|
virtual void slotUpdateEditorSetting (const QString &settingName, const QString &settingValue) {}
|
||||||
|
|
Loading…
Reference in a new issue