0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-24 08:34:38 +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{
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();
Init();
}
@ -280,6 +282,20 @@ void TextItem::initText()
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
{
return m_allowHTML;
@ -347,7 +363,7 @@ void TextItem::setAlignment(Qt::Alignment value)
void TextItem::expandContent(DataSourceManager* dataManager, RenderPass pass)
{
QString context=content();
ExpandType expandType = allowHTML()?ReplaceHTMLSymbols:NoEscapeSymbols;
ExpandType expandType = (allowHTML() && !allowHTMLInFields())?ReplaceHTMLSymbols:NoEscapeSymbols;
switch(pass){
case FirstPass:
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 fontColor READ fontColor WRITE setFontColorProperty)
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 allowHTML READ allowHTML WRITE setAllowHTML)
Q_PROPERTY(bool allowHTMLInFields READ allowHTMLInFields WRITE setAllowHTMLInFields)
public:
enum AutoWidth{NoneAutoWidth,MaxWordLength,MaxStringLength};
@ -114,6 +115,9 @@ public:
bool allowHTML() const;
void setAllowHTML(bool allowHTML);
bool allowHTMLInFields() const;
void setAllowHTMLInFields(bool allowHTMLInFields);
protected:
void updateLayout();
bool isNeedExpandContent() const;
@ -135,6 +139,7 @@ private:
int m_foregroundOpacity;
bool m_trimValue;
bool m_allowHTML;
bool m_allowHTMLInFields;
};
}