Changeset View
Changeset View
Standalone View
Standalone View
src/renderer/KReportScreenRenderer_p.cpp
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | 36 | { | |||
---|---|---|---|---|---|
45 | if (!p) { | 45 | if (!p) { | ||
46 | return false; | 46 | return false; | ||
47 | } | 47 | } | ||
48 | 48 | | |||
49 | // Render Page Objects | 49 | // Render Page Objects | ||
50 | for (int i = 0; i < p->primitiveCount(); i++) { | 50 | for (int i = 0; i < p->primitiveCount(); i++) { | ||
51 | OROPrimitive *prim = p->primitive(i); | 51 | OROPrimitive *prim = p->primitive(i); | ||
52 | 52 | | |||
53 | if (dynamic_cast<OROTextBox*>(prim)) { | 53 | if (OROTextBox *tb = dynamic_cast<OROTextBox*>(prim)) { | ||
54 | OROTextBox *tb = dynamic_cast<OROTextBox*>(prim); | | |||
55 | | ||||
56 | QPointF ps = tb->position(); | 54 | QPointF ps = tb->position(); | ||
57 | QSizeF sz = tb->size(); | 55 | QSizeF sz = tb->size(); | ||
58 | QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height()); | 56 | QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height()); | ||
59 | 57 | | |||
60 | context.painter()->save(); | 58 | context.painter()->save(); | ||
61 | //Background | 59 | //Background | ||
62 | 60 | | |||
63 | context.painter()->setBackgroundMode(Qt::TransparentMode); | 61 | context.painter()->setBackgroundMode(Qt::TransparentMode); | ||
Show All 10 Lines | |||||
74 | 72 | | |||
75 | //outer line | 73 | //outer line | ||
76 | context.painter()->setPen(QPen(tb->lineStyle().color(), tb->lineStyle().width(), tb->lineStyle().penStyle())); | 74 | context.painter()->setPen(QPen(tb->lineStyle().color(), tb->lineStyle().width(), tb->lineStyle().penStyle())); | ||
77 | context.painter()->drawRect(rc); | 75 | context.painter()->drawRect(rc); | ||
78 | 76 | | |||
79 | //Reset back to defaults for next element | 77 | //Reset back to defaults for next element | ||
80 | context.painter()->restore(); | 78 | context.painter()->restore(); | ||
81 | } | 79 | } | ||
82 | else if (dynamic_cast<OROLine*>(prim)) { | 80 | else if (OROLine *ln = dynamic_cast<OROLine*>(prim)) { | ||
83 | OROLine * ln = dynamic_cast<OROLine*>(prim); | | |||
84 | QPointF s = ln->startPoint(); | 81 | QPointF s = ln->startPoint(); | ||
85 | QPointF e = ln->endPoint(); | 82 | QPointF e = ln->endPoint(); | ||
86 | //QPen pen ( _painter->pen() ); | 83 | //QPen pen ( _painter->pen() ); | ||
87 | QPen pen(ln->lineStyle().color(), ln->lineStyle().width(), ln->lineStyle().penStyle()); | 84 | QPen pen(ln->lineStyle().color(), ln->lineStyle().width(), ln->lineStyle().penStyle()); | ||
88 | 85 | | |||
89 | context.painter()->save(); | 86 | context.painter()->save(); | ||
90 | context.painter()->setRenderHint(QPainter::Antialiasing, true); | 87 | context.painter()->setRenderHint(QPainter::Antialiasing, true); | ||
91 | context.painter()->setPen(pen); | 88 | context.painter()->setPen(pen); | ||
92 | context.painter()->drawLine(QLineF(s.x(), s.y(), e.x(), e.y())); | 89 | context.painter()->drawLine(QLineF(s.x(), s.y(), e.x(), e.y())); | ||
93 | context.painter()->setRenderHint(QPainter::Antialiasing, false); | 90 | context.painter()->setRenderHint(QPainter::Antialiasing, false); | ||
94 | context.painter()->restore(); | 91 | context.painter()->restore(); | ||
95 | } | 92 | } | ||
96 | else if (dynamic_cast<ORORect*>(prim)) { | 93 | else if (ORORect *re = dynamic_cast<ORORect*>(prim)) { | ||
97 | ORORect * re = dynamic_cast<ORORect*>(prim); | | |||
98 | | ||||
99 | QPointF ps = re->position(); | 94 | QPointF ps = re->position(); | ||
100 | QSizeF sz = re->size(); | 95 | QSizeF sz = re->size(); | ||
101 | QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height()); | 96 | QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height()); | ||
102 | 97 | | |||
103 | context.painter()->save(); | 98 | context.painter()->save(); | ||
104 | context.painter()->setPen(re->pen()); | 99 | context.painter()->setPen(re->pen()); | ||
105 | context.painter()->setBrush(re->brush()); | 100 | context.painter()->setBrush(re->brush()); | ||
106 | context.painter()->drawRect(rc); | 101 | context.painter()->drawRect(rc); | ||
107 | context.painter()->restore(); | 102 | context.painter()->restore(); | ||
108 | } | 103 | } | ||
109 | else if (dynamic_cast<OROEllipse*>(prim)) { | 104 | else if (OROEllipse *re = dynamic_cast<OROEllipse*>(prim)) { | ||
110 | OROEllipse * re = dynamic_cast<OROEllipse*>(prim); | | |||
111 | | ||||
112 | QPointF ps = re->position(); | 105 | QPointF ps = re->position(); | ||
113 | QSizeF sz = re->size(); | 106 | QSizeF sz = re->size(); | ||
114 | QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height()); | 107 | QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height()); | ||
115 | 108 | | |||
116 | context.painter()->save(); | 109 | context.painter()->save(); | ||
117 | context.painter()->setPen(re->pen()); | 110 | context.painter()->setPen(re->pen()); | ||
118 | context.painter()->setBrush(re->brush()); | 111 | context.painter()->setBrush(re->brush()); | ||
119 | context.painter()->drawEllipse(rc); | 112 | context.painter()->drawEllipse(rc); | ||
120 | context.painter()->restore(); | 113 | context.painter()->restore(); | ||
121 | } | 114 | } | ||
122 | else if (dynamic_cast<OROImage*>(prim)) { | 115 | else if ( OROImage *im = dynamic_cast<OROImage*>(prim)) { | ||
123 | OROImage * im = dynamic_cast<OROImage*>(prim); | | |||
124 | QPointF ps = im->position(); | 116 | QPointF ps = im->position(); | ||
125 | QSizeF sz = im->size(); | 117 | QSizeF sz = im->size(); | ||
126 | QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height()); | 118 | QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height()); | ||
127 | 119 | | |||
128 | QImage img = im->image(); | 120 | QImage img = im->image(); | ||
129 | if (im->isScaled()) | 121 | if (im->isScaled()) | ||
130 | img = img.scaled(rc.size().toSize(), (Qt::AspectRatioMode) im->aspectRatioMode(), | 122 | img = img.scaled(rc.size().toSize(), (Qt::AspectRatioMode) im->aspectRatioMode(), | ||
131 | (Qt::TransformationMode) im->transformationMode()); | 123 | (Qt::TransformationMode) im->transformationMode()); | ||
132 | 124 | | |||
133 | QRectF sr = QRectF(QPointF(0.0, 0.0), rc.size().boundedTo(img.size())); | 125 | QRectF sr = QRectF(QPointF(0.0, 0.0), rc.size().boundedTo(img.size())); | ||
134 | context.painter()->drawImage(rc.topLeft(), img, sr); | 126 | context.painter()->drawImage(rc.topLeft(), img, sr); | ||
135 | } | 127 | } | ||
136 | else if (dynamic_cast<OROPicture*>(prim)) { | 128 | else if (OROPicture *im = dynamic_cast<OROPicture*>(prim)) { | ||
137 | OROPicture * im = dynamic_cast<OROPicture*>(prim); | | |||
138 | QPointF ps = im->position(); | 129 | QPointF ps = im->position(); | ||
139 | QSizeF sz = im->size(); | 130 | QSizeF sz = im->size(); | ||
140 | QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height()); | 131 | QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height()); | ||
141 | context.painter()->save(); | 132 | context.painter()->save(); | ||
142 | context.painter()->drawPicture(rc.topLeft(), *(im->picture())); | 133 | context.painter()->drawPicture(rc.topLeft(), *(im->picture())); | ||
143 | context.painter()->restore(); | 134 | context.painter()->restore(); | ||
144 | } | 135 | } | ||
145 | else if (dynamic_cast<OROCheckBox*>(prim)) { | 136 | else if (OROCheckBox *chk = dynamic_cast<OROCheckBox*>(prim)) { | ||
146 | OROCheckBox * chk = dynamic_cast<OROCheckBox*>(prim); | | |||
147 | QPointF ps = chk->position(); | 137 | QPointF ps = chk->position(); | ||
148 | QSizeF sz = chk->size(); | 138 | QSizeF sz = chk->size(); | ||
149 | QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height()); | 139 | QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height()); | ||
150 | 140 | | |||
151 | context.painter()->save(); | 141 | context.painter()->save(); | ||
152 | 142 | | |||
153 | context.painter()->setBackgroundMode(Qt::OpaqueMode); | 143 | context.painter()->setBackgroundMode(Qt::OpaqueMode); | ||
154 | context.painter()->setRenderHint(QPainter::Antialiasing); | 144 | context.painter()->setRenderHint(QPainter::Antialiasing); | ||
▲ Show 20 Lines • Show All 65 Lines • Show Last 20 Lines |