From 517bf8357ef60a47b88f224be372fcd7e008de6d Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 25 Mar 2016 23:46:17 +0300 Subject: [PATCH] InputMode propperty has been added to BarcodeItem --- limereport/items/lrbarcodeitem.cpp | 20 +++++++++++++++++++- limereport/items/lrbarcodeitem.h | 13 +++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/limereport/items/lrbarcodeitem.cpp b/limereport/items/lrbarcodeitem.cpp index 751c16e..3e4531b 100644 --- a/limereport/items/lrbarcodeitem.cpp +++ b/limereport/items/lrbarcodeitem.cpp @@ -48,7 +48,7 @@ namespace LimeReport{ BarcodeItem::BarcodeItem(QObject* owner,QGraphicsItem* parent) : ContentItemDesignIntf(xmlTag,owner,parent),m_designTestValue("1"), m_barcodeType(CODE128), m_foregroundColor(Qt::black), m_backgroundColor(Qt::white), m_whitespace(10), m_angle(Angle0), - m_barcodeWidth(0), m_securityLevel(0), m_pdf417CodeWords(928) + m_barcodeWidth(0), m_securityLevel(0), m_pdf417CodeWords(928), m_inputMode(UNICODE_INPUT_MODE) {} BarcodeItem::~BarcodeItem() @@ -65,6 +65,7 @@ void BarcodeItem::paint(QPainter *ppainter, const QStyleOptionGraphicsItem *opti Zint::QZint bc; if (itemMode() & DesignMode) bc.setText(m_designTestValue); else bc.setText(m_content); + bc.setInputMode(m_inputMode); bc.setSymbol(m_barcodeType); bc.setWhitespace(m_whitespace); bc.setFgColor(m_foregroundColor); @@ -231,6 +232,23 @@ void BarcodeItem::setPdf417CodeWords(int pdf417CodeWords) } } +BarcodeItem::InputMode BarcodeItem::inputMode() const +{ + return m_inputMode; +} + +void BarcodeItem::setInputMode(const InputMode &inputMode) +{ + if (m_inputMode != inputMode){ + InputMode oldValue = m_inputMode; + m_inputMode = inputMode; + if (!isLoading()){ + update(); + notify("inputMode",oldValue,inputMode); + } + } +} + void BarcodeItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, int maxHeight) { switch(pass){ diff --git a/limereport/items/lrbarcodeitem.h b/limereport/items/lrbarcodeitem.h index b79351b..3f56c59 100644 --- a/limereport/items/lrbarcodeitem.h +++ b/limereport/items/lrbarcodeitem.h @@ -38,6 +38,7 @@ class BarcodeItem : public LimeReport::ContentItemDesignIntf { Q_OBJECT Q_ENUMS(BarcodeType) Q_ENUMS(AngleType) + Q_ENUMS(InputMode) Q_PROPERTY(QString content READ content WRITE setContent) Q_PROPERTY(BarcodeType barcodeType READ barcodeType WRITE setBarcodeType ) Q_PROPERTY(QString testValue READ designTestValue WRITE setDesignTestValue) @@ -48,6 +49,7 @@ class BarcodeItem : public LimeReport::ContentItemDesignIntf { Q_PROPERTY(int barcodeWidth READ barcodeWidth WRITE setBarcodeWidth) Q_PROPERTY(int securityLevel READ securityLevel WRITE setSecurityLevel) Q_PROPERTY(int pdf417CodeWords READ pdf417CodeWords WRITE setPdf417CodeWords) + Q_PROPERTY(InputMode inputMode READ inputMode WRITE setInputMode) public: // enum BarcodeType {QRCODE=58,CODE128=20,DATAMATRIX=71,MAXICODE=57,MICROPDF417=84}; // enum BarcodeType {CODE_11=1,C25MATRIX=2,QRCODE=58,CODE128=20,DATAMATRIX=71,MAXICODE=57,MICROPDF417=84, @@ -128,6 +130,13 @@ public: }; enum AngleType{Angle0,Angle90,Angle180,Angle270}; + enum InputMode{ + DATA_INPUT_MODE = 0, + UNICODE_INPUT_MODE = 1, + GS1_INPUT_MODE = 2, + KANJI_INPUT_MODE = 3, + SJIS_INPUT_MODE = 4 + }; BarcodeItem(QObject *owner, QGraphicsItem *parent); ~BarcodeItem(); virtual BaseDesignIntf* createSameTypeItem(QObject *owner, QGraphicsItem *parent); @@ -155,6 +164,9 @@ public: int pdf417CodeWords() const; void setPdf417CodeWords(int pdf417CodeWords); + InputMode inputMode() const; + void setInputMode(const InputMode &inputMode); + private: Zint::QZint m_bc; QString m_content; @@ -167,6 +179,7 @@ private: int m_barcodeWidth; int m_securityLevel; int m_pdf417CodeWords; + InputMode m_inputMode; }; }