extern WeightDataModel *wdm;
EditWindow::EditWindow(QWidget *parent) :
- QMainWindow(parent)
+ QMainWindow(parent), shown(false)
{
#ifdef Q_WS_MAEMO_5
setAttribute(Qt::WA_Maemo5StackedWindow);
return;
}
wdm->setWeightForDate(dw);
+ weightView.scrollTo(wdm->indexOfDate(dw.date), QAbstractItemView::PositionAtCenter);
}
}
if (indexes.size() == 1)
weightView.edit(wdm->index(indexes.first().row(), 1));
}
+
+void EditWindow::show()
+{
+ QMainWindow::show();
+ // scrollToBottom must be here: it will not scroll all the way
+ // to the bottom when called in the constructor because it'll
+ // receive the wrong window geometry while hidden.
+ if (!shown) {
+ weightView.scrollToBottom();
+ shown = true;
+ }
+}