mirror of
				https://github.com/TES3MP/openmw-tes3mp.git
				synced 2025-10-31 16:26:42 +00:00 
			
		
		
		
	Create record on Return key press (Feature #3250)
Updated to create record when Return key is pressed while input has focus. Record is only created if input has been validated (i.e. Create button is enabled).
This commit is contained in:
		
							parent
							
								
									5bd8ef247d
								
							
						
					
					
						commit
						1b4c124fe8
					
				
					 5 changed files with 16 additions and 1 deletions
				
			
		|  | @ -170,6 +170,7 @@ CSVWorld::GenericCreator::GenericCreator (CSMWorld::Data& data, QUndoStack& undo | |||
|     connect (mCreate, SIGNAL (clicked (bool)), this, SLOT (create())); | ||||
| 
 | ||||
|     connect (mId, SIGNAL (textChanged (const QString&)), this, SLOT (textChanged (const QString&))); | ||||
|     connect (mId, SIGNAL (returnPressed()), this, SLOT (inputReturnPressed())); | ||||
| 
 | ||||
|     connect (&mData, SIGNAL (idListChanged()), this, SLOT (dataIdListChanged())); | ||||
| } | ||||
|  | @ -205,6 +206,14 @@ void CSVWorld::GenericCreator::textChanged (const QString& text) | |||
|     update(); | ||||
| } | ||||
| 
 | ||||
| void CSVWorld::GenericCreator::inputReturnPressed() | ||||
| { | ||||
|     if (mCreate->isEnabled()) | ||||
|     { | ||||
|         create(); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void CSVWorld::GenericCreator::create() | ||||
| { | ||||
|     if (!mLocked) | ||||
|  |  | |||
|  | @ -112,6 +112,9 @@ namespace CSVWorld | |||
| 
 | ||||
|             void textChanged (const QString& text); | ||||
| 
 | ||||
|             /// \brief Create record if able to after Return key is pressed on input.
 | ||||
|             void inputReturnPressed(); | ||||
| 
 | ||||
|             void create(); | ||||
| 
 | ||||
|             void scopeChanged (int index); | ||||
|  |  | |||
|  | @ -60,6 +60,7 @@ CSVWorld::InfoCreator::InfoCreator (CSMWorld::Data& data, QUndoStack& undoStack, | |||
|     setManualEditing (false); | ||||
| 
 | ||||
|     connect (mTopic, SIGNAL (textChanged (const QString&)), this, SLOT (topicChanged())); | ||||
|     connect (mTopic, SIGNAL (returnPressed()), this, SLOT (inputReturnPressed())); | ||||
| } | ||||
| 
 | ||||
| void CSVWorld::InfoCreator::cloneMode (const std::string& originId, | ||||
|  | @ -110,7 +111,7 @@ void CSVWorld::InfoCreator::topicChanged() | |||
|     update(); | ||||
| } | ||||
| 
 | ||||
| CSVWorld::Creator *CSVWorld::InfoCreatorFactory::makeCreator(CSMDoc::Document& document,  | ||||
| CSVWorld::Creator *CSVWorld::InfoCreatorFactory::makeCreator(CSMDoc::Document& document, | ||||
|                                                              const CSMWorld::UniversalId& id) const | ||||
| { | ||||
|     return new InfoCreator(document.getData(), | ||||
|  |  | |||
|  | @ -87,6 +87,7 @@ CSVWorld::ReferenceCreator::ReferenceCreator (CSMWorld::Data& data, QUndoStack& | |||
|     setManualEditing (false); | ||||
| 
 | ||||
|     connect (mCell, SIGNAL (textChanged (const QString&)), this, SLOT (cellChanged())); | ||||
|     connect (mCell, SIGNAL (returnPressed()), this, SLOT (inputReturnPressed())); | ||||
| } | ||||
| 
 | ||||
| void CSVWorld::ReferenceCreator::reset() | ||||
|  |  | |||
|  | @ -53,6 +53,7 @@ CSVWorld::StartScriptCreator::StartScriptCreator( | |||
|     insertBeforeButtons(mScript, true); | ||||
| 
 | ||||
|     connect(mScript, SIGNAL (textChanged(const QString&)), this, SLOT (scriptChanged())); | ||||
|     connect(mScript, SIGNAL (returnPressed()), this, SLOT (inputReturnPressed())); | ||||
| } | ||||
| 
 | ||||
| void CSVWorld::StartScriptCreator::cloneMode( | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue