diff --git a/src/EditDialog.cpp b/src/EditDialog.cpp index 603b26a7..23c0b4fe 100644 --- a/src/EditDialog.cpp +++ b/src/EditDialog.cpp @@ -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; diff --git a/src/EditDialog.h b/src/EditDialog.h index 1928a862..f55ca316 100644 --- a/src/EditDialog.h +++ b/src/EditDialog.h @@ -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); diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 42ef4b57..557dcd8d 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -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())); }