summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/maintab.cpp29
-rw-r--r--qt-ui/maintab.h1
2 files changed, 20 insertions, 10 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index f9d36342f..4057db1cf 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -52,7 +52,7 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
ui->divemaster->installEventFilter(this);
ui->buddy->installEventFilter(this);
ui->suit->installEventFilter(this);
- ui->notes->installEventFilter(this);
+ ui->notes->viewport()->installEventFilter(this);
ui->rating->installEventFilter(this);
ui->visibility->installEventFilter(this);
@@ -126,18 +126,27 @@ void MainTab::equipmentPlusUpdate()
addWeight->setGeometry(ui->weightGroup->contentsRect().width() - 30, 2, 24,24);
}
+void MainTab::enableEdition()
+{
+ if (ui->editAccept->isVisible() || !currentDive)
+ return;
+
+ ui->editAccept->setChecked(true);
+ ui->editAccept->show();
+ ui->editReset->show();
+ on_editAccept_clicked(true);
+}
+
bool MainTab::eventFilter(QObject* object, QEvent* event)
{
- if (event->type() == QEvent::FocusIn || event->type() == QEvent::MouseButtonPress) {
- if (ui->editAccept->isVisible() || !currentDive)
- return false;
-
- ui->editAccept->setChecked(true);
- ui->editAccept->show();
- ui->editReset->show();
- on_editAccept_clicked(true);
+ if (event->type() == QEvent::FocusIn && (object == ui->rating || object == ui->visibility)){
+ enableEdition();
+ }
+
+ if (event->type() == QEvent::MouseButtonPress) {
+ enableEdition();
}
- return false;
+ return false; // don't "eat" the event.
}
void MainTab::clearEquipment()
diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h
index af76fbb67..745f401a4 100644
--- a/qt-ui/maintab.h
+++ b/qt-ui/maintab.h
@@ -72,6 +72,7 @@ private:
QPushButton *addCylinder;
QPushButton *addWeight;
enum { NONE, DIVE, TRIP } editMode;
+ void enableEdition();
};
#endif