Changeset View
Changeset View
Standalone View
Standalone View
src/items/field/KReportItemField.cpp
Show First 20 Lines • Show All 229 Lines • ▼ Show 20 Line(s) | 216 | { | |||
---|---|---|---|---|---|
230 | if (!ids.isEmpty()) { | 230 | if (!ids.isEmpty()) { | ||
231 | #ifdef KREPORT_SCRIPTING | 231 | #ifdef KREPORT_SCRIPTING | ||
232 | if (ids.left(1) == QLatin1String("=") && script) { //Everything after = is treated as code | 232 | if (ids.left(1) == QLatin1String("=") && script) { //Everything after = is treated as code | ||
233 | if (!ids.contains(QLatin1String("PageTotal()"))) { | 233 | if (!ids.contains(QLatin1String("PageTotal()"))) { | ||
234 | QVariant v = script->evaluate(ids.mid(1)); | 234 | QVariant v = script->evaluate(ids.mid(1)); | ||
235 | str = v.toString(); | 235 | str = v.toString(); | ||
236 | } else { | 236 | } else { | ||
237 | str = ids.mid(1); | 237 | str = ids.mid(1); | ||
238 | tb->setRequiresPostProcessing(); | 238 | tb->setRequiresPostProcessing(true); | ||
239 | } | 239 | } | ||
240 | } else | 240 | } else | ||
241 | #else | 241 | #else | ||
242 | Q_UNUSED(script); | 242 | Q_UNUSED(script); | ||
243 | #endif | 243 | #endif | ||
244 | if (ids.left(1) == QLatin1String("$")) { //Everything past $ is treated as a string | 244 | if (ids.left(1) == QLatin1String("$")) { //Everything past $ is treated as a string | ||
245 | str = ids.mid(1); | 245 | str = ids.mid(1); | ||
246 | } else { | 246 | } else { | ||
Show All 18 Lines | 263 | } else { | |||
265 | QFontMetrics metrics(font()); | 265 | QFontMetrics metrics(font()); | ||
266 | QRect temp(tb->position().x(), tb->position().y(), 5000, tb->size().height()); // a large vertical height | 266 | QRect temp(tb->position().x(), tb->position().y(), 5000, tb->size().height()); // a large vertical height | ||
267 | r = metrics.boundingRect(temp, tb->flags(), str); | 267 | r = metrics.boundingRect(temp, tb->flags(), str); | ||
268 | } | 268 | } | ||
269 | tb->setSize(r.size() + QSize(4,4)); | 269 | tb->setSize(r.size() + QSize(4,4)); | ||
270 | } | 270 | } | ||
271 | 271 | | |||
272 | if (page) { | 272 | if (page) { | ||
273 | page->addPrimitive(tb); | 273 | page->insertPrimitive(tb); | ||
274 | } | 274 | } | ||
275 | 275 | | |||
276 | if (section) { | 276 | if (section) { | ||
277 | OROPrimitive *clone = tb->clone(); | 277 | OROPrimitive *clone = tb->clone(); | ||
278 | clone->setPosition(scenePosition(position())); | 278 | clone->setPosition(scenePosition(position())); | ||
279 | section->addPrimitive(clone); | 279 | section->addPrimitive(clone); | ||
280 | } | 280 | } | ||
281 | int height = scenePosition(position()).y() + tb->size().height(); | 281 | int height = scenePosition(position()).y() + tb->size().height(); | ||
282 | //If there is no page to add the item to, delete it now because it wont be deleted later | 282 | //If there is no page to add the item to, delete it now because it wont be deleted later | ||
283 | if (!page) { | 283 | if (!page) { | ||
284 | delete tb; | 284 | delete tb; | ||
285 | } | 285 | } | ||
286 | return height; | 286 | return height; | ||
287 | } | 287 | } |