forked from teamnwah/openmw-tes3coop
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 (mCreate, SIGNAL (clicked (bool)), this, SLOT (create()));
|
||||||
|
|
||||||
connect (mId, SIGNAL (textChanged (const QString&)), this, SLOT (textChanged (const QString&)));
|
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()));
|
connect (&mData, SIGNAL (idListChanged()), this, SLOT (dataIdListChanged()));
|
||||||
}
|
}
|
||||||
|
@ -205,6 +206,14 @@ void CSVWorld::GenericCreator::textChanged (const QString& text)
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVWorld::GenericCreator::inputReturnPressed()
|
||||||
|
{
|
||||||
|
if (mCreate->isEnabled())
|
||||||
|
{
|
||||||
|
create();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CSVWorld::GenericCreator::create()
|
void CSVWorld::GenericCreator::create()
|
||||||
{
|
{
|
||||||
if (!mLocked)
|
if (!mLocked)
|
||||||
|
|
|
@ -112,6 +112,9 @@ namespace CSVWorld
|
||||||
|
|
||||||
void textChanged (const QString& text);
|
void textChanged (const QString& text);
|
||||||
|
|
||||||
|
/// \brief Create record if able to after Return key is pressed on input.
|
||||||
|
void inputReturnPressed();
|
||||||
|
|
||||||
void create();
|
void create();
|
||||||
|
|
||||||
void scopeChanged (int index);
|
void scopeChanged (int index);
|
||||||
|
|
|
@ -60,6 +60,7 @@ CSVWorld::InfoCreator::InfoCreator (CSMWorld::Data& data, QUndoStack& undoStack,
|
||||||
setManualEditing (false);
|
setManualEditing (false);
|
||||||
|
|
||||||
connect (mTopic, SIGNAL (textChanged (const QString&)), this, SLOT (topicChanged()));
|
connect (mTopic, SIGNAL (textChanged (const QString&)), this, SLOT (topicChanged()));
|
||||||
|
connect (mTopic, SIGNAL (returnPressed()), this, SLOT (inputReturnPressed()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWorld::InfoCreator::cloneMode (const std::string& originId,
|
void CSVWorld::InfoCreator::cloneMode (const std::string& originId,
|
||||||
|
|
|
@ -87,6 +87,7 @@ CSVWorld::ReferenceCreator::ReferenceCreator (CSMWorld::Data& data, QUndoStack&
|
||||||
setManualEditing (false);
|
setManualEditing (false);
|
||||||
|
|
||||||
connect (mCell, SIGNAL (textChanged (const QString&)), this, SLOT (cellChanged()));
|
connect (mCell, SIGNAL (textChanged (const QString&)), this, SLOT (cellChanged()));
|
||||||
|
connect (mCell, SIGNAL (returnPressed()), this, SLOT (inputReturnPressed()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWorld::ReferenceCreator::reset()
|
void CSVWorld::ReferenceCreator::reset()
|
||||||
|
|
|
@ -53,6 +53,7 @@ CSVWorld::StartScriptCreator::StartScriptCreator(
|
||||||
insertBeforeButtons(mScript, true);
|
insertBeforeButtons(mScript, true);
|
||||||
|
|
||||||
connect(mScript, SIGNAL (textChanged(const QString&)), this, SLOT (scriptChanged()));
|
connect(mScript, SIGNAL (textChanged(const QString&)), this, SLOT (scriptChanged()));
|
||||||
|
connect(mScript, SIGNAL (returnPressed()), this, SLOT (inputReturnPressed()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWorld::StartScriptCreator::cloneMode(
|
void CSVWorld::StartScriptCreator::cloneMode(
|
||||||
|
|
Loading…
Reference in a new issue