author | zautrix <zautrix> | 2004-09-17 11:42:59 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-17 11:42:59 (UTC) |
commit | dd33ac512eb4b4b647fb3423f7cdb39ec322221b (patch) (side-by-side diff) | |
tree | ea35b070c856a7233df08419ef0d189a665820f6 /libkdepim/kdatepicker.cpp | |
parent | d7a6a271b48f0c79e1f3beca03bbc9c3f2a54050 (diff) | |
download | kdepimpi-dd33ac512eb4b4b647fb3423f7cdb39ec322221b.zip kdepimpi-dd33ac512eb4b4b647fb3423f7cdb39ec322221b.tar.gz kdepimpi-dd33ac512eb4b4b647fb3423f7cdb39ec322221b.tar.bz2 |
Fixed datepicker
-rw-r--r-- | libkdepim/kdatepicker.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libkdepim/kdatepicker.cpp b/libkdepim/kdatepicker.cpp index 3fe139c..d8bc9f5 100644 --- a/libkdepim/kdatepicker.cpp +++ b/libkdepim/kdatepicker.cpp @@ -56,25 +56,24 @@ KDatePicker::KDatePicker(QWidget *parent, QDate dt, const char *name) if ( QApplication::desktop()->width() >= 480 ) size = 18; fontsize = size; setFont ( QFont("helvetica",size) ); table = new KDateTable(this); setFontSize(size); //line->setValidator(val); lineDate = new KDateEdit( this, "dateediipicker", true ); yearForward->setPixmap(SmallIcon("2rightarrowB")); yearBackward->setPixmap(SmallIcon("2leftarrowB")); monthForward->setPixmap(SmallIcon("1rightarrowB")); monthBackward->setPixmap(SmallIcon("1leftarrowB")); - setDate(dt); // set button texts connect(table, SIGNAL(dateChanged(QDate)), SLOT(dateChangedSlot(QDate))); connect(table, SIGNAL(tableClicked()), SLOT(tableClickedSlot())); connect(monthForward, SIGNAL(clicked()), SLOT(monthForwardClicked())); connect(monthBackward, SIGNAL(clicked()), SLOT(monthBackwardClicked())); connect(yearForward, SIGNAL(clicked()), SLOT(yearForwardClicked())); connect(yearBackward, SIGNAL(clicked()), SLOT(yearBackwardClicked())); connect(selectMonth, SIGNAL(clicked()), SLOT(selectMonthClicked())); connect(selectYear, SIGNAL(clicked()), SLOT(selectYearClicked())); //connect(line, SIGNAL(returnPressed()), SLOT(lineEnterPressed())); connect(lineDate, SIGNAL(dateChanged(QDate)), SLOT(slotSetDate(QDate))); connect(lineDate, SIGNAL(returnPressed()), SLOT(lineEnterPressed())); @@ -96,26 +95,30 @@ KDatePicker::resizeEvent(QResizeEvent*) selectYear, monthForward, yearForward }; const int NoOfButtons=sizeof(buttons)/sizeof(buttons[0]); QSize sizes[NoOfButtons]; int buttonHeight=0; int count; int w; int x=0; // ----- calculate button row height: for(count=0; count<NoOfButtons; ++count) { int xS = buttons[count]->sizeHint().width(); - int yS = buttons[count]->sizeHint().height(); - sizes[count]=QSize ( xS+10, yS ); + int yS = buttons[count]->sizeHint().height(); + if ( QApplication::desktop()->width() < 320 ) + sizes[count]=QSize ( xS+4, yS ); + else + sizes[count]=QSize ( xS+10, yS ); + buttonHeight=QMAX(buttonHeight, sizes[count].height()); } buttonHeight += 10; // ----- calculate size of the month button: w=0; for(count=0; count<NoOfButtons; ++count) { if(buttons[count]!=selectMonth) { w+=sizes[count].width(); } else { x=count; } |