Show calendar in (PreferencesPanel) at the widget upper for a clearer view + react on SelectionChanged signal
This commit is contained in:
parent
397096680c
commit
8b0f386121
|
@ -30,9 +30,16 @@ void CalendarDelegate::OnCalendarClicked(const QDate &date)
|
||||||
closeEditor(qobject_cast<QWidget*>(sender()), QAbstractItemDelegate::SubmitModelCache);
|
closeEditor(qobject_cast<QWidget*>(sender()), QAbstractItemDelegate::SubmitModelCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CalendarDelegate::OnCalendarSelectionChanged(void)
|
||||||
|
{
|
||||||
|
QCalendarWidget* calendar = qobject_cast<QCalendarWidget*>(sender());
|
||||||
|
_date = calendar->selectedDate();
|
||||||
|
commitData(calendar);
|
||||||
|
}
|
||||||
|
|
||||||
QWidget * CalendarDelegate::createEditor (QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index ) const
|
QWidget * CalendarDelegate::createEditor (QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index ) const
|
||||||
{
|
{
|
||||||
QCalendarWidget* calendar = new QCalendarWidget(parent);
|
QCalendarWidget* calendar = new QCalendarWidget(parent->parentWidget()->parentWidget());
|
||||||
|
|
||||||
calendar->setGridVisible(false);
|
calendar->setGridVisible(false);
|
||||||
calendar->setFirstDayOfWeek(Qt::Monday);
|
calendar->setFirstDayOfWeek(Qt::Monday);
|
||||||
|
@ -41,6 +48,7 @@ QWidget * CalendarDelegate::createEditor (QWidget * parent, const QStyleOptionVi
|
||||||
calendar->setMinimumHeight(200);
|
calendar->setMinimumHeight(200);
|
||||||
|
|
||||||
connect(calendar, SIGNAL(clicked (const QDate&)), this, SLOT(OnCalendarClicked(const QDate&)));
|
connect(calendar, SIGNAL(clicked (const QDate&)), this, SLOT(OnCalendarClicked(const QDate&)));
|
||||||
|
connect(calendar, SIGNAL(selectionChanged (void)), this, SLOT(OnCalendarSelectionChanged(void)));
|
||||||
|
|
||||||
return calendar;
|
return calendar;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ public:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void OnCalendarClicked(const QDate &date);
|
void OnCalendarClicked(const QDate &date);
|
||||||
|
void OnCalendarSelectionChanged(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<Account>* _accounts;
|
std::vector<Account>* _accounts;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user