summaryrefslogtreecommitdiffstats
path: root/qt-ui/maintab.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r--qt-ui/maintab.cpp37
1 files changed, 33 insertions, 4 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 34626942d..c684a5bfd 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -16,10 +16,6 @@
#include <QLabel>
#include <QDebug>
-#define GTK_EDIT_STYLE 0
-#define TEST_EDIT_STYLE 1
-#define EDIT_STYLE GTK_EDIT_STYLE
-
MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
ui(new Ui::MainTab()),
weightModel(new WeightModel()),
@@ -43,6 +39,13 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
ui->rating->setReadOnly(false);
ui->editNotes->hide();
ui->resetNotes->hide();
+
+ ui->location->installEventFilter(this);
+ ui->divemaster->installEventFilter(this);
+ ui->buddy->installEventFilter(this);
+ ui->suit->installEventFilter(this);
+ ui->notes->installEventFilter(this);
+ ui->rating->installEventFilter(this);
#endif
/* example of where code is more concise than Qt designer */
@@ -60,6 +63,20 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
}
}
+bool MainTab::eventFilter(QObject* object, QEvent* event)
+{
+ if(event->type() == QEvent::FocusIn){
+ if (ui->editNotes->isVisible()){
+ return false;
+ }
+ ui->editNotes->setChecked(true);
+ ui->editNotes->show();
+ ui->resetNotes->show();
+ on_editNotes_clicked(true);
+ }
+ return false;
+}
+
void MainTab::clearEquipment()
{
}
@@ -253,6 +270,13 @@ void MainTab::on_editNotes_clicked(bool edit)
ui->diveNotesMessage->animatedHide();
ui->editNotes->setText(tr("edit"));
}
+
+#if !EDIT_STYLE
+ if(!edit){
+ ui->editNotes->hide();
+ ui->resetNotes->hide();
+ }
+#endif
}
void MainTab::on_resetNotes_clicked()
@@ -277,6 +301,11 @@ void MainTab::on_resetNotes_clicked()
ui->notes->setReadOnly(true);
ui->rating->setReadOnly(true);
mainWindow()->dive_list()->setEnabled(true);
+
+#if !EDIT_STYLE
+ ui->editCylinder->hide();
+ ui->resetNotes->hide();
+#endif
}
#define EDIT_NOTES(what, text) \