EditDialog: Better behaviour when pressing escape key in dock mode

See issue #441.
This commit is contained in:
Martin Kleusberg
2015-12-20 12:15:13 +01:00
parent 9582786237
commit 0e17990583
3 changed files with 14 additions and 0 deletions

View File

@@ -63,6 +63,18 @@ void EditDialog::showEvent(QShowEvent*)
}
}
void EditDialog::reject()
{
// This is called when pressing the cancel button or hitting the escape key
// If we're in dock mode, move the cursor back to the table view.
// If we're in window mode, call the default implementation to just close the window normally.
if(useInDock)
emit goingAway();
else
QDialog::reject();
}
void EditDialog::loadText(const QByteArray& data, int row, int col)
{
curRow = row;

View File

@@ -24,6 +24,7 @@ public slots:
virtual void reset();
virtual void loadText(const QByteArray& data, int row, int col);
virtual void setFocus();
virtual void reject();
protected:
virtual void closeEvent(QCloseEvent* ev);

View File

@@ -751,6 +751,7 @@ void MainWindow::editWinAway()
// Update main window
activateWindow();
ui->dataTable->setFocus();
ui->dataTable->setCurrentIndex(ui->dataTable->currentIndex().sibling(sendingEditDialog->getCurrentRow(), sendingEditDialog->getCurrentCol()));
}