Show BMI label and calculated value only when both weight and height are non-zero

This commit is contained in:
Seeker4 2019-07-24 01:48:18 -07:00
parent 376d04803a
commit 166ffa4970
2 changed files with 26 additions and 0 deletions

View File

@ -588,6 +588,11 @@ void Daily::ReloadGraphs()
// sleep(3);
}
void Daily::updateLeftSidebar() {
if (webView && !htmlLeftHeader.isEmpty())
webView->setHtml(getLeftSidebar(true));
}
void Daily::hideSpaceHogs()
{
if (AppSetting->calendarVisible()) {
@ -2276,6 +2281,10 @@ void Daily::on_weightSpinBox_valueChanged(double arg1)
double bmi=kg/(height * height);
ui->BMI->display(bmi);
ui->BMI->setVisible(true);
ui->BMIlabel->setVisible(true);
} else {
ui->BMI->setVisible(false);
ui->BMIlabel->setVisible(false);
}
}
@ -2306,11 +2315,15 @@ void Daily::on_weightSpinBox_editingFinished()
double bmi=kg/(height * height);
ui->BMI->display(bmi);
ui->BMI->setVisible(true);
ui->BMIlabel->setVisible(true);
journal->settings[Journal_BMI]=bmi;
if (gv) {
g=gv->findGraph(STR_GRAPH_BMI);
if (g) g->setDay(nullptr);
}
} else {
ui->BMI->setVisible(false);
ui->BMIlabel->setVisible(false);
}
journal->SetChanged(true);
}
@ -2324,6 +2337,10 @@ void Daily::on_ouncesSpinBox_valueChanged(int arg1)
double bmi=kg/(height * height);
ui->BMI->display(bmi);
ui->BMI->setVisible(true);
ui->BMIlabel->setVisible(true);
} else {
ui->BMI->setVisible(false);
ui->BMIlabel->setVisible(false);
}
}
@ -2348,12 +2365,16 @@ void Daily::on_ouncesSpinBox_editingFinished()
double bmi=kg/(height * height);
ui->BMI->display(bmi);
ui->BMI->setVisible(true);
ui->BMIlabel->setVisible(true);
journal->settings[Journal_BMI]=bmi;
if (mainwin->getOverview()) {
g=mainwin->getOverview()->graphView()->findGraph(STR_GRAPH_BMI);
if (g) g->setDay(nullptr);
}
} else {
ui->BMI->setVisible(false);
ui->BMIlabel->setVisible(false);
}
journal->SetChanged(true);
}

View File

@ -66,6 +66,11 @@ public:
*/
void ResetGraphLayout();
/*! \fn updateLeftSidebar()
/brief Updtes left sidebar to reflect changes in pie chart visibility
*/
void updateLeftSidebar();
/*! \fn graphView()
\returns the main graphView area for the Daily View
*/