mirror of
				https://github.com/TES3MP/openmw-tes3mp.git
				synced 2025-10-31 13:56:45 +00:00 
			
		
		
		
	Fixed undo / redo actions losing their shortcuts
This commit is contained in:
		
							parent
							
								
									aa5ddd6b28
								
							
						
					
					
						commit
						baf21362e1
					
				
					 2 changed files with 25 additions and 1 deletions
				
			
		|  | @ -4,6 +4,7 @@ | |||
| #include <stdexcept> | ||||
| 
 | ||||
| #include <QCloseEvent> | ||||
| #include <QDebug> | ||||
| #include <QMenuBar> | ||||
| #include <QMdiArea> | ||||
| #include <QDockWidget> | ||||
|  | @ -101,15 +102,34 @@ void CSVDoc::View::setupFileMenu() | |||
|     file->addAction(exit); | ||||
| } | ||||
| 
 | ||||
| static void updateUndoRedoAction(QAction *action, const std::string &settingsKey) | ||||
| { | ||||
|     QKeySequence seq; | ||||
|     CSMPrefs::State::get().getShortcutManager().getSequence(settingsKey, seq); | ||||
|     action->setShortcut(seq); | ||||
| } | ||||
| 
 | ||||
| void CSVDoc::View::undoActionChanged() | ||||
| { | ||||
|     updateUndoRedoAction(mUndo, "document-edit-undo"); | ||||
| } | ||||
| 
 | ||||
| void CSVDoc::View::redoActionChanged() | ||||
| { | ||||
|     updateUndoRedoAction(mRedo, "document-edit-redo"); | ||||
| } | ||||
| 
 | ||||
| void CSVDoc::View::setupEditMenu() | ||||
| { | ||||
|     QMenu *edit = menuBar()->addMenu (tr ("Edit")); | ||||
| 
 | ||||
|     mUndo = mDocument->getUndoStack().createUndoAction (this, tr("Undo")); | ||||
|     setupShortcut("document-edit-undo", mUndo); | ||||
|     connect(mUndo, SIGNAL (changed ()), this, SLOT (undoActionChanged ())); | ||||
|     edit->addAction (mUndo); | ||||
| 
 | ||||
|     mRedo= mDocument->getUndoStack().createRedoAction (this, tr("Redo")); | ||||
|     mRedo = mDocument->getUndoStack().createRedoAction (this, tr("Redo")); | ||||
|     connect(mRedo, SIGNAL (changed ()), this, SLOT (redoActionChanged ())); | ||||
|     setupShortcut("document-edit-redo", mRedo); | ||||
|     edit->addAction (mRedo); | ||||
| 
 | ||||
|  |  | |||
|  | @ -152,6 +152,10 @@ namespace CSVDoc | |||
| 
 | ||||
|             void settingChanged (const CSMPrefs::Setting *setting); | ||||
| 
 | ||||
|             void undoActionChanged(); | ||||
| 
 | ||||
|             void redoActionChanged(); | ||||
| 
 | ||||
|             void newView(); | ||||
| 
 | ||||
|             void save(); | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue