Allow select last date by End key in calendar
This commit is contained in:
parent
c170981074
commit
d8ea4c933e
1 changed files with 7 additions and 0 deletions
|
|
@ -206,6 +206,7 @@ public:
|
||||||
int countHeight();
|
int countHeight();
|
||||||
void setDateChosenCallback(Fn<void(QDate)> callback);
|
void setDateChosenCallback(Fn<void(QDate)> callback);
|
||||||
void selectBeginning();
|
void selectBeginning();
|
||||||
|
void selectEnd();
|
||||||
|
|
||||||
~Inner();
|
~Inner();
|
||||||
|
|
||||||
|
|
@ -437,6 +438,10 @@ void CalendarBox::Inner::selectBeginning() {
|
||||||
_dateChosenCallback(_context->dateFromIndex(_context->minDayIndex()));
|
_dateChosenCallback(_context->dateFromIndex(_context->minDayIndex()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CalendarBox::Inner::selectEnd() {
|
||||||
|
_dateChosenCallback(_context->dateFromIndex(_context->maxDayIndex()));
|
||||||
|
}
|
||||||
|
|
||||||
CalendarBox::Inner::~Inner() = default;
|
CalendarBox::Inner::~Inner() = default;
|
||||||
|
|
||||||
class CalendarBox::Title : public TWidget, private base::Subscriber {
|
class CalendarBox::Title : public TWidget, private base::Subscriber {
|
||||||
|
|
@ -588,6 +593,8 @@ void CalendarBox::keyPressEvent(QKeyEvent *e) {
|
||||||
e->ignore();
|
e->ignore();
|
||||||
} else if (e->key() == Qt::Key_Home) {
|
} else if (e->key() == Qt::Key_Home) {
|
||||||
_inner->selectBeginning();
|
_inner->selectBeginning();
|
||||||
|
} else if (e->key() == Qt::Key_End) {
|
||||||
|
_inner->selectEnd();
|
||||||
} else if (e->key() == Qt::Key_Left) {
|
} else if (e->key() == Qt::Key_Left) {
|
||||||
goPreviousMonth();
|
goPreviousMonth();
|
||||||
} else if (e->key() == Qt::Key_Right) {
|
} else if (e->key() == Qt::Key_Right) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue