mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Desktop: Dive site editing: give up focus on ESC
As long as a text field is active, CTRL-Z only affects this field. Thus it is suprisingly hard to undo edits. There seems to be a fundamental problem with CTRL-Z handling. To make it somewhat easier, catch any ESC-key event and move the focus to the MainWindow. This effectively removes the focus from any text field. This all appears very wrong, but so far I wasn't able to find the root cause of the problem. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
3a3089770a
commit
434990dcd4
2 changed files with 8 additions and 0 deletions
|
@ -41,6 +41,13 @@ LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBo
|
||||||
ui.diveSiteListView->installEventFilter(this);
|
ui.diveSiteListView->installEventFilter(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LocationInformationWidget::keyPressEvent(QKeyEvent *e)
|
||||||
|
{
|
||||||
|
if (e->key() == Qt::Key_Escape)
|
||||||
|
MainWindow::instance()->setFocus();
|
||||||
|
return QGroupBox::keyPressEvent(e);
|
||||||
|
}
|
||||||
|
|
||||||
bool LocationInformationWidget::eventFilter(QObject *object, QEvent *ev)
|
bool LocationInformationWidget::eventFilter(QObject *object, QEvent *ev)
|
||||||
{
|
{
|
||||||
if (ev->type() == QEvent::ContextMenu) {
|
if (ev->type() == QEvent::ContextMenu) {
|
||||||
|
|
|
@ -33,6 +33,7 @@ private slots:
|
||||||
void updateLabels();
|
void updateLabels();
|
||||||
void diveSiteChanged(struct dive_site *ds, int field);
|
void diveSiteChanged(struct dive_site *ds, int field);
|
||||||
private:
|
private:
|
||||||
|
void keyPressEvent(QKeyEvent *e) override;
|
||||||
void clearLabels();
|
void clearLabels();
|
||||||
Ui::LocationInformation ui;
|
Ui::LocationInformation ui;
|
||||||
GPSLocationInformationModel filter_model;
|
GPSLocationInformationModel filter_model;
|
||||||
|
|
Loading…
Add table
Reference in a new issue