22 #include <hbdeviceprofile.h> |
22 #include <hbdeviceprofile.h> |
23 #include <hbcolorscheme.h> |
23 #include <hbcolorscheme.h> |
24 |
24 |
25 // User includes |
25 // User includes |
26 #include "calenthicklinesdrawer.h" |
26 #include "calenthicklinesdrawer.h" |
|
27 #include "OstTraceDefinitions.h" |
|
28 #ifdef OST_TRACE_COMPILER_IN_USE |
|
29 #include "calenthicklinesdrawerTraces.h" |
|
30 #endif |
|
31 |
27 |
32 |
28 // CONSTANTS |
33 // CONSTANTS |
29 #define CALENTHICKLINEWIDTH 0.15 // Units |
34 #define CALENTHICKLINEWIDTH 0.15 // Units |
30 #define CALENDAYNAMEANDGRIDSEPERATOR 0.75 // Units |
35 #define CALENDAYNAMEANDGRIDSEPERATOR 0.75 // Units |
31 |
36 |
40 */ |
45 */ |
41 CalenThickLinesDrawer::CalenThickLinesDrawer( CalendarNamespace::WidgetType type, |
46 CalenThickLinesDrawer::CalenThickLinesDrawer( CalendarNamespace::WidgetType type, |
42 QGraphicsItem* parent): |
47 QGraphicsItem* parent): |
43 HbWidget(parent) |
48 HbWidget(parent) |
44 { |
49 { |
|
50 OstTraceFunctionEntry0( CALENTHICKLINESDRAWER_CALENTHICKLINESDRAWER_ENTRY ); |
|
51 |
45 typeOfWidget = type; |
52 typeOfWidget = type; |
46 mGridBorderColor = HbColorScheme::color("qtc_cal_grid_line"); |
53 mGridBorderColor = HbColorScheme::color("qtc_cal_grid_line"); |
47 setFlag(QGraphicsItem::ItemHasNoContents, false); |
54 setFlag(QGraphicsItem::ItemHasNoContents, false); |
|
55 |
|
56 OstTraceFunctionExit0( CALENTHICKLINESDRAWER_CALENTHICKLINESDRAWER_EXIT ); |
48 } |
57 } |
49 |
58 |
50 /*! |
59 /*! |
51 To paint grid item border |
60 To paint grid item border |
52 */ |
61 */ |
53 CalenThickLinesDrawer::~CalenThickLinesDrawer() |
62 CalenThickLinesDrawer::~CalenThickLinesDrawer() |
54 { |
63 { |
|
64 OstTraceFunctionEntry0( DUP1_CALENTHICKLINESDRAWER_CALENTHICKLINESDRAWER_ENTRY ); |
55 |
65 |
|
66 OstTraceFunctionExit0( DUP1_CALENTHICKLINESDRAWER_CALENTHICKLINESDRAWER_EXIT ); |
56 } |
67 } |
57 |
68 |
58 /*! |
69 /*! |
59 To paint grid item border |
70 To paint grid item border |
60 */ |
71 */ |
61 void CalenThickLinesDrawer::paint(QPainter* painter, |
72 void CalenThickLinesDrawer::paint(QPainter* painter, |
62 const QStyleOptionGraphicsItem* option, |
73 const QStyleOptionGraphicsItem* option, |
63 QWidget* widget) |
74 QWidget* widget) |
64 { |
75 { |
|
76 OstTraceFunctionEntry0( CALENTHICKLINESDRAWER_PAINT_ENTRY ); |
|
77 |
65 Q_UNUSED(option); |
78 Q_UNUSED(option); |
66 Q_UNUSED(widget); |
79 Q_UNUSED(widget); |
67 QPen pen; |
80 QPen pen; |
68 pen.setStyle(Qt::SolidLine); |
81 pen.setStyle(Qt::SolidLine); |
69 |
82 |
72 HbDeviceProfile deviceProf; |
85 HbDeviceProfile deviceProf; |
73 qreal unitValue = deviceProf.unitValue(); |
86 qreal unitValue = deviceProf.unitValue(); |
74 qreal widthInPixels = CALENTHICKLINEWIDTH * unitValue; |
87 qreal widthInPixels = CALENTHICKLINEWIDTH * unitValue; |
75 pen.setWidth(widthInPixels); |
88 pen.setWidth(widthInPixels); |
76 pen.setBrush(mGridBorderColor); |
89 pen.setBrush(mGridBorderColor); |
|
90 |
|
91 // Store the old pen |
|
92 QPen oldPen = painter->pen(); |
|
93 |
77 painter->setPen(pen); |
94 painter->setPen(pen); |
78 QRectF controlRect = this->boundingRect(); |
95 QRectF controlRect = this->boundingRect(); |
79 |
96 |
80 // Check the type of the widget and paint the necessary things |
97 // Check the type of the widget and paint the necessary things |
81 if ( typeOfWidget == CalendarNamespace::CalenDayNameWidget ) { |
98 if ( typeOfWidget == CalendarNamespace::CalenDayNameWidget ) { |
93 QPointF startPoint = controlRect.topRight(); |
110 QPointF startPoint = controlRect.topRight(); |
94 QPointF endPoint = controlRect.bottomRight(); |
111 QPointF endPoint = controlRect.bottomRight(); |
95 painter->drawLine(startPoint, endPoint); |
112 painter->drawLine(startPoint, endPoint); |
96 } |
113 } |
97 } |
114 } |
|
115 |
|
116 // Set the old pen back |
|
117 painter->setPen(oldPen); |
|
118 |
|
119 OstTraceFunctionExit0( CALENTHICKLINESDRAWER_PAINT_EXIT ); |
98 } |
120 } |
99 |
121 |
100 // End of file --Don't remove this. |
122 // End of file --Don't remove this. |