mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-31 13:56:38 +00:00 
			
		
		
		
	replaced double click in table with a context menu item (edit) because double click was interfering with basic table functionality
This commit is contained in:
		
							parent
							
								
									5dc1aceae1
								
							
						
					
					
						commit
						66534a45da
					
				
					 4 changed files with 29 additions and 8 deletions
				
			
		|  | @ -26,6 +26,9 @@ void CSVWorld::Table::contextMenuEvent (QContextMenuEvent *event) | |||
| 
 | ||||
|     if (!mEditLock) | ||||
|     { | ||||
|         if (selectedRows.size()==1) | ||||
|             menu.addAction (mEditAction); | ||||
| 
 | ||||
|         if (mCreateAction) | ||||
|             menu.addAction (mCreateAction); | ||||
| 
 | ||||
|  | @ -116,7 +119,9 @@ CSVWorld::Table::Table (const CSMWorld::UniversalId& id, CSMWorld::Data& data, Q | |||
|             hideColumn (i); | ||||
|     } | ||||
| 
 | ||||
|     /// \todo make initial layout fill the whole width of the table
 | ||||
|     mEditAction = new QAction (tr ("Edit Record"), this); | ||||
|     connect (mEditAction, SIGNAL (triggered()), this, SLOT (editRecord())); | ||||
|     addAction (mEditAction); | ||||
| 
 | ||||
|     if (createAndDelete) | ||||
|     { | ||||
|  | @ -205,6 +210,17 @@ void CSVWorld::Table::deleteRecord() | |||
|     } | ||||
| } | ||||
| 
 | ||||
| void CSVWorld::Table::editRecord() | ||||
| { | ||||
|     if (!mEditLock) | ||||
|     { | ||||
|         QModelIndexList selectedRows = selectionModel()->selectedRows(); | ||||
| 
 | ||||
|         if (selectedRows.size()==1) | ||||
|             emit editRequest (selectedRows.begin()->row()); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void CSVWorld::Table::updateEditorSetting (const QString &settingName, const QString &settingValue) | ||||
| { | ||||
|     int columns = mModel->columnCount(); | ||||
|  |  | |||
|  | @ -28,6 +28,7 @@ namespace CSVWorld | |||
| 
 | ||||
|             std::vector<CommandDelegate *> mDelegates; | ||||
|             QUndoStack& mUndoStack; | ||||
|             QAction *mEditAction; | ||||
|             QAction *mCreateAction; | ||||
|             QAction *mRevertAction; | ||||
|             QAction *mDeleteAction; | ||||
|  | @ -55,6 +56,10 @@ namespace CSVWorld | |||
| 
 | ||||
|             void updateEditorSetting (const QString &settingName, const QString &settingValue); | ||||
| 
 | ||||
|         signals: | ||||
| 
 | ||||
|             void editRequest (int row); | ||||
| 
 | ||||
|         private slots: | ||||
| 
 | ||||
|             void createRecord(); | ||||
|  | @ -62,6 +67,8 @@ namespace CSVWorld | |||
|             void revertRecord(); | ||||
| 
 | ||||
|             void deleteRecord(); | ||||
| 
 | ||||
|             void editRecord(); | ||||
|     }; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -11,7 +11,7 @@ CSVWorld::TableSubView::TableSubView (const CSMWorld::UniversalId& id, CSMDoc::D | |||
| { | ||||
|     setWidget (mTable = new Table (id, document.getData(), document.getUndoStack(), createAndDelete)); | ||||
| 
 | ||||
|     connect (mTable, SIGNAL (doubleClicked (const QModelIndex&)), this, SLOT (rowActivated (const QModelIndex&))); | ||||
|     connect (mTable, SIGNAL (editRequest (int)), this, SLOT (editRequest (int))); | ||||
| } | ||||
| 
 | ||||
| void CSVWorld::TableSubView::setEditLock (bool locked) | ||||
|  | @ -19,14 +19,12 @@ void CSVWorld::TableSubView::setEditLock (bool locked) | |||
|     mTable->setEditLock (locked); | ||||
| } | ||||
| 
 | ||||
| void CSVWorld::TableSubView::rowActivated (const QModelIndex& index) | ||||
| void CSVWorld::TableSubView::editRequest (int row) | ||||
| { | ||||
|     focusId (mTable->getUniversalId (index.row())); | ||||
|     focusId (mTable->getUniversalId (row)); | ||||
| } | ||||
| 
 | ||||
| void CSVWorld::TableSubView::updateEditorSetting(const QString &settingName, const QString &settingValue) | ||||
| { | ||||
| 
 | ||||
|     if ( (settingName == "Record Status Display") || settingName == "Referenceable ID Type Display" ) | ||||
|         mTable->updateEditorSetting(settingName, settingValue); | ||||
|     mTable->updateEditorSetting(settingName, settingValue); | ||||
| } | ||||
|  |  | |||
|  | @ -28,7 +28,7 @@ namespace CSVWorld | |||
| 
 | ||||
|         private slots: | ||||
| 
 | ||||
|             void rowActivated (const QModelIndex& index); | ||||
|             void editRequest (int row); | ||||
|     }; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue