diff --git a/limereport/items/lrbarcodeitem.cpp b/limereport/items/lrbarcodeitem.cpp index 73ebdae..f7adc02 100644 --- a/limereport/items/lrbarcodeitem.cpp +++ b/limereport/items/lrbarcodeitem.cpp @@ -315,6 +315,24 @@ void BarcodeItem::setOption3(int option3) } } +bool BarcodeItem::hideIfEmpty() const +{ + return m_hideIfEmpty; +} + +void BarcodeItem::setHideIfEmpty(bool hideIfEmpty) +{ + if (m_hideIfEmpty != hideIfEmpty){ + m_hideIfEmpty = hideIfEmpty; + notify("hideIfEmpty",!m_hideIfEmpty, m_hideIfEmpty); + } +} + +bool BarcodeItem::isEmpty() const +{ + return m_content.isEmpty(); +} + void BarcodeItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, int maxHeight) { if (content().isEmpty()) @@ -338,19 +356,17 @@ void BarcodeItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass } } } - } - else - { - switch(pass) - { - case FirstPass: - setContent(expandUserVariables(content(),pass,NoEscapeSymbols, dataManager)); - setContent(expandDataFields(content(), NoEscapeSymbols, dataManager)); - break; - default:; + } else { + switch(pass){ + case FirstPass: + setContent(expandUserVariables(content(),pass,NoEscapeSymbols, dataManager)); + setContent(expandDataFields(content(), NoEscapeSymbols, dataManager)); + break; + default:; } } BaseDesignIntf::updateItemSize(dataManager, pass, maxHeight); + if (isEmpty() && hideIfEmpty()) setVisible(false); } bool BarcodeItem::isNeedUpdateSize(RenderPass pass) const diff --git a/limereport/items/lrbarcodeitem.h b/limereport/items/lrbarcodeitem.h index dafbd34..3badbd5 100644 --- a/limereport/items/lrbarcodeitem.h +++ b/limereport/items/lrbarcodeitem.h @@ -53,12 +53,8 @@ class BarcodeItem : public LimeReport::ContentItemDesignIntf { Q_PROPERTY(InputMode inputMode READ inputMode WRITE setInputMode) Q_PROPERTY(bool hideText READ hideText WRITE setHideText) Q_PROPERTY(int option3 READ option3 WRITE setOption3) + Q_PROPERTY(bool hideIfEmpty READ hideIfEmpty WRITE setHideIfEmpty) 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, -// EAN=13,PDF417=55, TELEPEN_NUM=87,ITF14=89, KIX=90, MICROQR=97, -// EAN14=72,CHANNEL=140,CODEONE=141,GRIDMATRIX=142}; - enum BarcodeType { CODE11 =1, C25MATRIX =2, @@ -196,6 +192,10 @@ public: int option3() const; void setOption3(int option3); + bool hideIfEmpty() const; + void setHideIfEmpty(bool hideIfEmpty); + bool isEmpty() const; + private: QString m_content; QString m_datasource; @@ -212,6 +212,7 @@ private: InputMode m_inputMode; bool m_hideText; int m_option3; + bool m_hideIfEmpty; }; }