Changeset View
Changeset View
Standalone View
Standalone View
src/plugins/barcode/code128.cpp
Show First 20 Lines • Show All 315 Lines • ▼ Show 20 Line(s) | 309 | for (int i = 0; i < str.size(); ++i) { | |||
---|---|---|---|---|---|
316 | space = false; | 316 | space = false; | ||
317 | for (int b = 0; b < 6; ++b, space = !space) { | 317 | for (int b = 0; b < 6; ++b, space = !space) { | ||
318 | qreal w = _128codes[idx].values[b] * bar_width; | 318 | qreal w = _128codes[idx].values[b] * bar_width; | ||
319 | if (!space) { | 319 | if (!space) { | ||
320 | ORORect * rect = new ORORect(); | 320 | ORORect * rect = new ORORect(); | ||
321 | rect->setPen(pen); | 321 | rect->setPen(pen); | ||
322 | rect->setBrush(brush); | 322 | rect->setBrush(brush); | ||
323 | rect->setRect(QRectF(pos, top, w, draw_height)); | 323 | rect->setRect(QRectF(pos, top, w, draw_height)); | ||
324 | page->addPrimitive(rect); | 324 | page->insertPrimitive(rect); | ||
325 | } | 325 | } | ||
326 | pos += w; | 326 | pos += w; | ||
327 | } | 327 | } | ||
328 | } | 328 | } | ||
329 | 329 | | |||
330 | // we have to do the stop character separately like this because it has | 330 | // we have to do the stop character separately like this because it has | ||
331 | // 7 elements in it's bar sequence rather than 6 like the others | 331 | // 7 elements in it's bar sequence rather than 6 like the others | ||
332 | int STOP_CHARACTER[] = { 2, 3, 3, 1, 1, 1, 2 }; | 332 | int STOP_CHARACTER[] = { 2, 3, 3, 1, 1, 1, 2 }; | ||
333 | space = false; | 333 | space = false; | ||
334 | for (int b = 0; b < 7; ++b, space = !space) { | 334 | for (int b = 0; b < 7; ++b, space = !space) { | ||
335 | qreal w = STOP_CHARACTER[b] * bar_width; | 335 | qreal w = STOP_CHARACTER[b] * bar_width; | ||
336 | if (!space) { | 336 | if (!space) { | ||
337 | ORORect * rect = new ORORect(); | 337 | ORORect * rect = new ORORect(); | ||
338 | rect->setPen(pen); | 338 | rect->setPen(pen); | ||
339 | rect->setBrush(brush); | 339 | rect->setBrush(brush); | ||
340 | rect->setRect(QRectF(pos, top, w, draw_height)); | 340 | rect->setRect(QRectF(pos, top, w, draw_height)); | ||
341 | page->addPrimitive(rect); | 341 | page->insertPrimitive(rect); | ||
342 | } | 342 | } | ||
343 | pos += w; | 343 | pos += w; | ||
344 | } | 344 | } | ||
345 | } | 345 | } |