BPS C++ API  2.24.4
bpsgraphicsitem.h
Go to the documentation of this file.
1 
4 #ifndef BPSGRAPHICSITEM_H
5 #define BPSGRAPHICSITEM_H
6 
7 #include "bps.h"
8 #include <QAbstractGraphicsShapeItem>
9 
10 class BpsMargins;
11 
19 {
21 
22 public:
28 
32  QRectF rect() const;
33 
38  void setRect(const QRectF& aRect);
39 
43  QString text() const;
44 
49  void setText(const QString& aText);
50 
54  QColor color() const;
55 
60  void setColor(const QColor &aColor);
61 
65  QFont font() const;
66 
71  void setFont(const QFont& aFont);
72 
77 
82  void setAlignment(Bps::Alignment aAlignment);
83 
88 
93  void setDirection(Bps::Direction aDirection);
94 
98  int roundness() const;
99 
106  void setRoundness(int aRoundness);
107 
112 
117  void setMargins(const BpsMargins& aMargins);
118 
120  enum { Type = 10000000 };
121  virtual ~BpsGraphicsSimpletextItem();
122  virtual int type() const;
123  virtual QRectF boundingRect() const;
124  virtual QPainterPath shape() const;
125  virtual void paint(QPainter* aPainter, const QStyleOptionGraphicsItem* aOption, QWidget* aWidget = nullptr);
127 
128 }; // BpsGraphicsSimpletextItem
129 
136 {
138 
139 public:
145 
149  int resolution() const;
150 
155  void setResolution(int aResolution);
156 
161 
166  void setDirection(Bps::Direction aDirection);
167 
171  int roundness() const;
172 
179  void setRoundness(int aRoundness);
180 
185 
190  void setMargins(const BpsMargins& aMargins);
191 
195  qreal textWidth() const;
196 
201  void setTextWidth(qreal aWidth);
202 
207 
212  void setDefaultFont(const QFont& aFont);
213 
217  QString toHtml() const;
218 
223  void setHtml(const QString& aText);
224 
229 
234  void setPlainText(const QString& aText);
235 
240 
242  enum { Type = 10000001 };
243  virtual ~BpsGraphicsRichtextItem();
244  virtual int type() const;
245  virtual QRectF boundingRect() const;
246  virtual QPainterPath shape() const;
247  virtual bool contains(const QPointF& aPoint) const;
248  virtual void paint(QPainter* aPainter, const QStyleOptionGraphicsItem* aOption, QWidget* aWidget = nullptr);
250 
251 }; // BpsGraphicsRichtextItem
252 
263 {
265 
266 public:
271  BpsGraphicsLineItem(QGraphicsItem* aParent = nullptr);
272 
276  QPen pen() const;
277 
282  void setPen(const QPen &aPen);
283 
287  QLineF line() const;
288 
293  void setLine(const QLineF& aLine);
294 
298  QPointF p1() const;
299 
304  void setP1(const QPointF& aPoint);
305 
309  QPointF p2() const;
310 
315  void setP2(const QPointF& aPoint);
316 
318  enum { Type = 10000002 };
319  virtual ~BpsGraphicsLineItem();
320  virtual int type() const;
321  virtual QRectF boundingRect() const;
322  virtual QPainterPath shape() const;
323  virtual bool contains(const QPointF &point) const;
324  virtual void paint(QPainter* aPainter, const QStyleOptionGraphicsItem* aOption, QWidget* aWidget = nullptr);
326 
327 }; // BpsGraphicsLineItem
328 
333 {
335 
336 public:
337 
342  BpsGraphicsRectItem(QGraphicsItem* aParent = nullptr);
343 
347  QRectF rect() const;
348 
353  void setRect(const QRectF& aRect);
354 
358  int roundness() const;
359 
366  void setRoundness(int aRoundness);
367 
369  enum { Type = 10000003 };
370  virtual ~BpsGraphicsRectItem();
371  virtual int type() const;
372  virtual QRectF boundingRect() const;
373  virtual QPainterPath shape() const;
374  virtual void paint(QPainter* aPainter, const QStyleOptionGraphicsItem* aOption, QWidget* aWidget = nullptr);
376 
377 }; // BpsGraphicsRectItem
378 
383 {
385 
386 public:
387 
393 
397  QRectF rect() const;
398 
403  void setRect(const QRectF& aRect);
404 
408  qreal module() const;
409 
414  void setModule(qreal aModule);
415 
420 
425  void setEccLevel(Bps::EccLevel aEccLevel);
426 
430  QColor color() const;
431 
436  void setColor(const QColor &aColor);
437 
441  QString text() const;
442 
446  QString codeText() const;
447 
452 
457  void setText(const QString& aText);
458 
463 
468  void setBarcodeType(Bps::Barcode aBarcodeType);
469 
474 
479  void setAlignment(Bps::Alignment aAlignment);
480 
485 
490  void setDirection(Bps::Direction aDirection);
491 
492 
496  QFont font() const;
497 
502  void setFont(const QFont& aFont);
503 
507  bool textprinted() const;
508 
513  void setTextprinted(bool aEnable);
514 
516  enum { Type = 10000004 };
517  virtual ~BpsGraphicsBarcodeItem();
518  virtual int type() const;
519  virtual QRectF boundingRect() const;
520  virtual QPainterPath shape() const;
521  virtual void paint(QPainter* aPainter, const QStyleOptionGraphicsItem* aOption, QWidget* aWidget = nullptr);
523 
524 }; // BpsGraphicsBarcodeItem
525 
530 {
532 
533 public:
534 
538  enum Sizing {
541  SizeFill
542  };
543 
549 
553  QRectF rect() const;
554 
559  void setRect(const QRectF& aRect);
560 
564  QPixmap pixmap() const;
565 
570  void setPixmap(const QPixmap& aPixmap);
571 
575  Sizing sizing() const;
576 
581  void setSizing(Sizing aSizing);
582 
587 
592  void setAlignment(Bps::Alignment aAlignment);
593 
598 
603  void setRotation(Bps::Rotation aRotation);
604 
608  int ppi() const;
609 
614  void setPpi(int aPpi);
615 
617  enum { Type = 10000005 };
618  virtual ~BpsGraphicsPixmapItem();
619  virtual int type() const;
620  virtual QRectF boundingRect() const;
621  virtual QPainterPath shape() const;
622  virtual void paint(QPainter* aPainter, const QStyleOptionGraphicsItem* aOption, QWidget* aWidget = nullptr);
624 
625 }; // BpsGraphicsPixmapItem
626 
627 #endif // BPSGRAPHICSITEM_H
Public include file for Bps class.
#define BPSCORE_EXPORT
Declare class to be an import from the shared library.
Definition: bpscore_global.h:22
#define BPS_PRIVATE(Class)
Declare pointer to private object in a public class.
Definition: bpsglobals.h:102
Bar code item.
Definition: bpsgraphicsitem.h:383
BpsGraphicsBarcodeItem(QGraphicsItem *aParent=nullptr)
Constructor for the class.
QColor color() const
QString text() const
qreal module() const
Bps::EccLevel eccLevel() const
void setDirection(Bps::Direction aDirection)
Set a new direction.
void setRect(const QRectF &aRect)
Set a new rectangle for the item.
QRectF rect() const
void setAlignment(Bps::Alignment aAlignment)
Set new alignment withing the bounding rectangle.
void setBarcodeType(Bps::Barcode aBarcodeType)
Set a new barcode type.
QString humanText() const
Bps::Barcode barcodeType() const
bool textprinted() const
Bps::Direction direction() const
void setText(const QString &aText)
Set a new barcode text.
void setTextprinted(bool aEnable)
Enable and disable text line printing.
Bps::Alignment alignment() const
void setFont(const QFont &aFont)
Set a new font for the text line.
QString codeText() const
void setModule(qreal aModule)
Define a new module.
void setColor(const QColor &aColor)
Set a new bar color (default = Qt::black).
void setEccLevel(Bps::EccLevel aEccLevel)
Define a new error correction code level.
Line item.
Definition: bpsgraphicsitem.h:263
QPen pen() const
void setP1(const QPointF &aPoint)
Set point 1.
QPointF p2() const
QLineF line() const
QPointF p1() const
BpsGraphicsLineItem(QGraphicsItem *aParent=nullptr)
Constructor for the class.
void setPen(const QPen &aPen)
Set a new pen value.
void setP2(const QPointF &aPoint)
Set point 2.
void setLine(const QLineF &aLine)
Set new line parameters for the item.
Pixmap item.
Definition: bpsgraphicsitem.h:530
void setSizing(Sizing aSizing)
Set new sizing mode.
Bps::Rotation rotation() const
void setAlignment(Bps::Alignment aAlignment)
Set new alignment.
QRectF rect() const
BpsGraphicsPixmapItem(QGraphicsItem *aParent=nullptr)
Constructor for the class.
Bps::Alignment alignment() const
void setRect(const QRectF &aRect)
Set a new rectangle for the item.
Sizing sizing() const
QPixmap pixmap() const
void setRotation(Bps::Rotation aRotation)
Set new rotation.
void setPixmap(const QPixmap &aPixmap)
Set the current pixmap.
Sizing
Sizing mode.
Definition: bpsgraphicsitem.h:538
@ SizeFixed
Size to fixed pixel per inch (ppi), clipping overflow.
Definition: bpsgraphicsitem.h:539
@ SizeFit
Scale to fit into rectangle keeping aspect, no larger than original size (default)
Definition: bpsgraphicsitem.h:540
void setPpi(int aPpi)
Set new pixel per inch value.
Rectangle item with roundness.
Definition: bpsgraphicsitem.h:333
void setRect(const QRectF &aRect)
Set a new rectangle for the item.
void setRoundness(int aRoundness)
Define a new roundness for the rectangle corners.
BpsGraphicsRectItem(QGraphicsItem *aParent=nullptr)
Constructor for the class.
int roundness() const
QRectF rect() const
Rich text item, based on QTextDocument.
Definition: bpsgraphicsitem.h:136
void setPlainText(const QString &aText)
Set new content as plain text.
void setDirection(Bps::Direction aDirection)
Set the new text direction.
QString toHtml() const
void setRoundness(int aRoundness)
Define a new roundness for the rectangle corners.
void setDefaultFont(const QFont &aFont)
Set a new default fond.
void setResolution(int aResolution)
Set the new resolution in DPI.
qreal textWidth() const
Bps::Direction direction() const
BpsGraphicsRichtextItem(QGraphicsItem *aParent=nullptr)
Constructor for the class.
QFont defaultFont() const
QRectF handleRect() const
void setHtml(const QString &aText)
Set new content as html code.
QString toPlainText() const
BpsMargins margins() const
void setTextWidth(qreal aWidth)
Set the new text width.
void setMargins(const BpsMargins &aMargins)
Set new margins.
Simple text item.
Definition: bpsgraphicsitem.h:19
void setMargins(const BpsMargins &aMargins)
Set new margins.
Bps::Direction direction() const
BpsGraphicsSimpletextItem(QGraphicsItem *aParent=nullptr)
Constructor for the class.
void setAlignment(Bps::Alignment aAlignment)
Set new alignment withing the bounding rectangle.
Bps::Alignment alignment() const
void setRoundness(int aRoundness)
Define a new roundness for the rectangle corners.
void setRect(const QRectF &aRect)
Set a new rectangle for the item.
void setText(const QString &aText)
Set a new text.
void setDirection(Bps::Direction aDirection)
Set a new direction.
void setColor(const QColor &aColor)
Set a new text color (default = Qt::black).
BpsMargins margins() const
void setFont(const QFont &aFont)
Set a new font.
Rotation
Rotation in 90 degree steps.
Definition: bps.h:178
Direction
Basic Compass Directions.
Definition: bps.h:168
Alignment
General alignment.
Definition: bps.h:153
Barcode
Type of the bar code construction element.
Definition: bps.h:219
EccLevel
Error correction code level.
Definition: bps.h:200
This class is used to store margins top, right, bottom and left.
Definition: bpsmargins.h:15
virtual QRectF boundingRect() const const=0
virtual bool contains(const QPointF &point) const const
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)=0
virtual QPainterPath shape() const const
virtual int type() const const