Loading...
Searching...
No Matches
GraphicsLayout.hpp
1#pragma once
2#include <score/graphics/RectItem.hpp>
3
4namespace score
5{
6struct BrushSet;
7class SCORE_LIB_BASE_EXPORT GraphicsLayout : public score::BackgroundItem
8{
9public:
10 explicit GraphicsLayout(QGraphicsItem* parent);
12
13 virtual void layout();
14 virtual void centerContent();
15
16 void setBrush(score::BrushSet& b);
17 void setBackground(const QString& b);
19 bool hasBackground() const noexcept { return m_bg || m_pix; }
20 void setMargin(qreal m);
21 void setPadding(qreal p);
22
24 void setSpacing(qreal s);
25 qreal spacing() const noexcept;
26
29 void setAlignment(Qt::Alignment a);
30 Qt::Alignment alignment() const noexcept { return m_alignment; }
31
32 void updateChildrenRects(const QList<QGraphicsItem*>&);
33
36 void setFitMargins(qreal right, qreal bottom);
37
41 static void relayoutAround(QGraphicsItem* item);
42
43 void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
44 override;
45
46protected:
47 score::BrushSet* m_bg{};
48 QPixmap* m_pix{};
49
50 qreal m_margin{};
51 qreal m_padding{};
52 qreal m_spacing{-1.};
53 qreal m_fitRight{-1.};
54 qreal m_fitBottom{-1.};
55 Qt::Alignment m_alignment{};
56};
57
61class SCORE_LIB_BASE_EXPORT FillsWidth
62{
63public:
64 virtual ~FillsWidth();
67 virtual void fillWidth(qreal width) = 0;
68};
69
72SCORE_LIB_BASE_EXPORT
73qreal alignedOffset(Qt::Alignment a, qreal avail, qreal w) noexcept;
74
75}
Definition RectItem.hpp:110
Definition GraphicsLayout.hpp:62
virtual void fillWidth(qreal width)=0
Definition GraphicsLayout.hpp:8
bool hasBackground() const noexcept
Whether the layout paints a box of its own.
Definition GraphicsLayout.hpp:19
Base toolkit upon which the software is built.
Definition Application.cpp:83
qreal alignedOffset(Qt::Alignment a, qreal avail, qreal w) noexcept
Definition GraphicsLayout.cpp:65
Definition Skin.hpp:25