0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-25 00:54:39 +03:00

hideIfEmpty property has been added to BarcodeItem

This commit is contained in:
Arin Alexander 2019-06-28 10:27:09 +03:00
parent d79ca93d32
commit 9a3af52cd7
2 changed files with 32 additions and 15 deletions

View File

@ -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) void BarcodeItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, int maxHeight)
{ {
if (content().isEmpty()) if (content().isEmpty())
@ -338,19 +356,17 @@ void BarcodeItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass
} }
} }
} }
} } else {
else switch(pass){
{ case FirstPass:
switch(pass) setContent(expandUserVariables(content(),pass,NoEscapeSymbols, dataManager));
{ setContent(expandDataFields(content(), NoEscapeSymbols, dataManager));
case FirstPass: break;
setContent(expandUserVariables(content(),pass,NoEscapeSymbols, dataManager)); default:;
setContent(expandDataFields(content(), NoEscapeSymbols, dataManager));
break;
default:;
} }
} }
BaseDesignIntf::updateItemSize(dataManager, pass, maxHeight); BaseDesignIntf::updateItemSize(dataManager, pass, maxHeight);
if (isEmpty() && hideIfEmpty()) setVisible(false);
} }
bool BarcodeItem::isNeedUpdateSize(RenderPass pass) const bool BarcodeItem::isNeedUpdateSize(RenderPass pass) const

View File

@ -53,12 +53,8 @@ class BarcodeItem : public LimeReport::ContentItemDesignIntf {
Q_PROPERTY(InputMode inputMode READ inputMode WRITE setInputMode) Q_PROPERTY(InputMode inputMode READ inputMode WRITE setInputMode)
Q_PROPERTY(bool hideText READ hideText WRITE setHideText) Q_PROPERTY(bool hideText READ hideText WRITE setHideText)
Q_PROPERTY(int option3 READ option3 WRITE setOption3) Q_PROPERTY(int option3 READ option3 WRITE setOption3)
Q_PROPERTY(bool hideIfEmpty READ hideIfEmpty WRITE setHideIfEmpty)
public: 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 { enum BarcodeType {
CODE11 =1, CODE11 =1,
C25MATRIX =2, C25MATRIX =2,
@ -196,6 +192,10 @@ public:
int option3() const; int option3() const;
void setOption3(int option3); void setOption3(int option3);
bool hideIfEmpty() const;
void setHideIfEmpty(bool hideIfEmpty);
bool isEmpty() const;
private: private:
QString m_content; QString m_content;
QString m_datasource; QString m_datasource;
@ -212,6 +212,7 @@ private:
InputMode m_inputMode; InputMode m_inputMode;
bool m_hideText; bool m_hideText;
int m_option3; int m_option3;
bool m_hideIfEmpty;
}; };
} }