13 #include <QApplication>
14 #include <QDesktopWidget>
15 #include <QVBoxLayout>
26 QDateTime qdt = QDateTime::currentDateTime();
37 if (format.length() == 0) {
40 meter->
setValue(qdt.toString(format));
52 :
QWidget(parent, Qt::Window | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint)
54 setAttribute(Qt::WA_DeleteOnClose);
56 picker =
new KDatePicker();
57 picker->setCloseButton(
true);
59 QVBoxLayout *layout =
new QVBoxLayout;
60 layout->addWidget(picker);
68 void DatePicker::keyReleaseEvent(QKeyEvent *e)
70 QWidget::keyReleaseEvent(e);
71 if (e->key() == Qt::Key_Escape)
81 QString width = sp->
getParam(
"CALWIDTH");
82 QString height = sp->
getParam(
"CALHEIGHT");
84 QRect rect(meter->
getX(), meter->
getY(), width.toInt(), height.toInt());
85 if (rect.contains(ev->x(), ev->y())) {
91 QPoint c = (QPoint(ev->x(), ev->y()));
93 int w = cal->sizeHint().width();
94 int h = cal->sizeHint().height();
97 QRect deskR = QApplication::desktop()->screenGeometry(QApplication::desktop()->screenNumber(c));
100 if (c.y() + h > deskR.bottom()) c.setY(deskR.bottom() - h - 1);
101 if (c.x() + w > deskR.right()) c.setX(deskR.right() - w - 1);
114 switch (ev->button()) {
void slotCalendarDeleted()
void mousePressEvent(QMouseEvent *ev)
void toggleCalendar(QMouseEvent *ev)
QString getParam(const QString &) const
virtual void setValue(int)
QList< QObject * > * objList