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);
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
QCalendarWidget* calendar = new QCalendarWidget(parent);
|
||||
QCalendarWidget* calendar = new QCalendarWidget(parent->parentWidget()->parentWidget());
|
||||
|
||||
calendar->setGridVisible(false);
|
||||
calendar->setFirstDayOfWeek(Qt::Monday);
|
||||
|
@ -41,6 +48,7 @@ QWidget * CalendarDelegate::createEditor (QWidget * parent, const QStyleOptionVi
|
|||
calendar->setMinimumHeight(200);
|
||||
|
||||
connect(calendar, SIGNAL(clicked (const QDate&)), this, SLOT(OnCalendarClicked(const QDate&)));
|
||||
connect(calendar, SIGNAL(selectionChanged (void)), this, SLOT(OnCalendarSelectionChanged(void)));
|
||||
|
||||
return calendar;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,8 @@ public:
|
|||
|
||||
private slots:
|
||||
void OnCalendarClicked(const QDate &date);
|
||||
|
||||
void OnCalendarSelectionChanged(void);
|
||||
|
||||
private:
|
||||
std::vector<Account>* _accounts;
|
||||
bool _start;
|
||||
|
|
Loading…
Reference in New Issue
Block a user