16#include <config-kdsme.h>
32#include <QElapsedTimer>
33#include <QFontMetrics>
42 static const QRectF minimumSize(0, 0, 100, 20);
49 const QString label = state->
label();
51 const qreal width = fm.horizontalAdvance(label);
52 const qreal height = fm.height();
72 Q_ASSERT(!boundingRectHint.isEmpty());
73 const QRectF boundingRect = boundingRectHint;
77 const qreal regionLabelHeight = regionLabelMargin + fontHeight + regionLabelMargin;
80 const QPointF offset = QPointF(innerMargin, innerMargin + regionLabelHeight);
81 state->
setWidth(boundingRect.width() + (2 * innerMargin));
82 state->
setHeight(boundingRect.height() + (2 * innerMargin) + regionLabelHeight);
91 , m_layerLayouter(nullptr)
94 , m_properties(nullptr)
96 qCDebug(KDSME_CORE) <<
"Using" << m_layerLayouter <<
"as layouter";
102 m_properties = properties;
105 walker.
walkItems(state, [&](
Element *element) {
return layoutState(element); });
112 auto *state = qobject_cast<State *>(element);
120 boundingRect = m_layerLayouter->
layout(state, m_properties);
122 boundingRect = boundingRectForCollapsedRegion(state, m_properties);
126 boundingRect = boundingRectForCollapsedRegion(state, m_properties);
129 m_regionLayouter->
layoutRegion(state, boundingRect, m_properties);
void setWidth(qreal width)
void setHeight(qreal height)
QRectF layout(State *state, const LayoutProperties *properties) override
LayerwiseLayouter(QObject *parent=nullptr)
QRectF layout(State *state, const LayoutProperties *properties) override
QSizeF regionLabelButtonBoxSize
static bool moveInner(State *state, const QPointF &offset)
Move all direct children of state state by offset offset.
RegionLayouter(QObject *parent=nullptr)
void layoutRegion(State *state, const QRectF &boundingRectHint, const LayoutProperties *properties)
QList< State * > childStates() const
bool walkItems(T item, const VisitFunction &visit)
@ RecursiveWalk
Traverse the children of this item.
QRectF boundingRect(QSGGeometry *geometry)