diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index 6fca5b5..0376655 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -59,7 +59,7 @@ namespace LimeReport{ TextItem::TextItem(QObject *owner, QGraphicsItem *parent) : ContentItemDesignIntf(xmlTag,owner,parent), m_angle(Angle0), m_trimValue(true), m_allowHTML(false), m_allowHTMLInFields(false), m_replaceCarriageReturns(false), m_followTo(""), m_follower(0), m_textIndent(0), - m_textLayoutDirection(Qt::LayoutDirectionAuto), m_hideIfEmpty(false) + m_textLayoutDirection(Qt::LayoutDirectionAuto), m_hideIfEmpty(false), m_fontLetterSpacing(0) { PageItemDesignIntf* pageItem = dynamic_cast(parent); BaseDesignIntf* parentItem = dynamic_cast(parent); @@ -547,6 +547,23 @@ TextItem::TextPtr TextItem::textDocument() const } +int TextItem::fontLetterSpacing() const +{ + return m_fontLetterSpacing; +} + +void TextItem::setFontLetterSpacing(int value) +{ + if (m_fontLetterSpacing != value){ + int oldValue = m_fontLetterSpacing; + m_fontLetterSpacing = value; + QFont curFont = font(); + curFont.setLetterSpacing(QFont::AbsoluteSpacing, m_fontLetterSpacing); + setFont(curFont); + notify("fontLetterSpacing", oldValue, value); + } +} + bool TextItem::hideIfEmpty() const { return m_hideIfEmpty; @@ -969,6 +986,7 @@ void TextItem::setTextItemFont(QFont value) { if (font()!=value){ QFont oldValue = font(); + value.setLetterSpacing(QFont::AbsoluteSpacing, m_fontLetterSpacing); setFont(value); if (!isLoading()) update(); notify("font",oldValue,value); diff --git a/limereport/items/lrtextitem.h b/limereport/items/lrtextitem.h index e57864e..abc1211 100644 --- a/limereport/items/lrtextitem.h +++ b/limereport/items/lrtextitem.h @@ -75,11 +75,12 @@ class TextItem : public LimeReport::ContentItemDesignIntf, IPageInit { Q_PROPERTY(bool watermark READ isWatermark WRITE setWatermark) Q_PROPERTY(bool replaceCRwithBR READ isReplaceCarriageReturns WRITE setReplaceCarriageReturns) Q_PROPERTY(bool hideIfEmpty READ hideIfEmpty WRITE setHideIfEmpty) + Q_PROPERTY(int fontLetterSpacing READ fontLetterSpacing WRITE setFontLetterSpacing) public: - enum AutoWidth{NoneAutoWidth,MaxWordLength,MaxStringLength}; - enum AngleType{Angle0,Angle90,Angle180,Angle270,Angle45,Angle315}; - enum ValueType{Default,DateTime,Double}; + enum AutoWidth{NoneAutoWidth, MaxWordLength, MaxStringLength}; + enum AngleType{Angle0, Angle90, Angle180, Angle270, Angle45, Angle315}; + enum ValueType{Default, DateTime, Double}; void Init(); TextItem(QObject* owner=0, QGraphicsItem* parent=0); @@ -176,6 +177,9 @@ public: bool hideIfEmpty() const; void setHideIfEmpty(bool hideIfEmpty); + int fontLetterSpacing() const; + void setFontLetterSpacing(int fontLetterSpacing); + protected: void updateLayout(); bool isNeedExpandContent() const; @@ -220,7 +224,7 @@ private: qreal m_textIndent; Qt::LayoutDirection m_textLayoutDirection; bool m_hideIfEmpty; - + int m_fontLetterSpacing; }; }