Changeset 6448 for trunk/qt4-gui/src/widgets
- Timestamp:
- 07/13/08 03:39:22 (4 months ago)
- Location:
- trunk/qt4-gui/src/widgets
- Files:
-
- 2 modified
-
calendar.cpp (modified) (3 diffs)
-
calendar.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/qt4-gui/src/widgets/calendar.cpp
r5996 r6448 54 54 } 55 55 56 void Calendar::markDate( QDatedate)56 void Calendar::markDate(const QDate& date) 57 57 { 58 58 QTextCharFormat textFormat = dateTextFormat(date); … … 62 62 textFormat.setBackground(Qt::transparent); 63 63 setDateTextFormat(date, textFormat); 64 } 65 66 void Calendar::addMatch(const QDate& date) 67 { 68 if (myMatches.contains(date)) 69 return; 70 71 myMatches.append(date); 72 updateCell(date); 73 } 74 75 void Calendar::clearMatches() 76 { 77 myMatches.clear(); 78 updateCells(); 64 79 } 65 80 … … 74 89 painter->setPen(Qt::NoPen); 75 90 painter->setRenderHints(painter->renderHints() | QPainter::Antialiasing); 76 painter->setBrush( Qt::yellow);91 painter->setBrush(myMatches.contains(date) ? Qt::green : Qt::yellow); 77 92 painter->drawEllipse(center); 78 93 painter->restore(); -
trunk/qt4-gui/src/widgets/calendar.h
r5996 r6448 25 25 26 26 #include <QCalendarWidget> 27 #include <QDate> 28 #include <QList> 27 29 28 30 namespace LicqQtGui … … 54 56 * @param date Date to mark 55 57 */ 56 void markDate(QDate date); 58 void markDate(const QDate& date); 59 60 /** 61 * Mark a search match in the calendar 62 * Note: Date must already be marked with markDate() 63 * 64 * @param date Date of the match 65 */ 66 void addMatch(const QDate& date); 67 68 /** 69 * Clear all search matches 70 */ 71 void clearMatches(); 57 72 58 73 protected: … … 65 80 */ 66 81 virtual void paintCell(QPainter* painter, const QRect& rect, const QDate& date) const; 82 83 private: 84 QList<QDate> myMatches; 67 85 }; 68 86
