mirror of
https://github.com/fralx/LimeReport.git
synced 2025-01-12 17:41:03 +03:00
textIndent property has been added to TextItem
This commit is contained in:
parent
6e895e9423
commit
e327c64fed
@ -58,7 +58,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_followTo(""), m_follower(0)
|
m_allowHTMLInFields(false), m_followTo(""), m_follower(0), m_textIndent(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);
|
||||||
@ -447,6 +447,7 @@ TextItem::TextPtr TextItem::textDocument()
|
|||||||
{
|
{
|
||||||
QTextCursor tc = QTextCursor(block);
|
QTextCursor tc = QTextCursor(block);
|
||||||
QTextBlockFormat fmt = block.blockFormat();
|
QTextBlockFormat fmt = block.blockFormat();
|
||||||
|
fmt.setTextIndent(m_textIndent);
|
||||||
|
|
||||||
if(fmt.lineHeight() != m_lineSpacing) {
|
if(fmt.lineHeight() != m_lineSpacing) {
|
||||||
fmt.setLineHeight(m_lineSpacing,QTextBlockFormat::LineDistanceHeight);
|
fmt.setLineHeight(m_lineSpacing,QTextBlockFormat::LineDistanceHeight);
|
||||||
@ -458,6 +459,21 @@ TextItem::TextPtr TextItem::textDocument()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qreal TextItem::textIndent() const
|
||||||
|
{
|
||||||
|
return m_textIndent;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TextItem::setTextIndent(const qreal &textIndent)
|
||||||
|
{
|
||||||
|
if (m_textIndent != textIndent){
|
||||||
|
qreal oldValue = m_textIndent;
|
||||||
|
m_textIndent = textIndent;
|
||||||
|
update();
|
||||||
|
notify("textIndent", oldValue, textIndent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString TextItem::followTo() const
|
QString TextItem::followTo() const
|
||||||
{
|
{
|
||||||
return m_followTo;
|
return m_followTo;
|
||||||
|
@ -69,6 +69,7 @@ class TextItem : public LimeReport::ContentItemDesignIntf, IPageInit {
|
|||||||
Q_PROPERTY(ValueType valueType READ valueType WRITE setValueType)
|
Q_PROPERTY(ValueType valueType READ valueType WRITE setValueType)
|
||||||
Q_PROPERTY(QString followTo READ followTo WRITE setFollowTo)
|
Q_PROPERTY(QString followTo READ followTo WRITE setFollowTo)
|
||||||
Q_PROPERTY(BrushStyle backgroundBrushStyle READ backgroundBrushStyle WRITE setBackgroundBrushStyle)
|
Q_PROPERTY(BrushStyle backgroundBrushStyle READ backgroundBrushStyle WRITE setBackgroundBrushStyle)
|
||||||
|
Q_PROPERTY(qreal textIndent READ textIndent WRITE setTextIndent)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum AutoWidth{NoneAutoWidth,MaxWordLength,MaxStringLength};
|
enum AutoWidth{NoneAutoWidth,MaxWordLength,MaxStringLength};
|
||||||
@ -157,6 +158,9 @@ public:
|
|||||||
|
|
||||||
typedef QSharedPointer<QTextDocument> TextPtr;
|
typedef QSharedPointer<QTextDocument> TextPtr;
|
||||||
|
|
||||||
|
qreal textIndent() const;
|
||||||
|
void setTextIndent(const qreal &textIndent);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void updateLayout();
|
void updateLayout();
|
||||||
bool isNeedExpandContent() const;
|
bool isNeedExpandContent() const;
|
||||||
@ -198,6 +202,7 @@ private:
|
|||||||
ValueType m_valueType;
|
ValueType m_valueType;
|
||||||
QString m_followTo;
|
QString m_followTo;
|
||||||
TextItem* m_follower;
|
TextItem* m_follower;
|
||||||
|
qreal m_textIndent;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user