Changeset 5992909 in confclerk_git for src/gui/daynavigatorwidget.cpp
- Timestamp:
- 01/22/10 13:31:10 (13 years ago)
- Branches:
- master, qt5
- Children:
- 49c5ad3
- Parents:
- 806b992
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/gui/daynavigatorwidget.cpp
r806b992 r5992909 1 1 #include "daynavigatorwidget.h" 2 3 #include <QPainter> 4 #include <QFontMetrics> 5 #include <QLabel> 2 6 3 7 #include <QDebug> … … 12 16 connect(prevDayButton, SIGNAL(clicked()), SLOT(prevDayButtonClicked())); 13 17 connect(nextDayButton, SIGNAL(clicked()), SLOT(nextDayButtonClicked())); 18 19 mFontMetrics = new QFontMetrics(QLabel().font()); 14 20 } 15 21 … … 23 29 mCurDate = aStartDate; 24 30 25 currentDateLabel->setText(mCurDate.toString()); 31 QRect rect = mFontMetrics->boundingRect(mCurDate.toString("MMM dd yyyy")); 32 qDebug() << mCurDate.toString(); 33 26 34 if(mStartDate==mEndDate) // only one day conference 27 35 { … … 45 53 { 46 54 mCurDate = mCurDate.addDays(-1); 47 currentDateLabel->setText(mCurDate.toString());48 55 // check start date 49 56 if(mCurDate==mStartDate || mStartDate==mEndDate) … … 58 65 59 66 emit(dateChanged(mCurDate)); 67 selectedDate->update(); 60 68 } 61 69 } … … 67 75 { 68 76 mCurDate = mCurDate.addDays(1); 69 currentDateLabel->setText(mCurDate.toString());70 77 // check start date 71 78 if(mCurDate==mStartDate || mStartDate==mEndDate) … … 80 87 81 88 emit(dateChanged(mCurDate)); 89 selectedDate->update(); 82 90 } 83 91 } … … 88 96 } 89 97 98 void DayNavigatorWidget::paintEvent(QPaintEvent *aEvent) 99 { 100 QString selectedDateStr = mCurDate.toString("MMM dd yyyy"); 101 102 QPainter painter(this); 103 painter.save(); 104 QRect r = selectedDate->geometry(); 105 QRect s = mFontMetrics->boundingRect(selectedDateStr); 106 QPoint p = QPoint( 107 r.x() + r.width()/2 - s.height()/2 - mFontMetrics->descent(), 108 - 130 109 ); 110 111 painter.translate(r.width()/2, r.height()/2); 112 painter.rotate(270); 113 painter.drawText(p.y(), p.x(), selectedDateStr); // y,x,string 114 painter.restore(); 115 } 116
Note: See TracChangeset
for help on using the changeset viewer.