QmlMaterial 0.1.0
Loading...
Searching...
No Matches
split_layout_p.hpp
1#pragma once
2
3#include <QList>
4#include <QtGlobal>
5#include <limits>
6#include <optional>
7
8namespace qml_material::split_layout
9{
10struct Pane {
11 qreal implicitSize = 0;
12 std::optional<qreal> preferred;
13 qreal minimum = 0;
14 qreal maximum = std::numeric_limits<qreal>::infinity();
15 qreal handleSize = 0;
16 bool visible = true;
17 bool fill = false;
18};
19
20struct Geometry {
21 qreal preferredSize = 0;
22 qreal position = 0;
23 qreal size = 0;
24 qreal handlePosition = 0;
25 qreal handleSize = 0;
26 bool visible = false;
27 bool handleVisible = false;
28};
29
30struct Result {
31 QList<Geometry> panes;
32 int fillIndex = -1;
33 qreal extent = 0;
34 qreal implicitExtent = 0;
35};
36
37// Axis-independent geometry; the view owns object lifetimes and applies the result.
38Result calculate(const QList<Pane>& panes, qreal available);
39Result reveal(const QList<Pane>& panes, const QList<qreal>& progress,
40 const QList<qreal>& expandedSizes, qreal available);
41struct Resize {
42 int index = -1;
43 qreal size = 0;
44};
45Resize resize(const QList<Pane>& panes, qreal available, int handleIndex, qreal delta);
46bool resizable(const QList<Pane>& panes, qreal available, int handleIndex);
47} // namespace qml_material::split_layout