#include "CSchemeItem.h" #include "CRectItem.h" #include "CTextItem.h" #include "CLineItem.h" CSchemeItem::CSchemeItem(const QString text, QObject *parent) : QObject(parent) { m_rectItem = new CRectItem(); m_textItem = new CTextItem(text, m_rectItem); m_lineItem = new CLineItem(m_rectItem); m_lineItem->setShowArrow(true); setMinHeight(100); m_textItem->setAllowEdit(false); } CRectItem *CSchemeItem::rectItem() const { return m_rectItem; } CTextItem *CSchemeItem::textItem() const { return m_textItem; } CLineItem *CSchemeItem::lineItem() const { return m_lineItem; } qreal CSchemeItem::xMargin() const { return m_xMargin; } void CSchemeItem::setXMargin(qreal x) { m_xMargin = x; } qreal CSchemeItem::yMargin() const { return m_yMargin; } void CSchemeItem::setYMargin(qreal y) { m_yMargin = y; } qreal CSchemeItem::minWidth() const { return m_minWidth; } void CSchemeItem::setMinWidth(qreal w) { m_minWidth = w; } qreal CSchemeItem::minHeight() const { return m_minHeight; } void CSchemeItem::setMinHeight(qreal h) { m_minHeight = h; } qreal CSchemeItem::textWidth() const { return m_textItem->boundingRect().width(); } qreal CSchemeItem::textHeight() const { return m_textItem->boundingRect().height(); } qreal CSchemeItem::borderWidth() const { return std::max(textWidth() + m_xMargin * 2, m_minWidth); } qreal CSchemeItem::borderHeight() const { return std::max(textHeight() + m_yMargin * 2, m_minHeight); }