blob: 38521c971cc6e83a7e4ad4575bcd91a9cd0fcc85 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
//===========================================
// Lumina-desktop source code
// Copyright (c) 2018, Ken Moore
// Available under the 3-clause BSD license
// See the LICENSE file for full details
//===========================================
// Simple menu popup with a calendar in it
//===========================================
#ifndef _LUMINA_DESKTOP_WIDGET_MENU_CALENDAR_H
#define _LUMINA_DESKTOP_WIDGET_MENU_CALENDAR_H
#include <QMenu>
#include <QWidgetAction>
#include <QCalendarWidget>
#include <QDate>
class CalendarMenu : public QMenu {
Q_OBJECT
private:
QCalendarWidget *cal;
QWidgetAction *WA;
public:
CalendarMenu() : QMenu(){
cal = new QCalendarWidget();
WA = new QWidgetAction(this);
WA->setDefaultWidget(cal);
this->addAction(WA);
connect(this, SIGNAL(aboutToShow()), this, SLOT(resetDate()) );
}
~CalendarMenu(){
cal->deleteLater();
}
private slots:
void resetDate(){
cal->setSelectedDate(QDate::currentDate());
}
};
#endif
|