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

allowHTMLInFields property has been added

This commit is contained in:
Arin Alexander 2016-04-13 13:38:07 +03:00
parent 166b18be49
commit 166a0ac688
2 changed files with 24 additions and 3 deletions

View File

@ -55,7 +55,9 @@ bool registred = LimeReport::DesignElementsFactory::instance().registerCreator(x
namespace LimeReport{ namespace LimeReport{
TextItem::TextItem(QObject *owner, QGraphicsItem *parent) TextItem::TextItem(QObject *owner, QGraphicsItem *parent)
: ContentItemDesignIntf(xmlTag,owner,parent), m_angle(Angle0), m_trimValue(true), m_allowHTML(false){ : ContentItemDesignIntf(xmlTag,owner,parent), m_angle(Angle0), m_trimValue(true), m_allowHTML(false),
m_allowHTMLInFields(false)
{
m_text = new QTextDocument(); m_text = new QTextDocument();
Init(); Init();
} }
@ -280,6 +282,20 @@ void TextItem::initText()
m_textSize=m_text->size(); m_textSize=m_text->size();
} }
bool TextItem::allowHTMLInFields() const
{
return m_allowHTMLInFields;
}
void TextItem::setAllowHTMLInFields(bool allowHTMLInFields)
{
if (m_allowHTMLInFields != allowHTMLInFields){
m_allowHTMLInFields = allowHTMLInFields;
notify("allowHTMLInFields",!m_allowHTMLInFields,allowHTMLInFields);
update();
}
}
bool TextItem::allowHTML() const bool TextItem::allowHTML() const
{ {
return m_allowHTML; return m_allowHTML;
@ -347,7 +363,7 @@ void TextItem::setAlignment(Qt::Alignment value)
void TextItem::expandContent(DataSourceManager* dataManager, RenderPass pass) void TextItem::expandContent(DataSourceManager* dataManager, RenderPass pass)
{ {
QString context=content(); QString context=content();
ExpandType expandType = allowHTML()?ReplaceHTMLSymbols:NoEscapeSymbols; ExpandType expandType = (allowHTML() && !allowHTMLInFields())?ReplaceHTMLSymbols:NoEscapeSymbols;
switch(pass){ switch(pass){
case FirstPass: case FirstPass:
context=expandUserVariables(context, pass, expandType, dataManager); context=expandUserVariables(context, pass, expandType, dataManager);

View File

@ -55,9 +55,10 @@ class TextItem : public LimeReport::ContentItemDesignIntf {
Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColorProperty) Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColorProperty)
Q_PROPERTY(QColor fontColor READ fontColor WRITE setFontColorProperty) Q_PROPERTY(QColor fontColor READ fontColor WRITE setFontColorProperty)
Q_PROPERTY(AngleType angle READ angle WRITE setAngle) Q_PROPERTY(AngleType angle READ angle WRITE setAngle)
Q_PROPERTY(int foregroundOpacity READ foregroundOpacity WRITE setForegroundOpacity()) Q_PROPERTY(int foregroundOpacity READ foregroundOpacity WRITE setForegroundOpacity)
Q_PROPERTY(bool trimValue READ trimValue WRITE setTrimValue) Q_PROPERTY(bool trimValue READ trimValue WRITE setTrimValue)
Q_PROPERTY(bool allowHTML READ allowHTML WRITE setAllowHTML) Q_PROPERTY(bool allowHTML READ allowHTML WRITE setAllowHTML)
Q_PROPERTY(bool allowHTMLInFields READ allowHTMLInFields WRITE setAllowHTMLInFields)
public: public:
enum AutoWidth{NoneAutoWidth,MaxWordLength,MaxStringLength}; enum AutoWidth{NoneAutoWidth,MaxWordLength,MaxStringLength};
@ -114,6 +115,9 @@ public:
bool allowHTML() const; bool allowHTML() const;
void setAllowHTML(bool allowHTML); void setAllowHTML(bool allowHTML);
bool allowHTMLInFields() const;
void setAllowHTMLInFields(bool allowHTMLInFields);
protected: protected:
void updateLayout(); void updateLayout();
bool isNeedExpandContent() const; bool isNeedExpandContent() const;
@ -135,6 +139,7 @@ private:
int m_foregroundOpacity; int m_foregroundOpacity;
bool m_trimValue; bool m_trimValue;
bool m_allowHTML; bool m_allowHTML;
bool m_allowHTMLInFields;
}; };
} }