mirror of
https://github.com/fralx/LimeReport.git
synced 2025-01-25 23:51:03 +03:00
fontLetterSpacing property has been added to TextItem
This commit is contained in:
parent
5e7ee21463
commit
356e48bee3
@ -59,7 +59,7 @@ 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_replaceCarriageReturns(false), m_followTo(""), m_follower(0), m_textIndent(0),
|
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<PageItemDesignIntf*>(parent);
|
PageItemDesignIntf* pageItem = dynamic_cast<PageItemDesignIntf*>(parent);
|
||||||
BaseDesignIntf* parentItem = dynamic_cast<BaseDesignIntf*>(parent);
|
BaseDesignIntf* parentItem = dynamic_cast<BaseDesignIntf*>(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
|
bool TextItem::hideIfEmpty() const
|
||||||
{
|
{
|
||||||
return m_hideIfEmpty;
|
return m_hideIfEmpty;
|
||||||
@ -969,6 +986,7 @@ void TextItem::setTextItemFont(QFont value)
|
|||||||
{
|
{
|
||||||
if (font()!=value){
|
if (font()!=value){
|
||||||
QFont oldValue = font();
|
QFont oldValue = font();
|
||||||
|
value.setLetterSpacing(QFont::AbsoluteSpacing, m_fontLetterSpacing);
|
||||||
setFont(value);
|
setFont(value);
|
||||||
if (!isLoading()) update();
|
if (!isLoading()) update();
|
||||||
notify("font",oldValue,value);
|
notify("font",oldValue,value);
|
||||||
|
@ -75,6 +75,7 @@ class TextItem : public LimeReport::ContentItemDesignIntf, IPageInit {
|
|||||||
Q_PROPERTY(bool watermark READ isWatermark WRITE setWatermark)
|
Q_PROPERTY(bool watermark READ isWatermark WRITE setWatermark)
|
||||||
Q_PROPERTY(bool replaceCRwithBR READ isReplaceCarriageReturns WRITE setReplaceCarriageReturns)
|
Q_PROPERTY(bool replaceCRwithBR READ isReplaceCarriageReturns WRITE setReplaceCarriageReturns)
|
||||||
Q_PROPERTY(bool hideIfEmpty READ hideIfEmpty WRITE setHideIfEmpty)
|
Q_PROPERTY(bool hideIfEmpty READ hideIfEmpty WRITE setHideIfEmpty)
|
||||||
|
Q_PROPERTY(int fontLetterSpacing READ fontLetterSpacing WRITE setFontLetterSpacing)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum AutoWidth{NoneAutoWidth, MaxWordLength, MaxStringLength};
|
enum AutoWidth{NoneAutoWidth, MaxWordLength, MaxStringLength};
|
||||||
@ -176,6 +177,9 @@ public:
|
|||||||
bool hideIfEmpty() const;
|
bool hideIfEmpty() const;
|
||||||
void setHideIfEmpty(bool hideIfEmpty);
|
void setHideIfEmpty(bool hideIfEmpty);
|
||||||
|
|
||||||
|
int fontLetterSpacing() const;
|
||||||
|
void setFontLetterSpacing(int fontLetterSpacing);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void updateLayout();
|
void updateLayout();
|
||||||
bool isNeedExpandContent() const;
|
bool isNeedExpandContent() const;
|
||||||
@ -220,7 +224,7 @@ private:
|
|||||||
qreal m_textIndent;
|
qreal m_textIndent;
|
||||||
Qt::LayoutDirection m_textLayoutDirection;
|
Qt::LayoutDirection m_textLayoutDirection;
|
||||||
bool m_hideIfEmpty;
|
bool m_hideIfEmpty;
|
||||||
|
int m_fontLetterSpacing;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user