From 5678a7e32f76934c23f1c29ecb890ce101e6e58f Mon Sep 17 00:00:00 2001 From: Herwig Birke Date: Mon, 2 Mar 2020 09:15:35 +0100 Subject: [PATCH] date +/- --- cmonthlyview.cpp | 13 +++++++++++++ cmonthlyview.h | 2 ++ cmonthlyview.ui | 34 ++++++++++++++++++++++++++++++++-- 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/cmonthlyview.cpp b/cmonthlyview.cpp index 23a231d..c4565ab 100644 --- a/cmonthlyview.cpp +++ b/cmonthlyview.cpp @@ -53,6 +53,9 @@ cMonthlyView::cMonthlyView(const QDate& date, cMonthlyBookingList* lpMonthlyBook connect(static_cast(ui->m_lpMonthlyList->itemDelegate()), &cMonthlyItemDelegate::timeChanged, this, &cMonthlyView::onTimeChanged); connect(static_cast(ui->m_lpMonthlyList->itemDelegate()), &cMonthlyItemDelegate::textChanged, this, &cMonthlyView::onTextChanged); + connect(ui->m_lpPrevMonth, &QToolButton::clicked, this, &cMonthlyView::onPrevMonth); + connect(ui->m_lpNextMonth, &QToolButton::clicked, this, &cMonthlyView::onNextMonth); + connect(ui->m_lpMonth, &QDateEdit::dateChanged, this, &cMonthlyView::onDateChanged); connect(ui->m_lpUeberstunden, &QLineEdit::textChanged, this, &cMonthlyView::onUeberstundenChanged); } @@ -214,6 +217,16 @@ cMonthlyView::~cMonthlyView() delete ui; } +void cMonthlyView::onPrevMonth() +{ + ui->m_lpMonth->setDate(ui->m_lpMonth->date().addMonths(-1)); +} + +void cMonthlyView::onNextMonth() +{ + ui->m_lpMonth->setDate(ui->m_lpMonth->date().addMonths(1)); +} + void cMonthlyView::onTimeChanged(const int day, const int field, const QTime& time) { QStandardItem* lpItem = m_lpMonthlyListModel->item(day-1, field); diff --git a/cmonthlyview.h b/cmonthlyview.h index 7797f5a..250a5fc 100644 --- a/cmonthlyview.h +++ b/cmonthlyview.h @@ -48,6 +48,8 @@ private: void displaySummary(); private slots: + void onPrevMonth(); + void onNextMonth(); void onTimeChanged(const int day, const int field, const QTime& time); void onTextChanged(const int day, const int field, const QString& text); void onDateChanged(const QDate& date); diff --git a/cmonthlyview.ui b/cmonthlyview.ui index 331a9e5..e508660 100644 --- a/cmonthlyview.ui +++ b/cmonthlyview.ui @@ -17,7 +17,14 @@ - + + + + + < + + + @@ -57,6 +64,13 @@ + + + + > + + + @@ -112,6 +126,12 @@ + + + 80 + 0 + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -280,6 +300,12 @@ + + + 80 + 0 + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -366,7 +392,11 @@ - + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + +