From: gregor herrmann Date: Mon, 12 Sep 2011 18:43:29 +0000 (+0000) Subject: Day navigator widget: setDates() X-Git-Tag: 0.5.4~3 X-Git-Url: https://git.toastfreeware.priv.at/toast/confclerk.git/commitdiff_plain/d878ecb85efcf2228377486a5e3fe95f16aa6e15 Day navigator widget: setDates() - change logic of setting mCurDate: if it's outside the conference range, set it to mStartDate (and not to mEndDate when it's "greater") -- when going to an earlier conference, starting on the last day doesn't really make sense - update() the widget after changing dates. this might be a bit expensive but it ensure that the displayed date is what we want, and since there are many day navigator widgets there's probably no single other place Hopefully closes #36. --- diff --git a/src/gui/daynavigatorwidget.cpp b/src/gui/daynavigatorwidget.cpp index 48ce89a..48ca927 100644 --- a/src/gui/daynavigatorwidget.cpp +++ b/src/gui/daynavigatorwidget.cpp @@ -46,12 +46,13 @@ void DayNavigatorWidget::setDates(const QDate &aStartDate, const QDate &aEndDate mStartDate = aStartDate; mEndDate = aEndDate; if (!mCurDate.isValid()) mCurDate = mStartDate; - else if (mCurDate < mStartDate) mCurDate = mStartDate; - else if (mCurDate > mEndDate) mCurDate = mEndDate; + // if mCurDate is out of range, set it to mstartDate + else if (mCurDate < mStartDate || mCurDate > mEndDate) mCurDate = mStartDate; prevDayButton->setDisabled(mCurDate == mStartDate); nextDayButton->setDisabled(mCurDate == mEndDate); emit(dateChanged(mCurDate)); + this->update(); } void DayNavigatorWidget::configureNavigation()