aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/maintab.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-19 08:09:48 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-19 08:09:48 -0700
commitae05498d94337f42b396895be2745c4b22e4829a (patch)
treeb26754a4853371f6d6dd3e59acaa1f8ddf9ef41b /qt-ui/maintab.cpp
parent1298aa87e519addde0f5490b238395fcaf8b4e95 (diff)
parent55b998d528f53f5023b52bc674477b00668b400b (diff)
downloadsubsurface-ae05498d94337f42b396895be2745c4b22e4829a.tar.gz
Merge branch 'chooseEditMode' of https://github.com/tcanabrava/subsurface
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r--qt-ui/maintab.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index bebbc109c..378ba8721 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -27,7 +27,26 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
ui->weights->setModel(weightModel);
ui->diveNotesMessage->hide();
ui->diveNotesMessage->setCloseButtonVisible(false);
+
+#if EDIT_STYLE
ui->rating->setReadOnly(true);
+#else
+ ui->location->setReadOnly(false);
+ ui->divemaster->setReadOnly(false);
+ ui->buddy->setReadOnly(false);
+ ui->suit->setReadOnly(false);
+ ui->notes->setReadOnly(false);
+ 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 */
QList<QObject *> infoTabWidgets = ui->infoTab->children();
@@ -44,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()
{
}
@@ -245,6 +278,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()
@@ -269,6 +309,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) \