-rw-r--r-- | libkdepim/kdatepicker.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/libkdepim/kdatepicker.cpp b/libkdepim/kdatepicker.cpp index c13734f..77793c4 100644 --- a/libkdepim/kdatepicker.cpp +++ b/libkdepim/kdatepicker.cpp @@ -49,2 +49,3 @@ KDatePicker::KDatePicker(QWidget *parent, QDate dt, const char *name) selectYear(new QToolButton(this)), + todayBut(new QToolButton(this)), //line(new QLineEdit(this)), @@ -68,2 +69,3 @@ KDatePicker::KDatePicker(QWidget *parent, QDate dt, const char *name) monthBackward->setPixmap(SmallIcon("1leftarrowB")); + todayBut->setPixmap(SmallIcon("today")); setDate(dt); // set button texts @@ -77,2 +79,3 @@ KDatePicker::KDatePicker(QWidget *parent, QDate dt, const char *name) connect(selectYear, SIGNAL(clicked()), SLOT(selectYearClicked())); + connect(todayBut, SIGNAL(clicked()), SLOT(goToday())); //connect(line, SIGNAL(returnPressed()), SLOT(lineEnterPressed())); @@ -138,3 +141,5 @@ KDatePicker::resizeEvent(QResizeEvent*) //line->setGeometry(0, height()-sizes[0].height(), width(), sizes[0].height()); - lineDate->setGeometry(0, height()-sizes[0].height(), width(), sizes[0].height()); + int todaywid = todayBut->sizeHint().width(); +todayBut->setGeometry(0, height()-sizes[0].height(),todaywid, sizes[0].height()); + lineDate->setGeometry(0+todaywid, height()-sizes[0].height(), width()-todaywid, sizes[0].height()); // ----- adjust the table: @@ -172,2 +177,7 @@ KDatePicker::date() const +void KDatePicker::goToday() +{ + slotSetDate( QDate::currentDate() ); + +} void KDatePicker::slotSetDate( QDate date ) |