Allow Enter in Save File Field to Save (#687)
* Allow enter key in save field to trigger save procedure
This commit is contained in:
parent
4134b2d0d8
commit
f3ea7c244f
3 changed files with 9 additions and 1 deletions
|
@ -49,6 +49,7 @@ protected:
|
|||
|
||||
signals:
|
||||
void focusIn();
|
||||
void returnPressedNow();
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -407,7 +407,9 @@ TFilePath GenericLoadFilePopup::getPath() {
|
|||
//***********************************************************************************
|
||||
|
||||
GenericSaveFilePopup::GenericSaveFilePopup(const QString &title)
|
||||
: FileBrowserPopup(title) {}
|
||||
: FileBrowserPopup(title) {
|
||||
connect(m_nameField, SIGNAL(returnPressedNow()), m_okButton, SLOT(animateClick()));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
@ -546,6 +548,7 @@ void LoadSubScenePopup::showEvent(QShowEvent *e) {
|
|||
SaveSceneAsPopup::SaveSceneAsPopup() : FileBrowserPopup(tr("Save Scene")) {
|
||||
setOkText(tr("Save"));
|
||||
addFilterType("tnz");
|
||||
connect(m_nameField, SIGNAL(returnPressedNow()), m_okButton, SLOT(animateClick()));
|
||||
}
|
||||
|
||||
bool SaveSceneAsPopup::execute() {
|
||||
|
@ -575,6 +578,7 @@ void SaveSceneAsPopup::initFolder() {
|
|||
SaveSubSceneAsPopup::SaveSubSceneAsPopup()
|
||||
: FileBrowserPopup(tr("Sub-xsheet")) {
|
||||
setOkText(tr("Save"));
|
||||
connect(m_nameField, SIGNAL(returnPressedNow()), m_okButton, SLOT(animateClick()));
|
||||
}
|
||||
|
||||
bool SaveSubSceneAsPopup::execute() {
|
||||
|
@ -1323,6 +1327,7 @@ void LoadLevelPopup::onSelectionChanged(TSelection *selection) {
|
|||
|
||||
SaveLevelAsPopup::SaveLevelAsPopup() : FileBrowserPopup(tr("Save Level")) {
|
||||
setOkText(tr("Save"));
|
||||
connect(m_nameField, SIGNAL(returnPressedNow()), m_okButton, SLOT(animateClick()));
|
||||
}
|
||||
|
||||
bool SaveLevelAsPopup::execute() {
|
||||
|
@ -1603,6 +1608,7 @@ SavePaletteAsPopup::SavePaletteAsPopup()
|
|||
: FileBrowserPopup(tr("Save Palette")) {
|
||||
setOkText(tr("Save"));
|
||||
addFilterType("tpl");
|
||||
connect(m_nameField, SIGNAL(returnPressedNow()), m_okButton, SLOT(animateClick()));
|
||||
}
|
||||
|
||||
bool SavePaletteAsPopup::execute() {
|
||||
|
|
|
@ -34,6 +34,7 @@ void LineEdit::focusInEvent(QFocusEvent *event) {
|
|||
void LineEdit::keyPressEvent(QKeyEvent *event) {
|
||||
if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) {
|
||||
m_isReturnPressed = true;
|
||||
emit returnPressedNow();
|
||||
clearFocus();
|
||||
return;
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue