0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-10-01 11:31:10 +03:00

Vertical Layout has been added

This commit is contained in:
Arin Alexander
2018-06-21 14:29:00 +03:00
parent 1a189054f7
commit 5b818a4a15
22 changed files with 1029 additions and 467 deletions

View File

@@ -62,7 +62,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_textLayoutDirection(Qt::LayoutDirectionAuto), m_hideIfEmpty(false)
{
PageItemDesignIntf* pageItem = dynamic_cast<PageItemDesignIntf*>(parent);
BaseDesignIntf* parentItem = dynamic_cast<BaseDesignIntf*>(parent);
@@ -115,6 +115,11 @@ void TextItem::preparePopUpMenu(QMenu &menu)
action = menu.addAction(tr("Watermark"));
action->setCheckable(true);
action->setChecked(isWatermark());
action = menu.addAction(tr("Hide if empty"));
action->setCheckable(true);
action->setChecked(hideIfEmpty());
}
void TextItem::processPopUpAction(QAction *action)
@@ -144,6 +149,10 @@ void TextItem::processPopUpAction(QAction *action)
if (action->text().compare(tr("Watermark")) == 0){
page()->setPropertyToSelectedItems("watermark",action->isChecked());
}
if (action->text().compare(tr("Hide if empty")) == 0){
page()->setPropertyToSelectedItems("hideIfEmpty",action->isChecked());
}
}
void TextItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* style, QWidget* widget) {
@@ -329,6 +338,7 @@ void TextItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, i
}
}
BaseDesignIntf::updateItemSize(dataManager, pass, maxHeight);
if (isEmpty() && hideIfEmpty()) setVisible(false);
}
void TextItem::updateLayout()
@@ -538,6 +548,19 @@ TextItem::TextPtr TextItem::textDocument() const
}
bool TextItem::hideIfEmpty() const
{
return m_hideIfEmpty;
}
void TextItem::setHideIfEmpty(bool hideEmpty)
{
if (m_hideIfEmpty != hideEmpty){
m_hideIfEmpty = hideEmpty;
notify("hideIfEmpty",!m_hideIfEmpty, m_hideIfEmpty);
}
}
bool TextItem::isReplaceCarriageReturns() const
{
return m_replaceCarriageReturns;