mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-31 17:26:38 +00:00 
			
		
		
		
	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); | ||||
| } | ||||
| 
 | ||||
| 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() | ||||
|  |  | |||
|  | @ -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); | ||||
| 
 | ||||
|     }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -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; | ||||
| } | ||||
|  |  | |||
|  | @ -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); | ||||
| 
 | ||||
|     }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -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 <CSVWorld::RecordStatusDelegate &> (*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 <CSVWorld::RefIdTypeDelegate *> (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<columns; ++i) | ||||
|         if (QAbstractItemDelegate *delegate = itemDelegateForColumn (i)) | ||||
|             if (dynamic_cast<CommandDelegate&> (*delegate). | ||||
|                 updateEditorSetting (settingName, settingValue)) | ||||
|                 emit dataChanged (mModel->index (0, i), mModel->index (mModel->rowCount()-1, i)); | ||||
| } | ||||
|  |  | |||
|  | @ -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; | ||||
| } | ||||
|  | @ -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) {} | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue