QmlMaterial 0.1.0
Loading...
Searching...
No Matches
carousel_attached.hpp
1#pragma once
2
3#include <QObject>
4#include <QQmlEngine>
5
6namespace qml_material
7{
8
12class CarouselAttached : public QObject
13{
14 Q_OBJECT
15 QML_ANONYMOUS
16 Q_PROPERTY(qreal itemWidth READ itemWidth NOTIFY geometryChanged FINAL)
17 Q_PROPERTY(qreal itemHeight READ itemHeight NOTIFY geometryChanged FINAL)
18 Q_PROPERTY(qreal maskStart READ maskStart NOTIFY geometryChanged FINAL)
19 Q_PROPERTY(qreal maskEnd READ maskEnd NOTIFY geometryChanged FINAL)
20 Q_PROPERTY(qreal parallaxShift READ parallaxShift NOTIFY geometryChanged FINAL)
21 Q_PROPERTY(qreal visibleFraction READ visibleFraction NOTIFY geometryChanged FINAL)
22 Q_PROPERTY(int sizeClass READ sizeClass NOTIFY geometryChanged FINAL)
23 Q_PROPERTY(int index READ index NOTIFY geometryChanged FINAL)
24 Q_PROPERTY(int carouselCount READ carouselCount NOTIFY contextChanged FINAL)
25 Q_PROPERTY(int carouselOrientation READ carouselOrientation NOTIFY contextChanged FINAL)
26 Q_PROPERTY(int carouselCurrentIndex READ carouselCurrentIndex NOTIFY contextChanged FINAL)
28 Q_PROPERTY(bool isActive READ isActive NOTIFY geometryChanged FINAL)
29 Q_PROPERTY(bool focusRingVisible READ focusRingVisible NOTIFY focusRingChanged FINAL)
30 Q_PROPERTY(bool focusRingInset READ focusRingInset NOTIFY focusRingChanged FINAL)
31
32public:
33 explicit CarouselAttached(QObject* parent = nullptr);
34
35 qreal itemWidth() const;
36 qreal itemHeight() const;
37 qreal maskStart() const;
38 qreal maskEnd() const;
39 qreal parallaxShift() const;
40 qreal visibleFraction() const;
41 int sizeClass() const;
42 int index() const;
43 int carouselCount() const;
44 int carouselOrientation() const;
45 int carouselCurrentIndex() const;
46 bool isActive() const;
47 bool focusRingVisible() const;
48 bool focusRingInset() const;
49
50 void setGeometry(qreal width, qreal height, qreal maskStart, qreal maskEnd, qreal parallaxShift,
51 int sizeClass, int index, bool isActive);
52 void setContext(int count, int orientation, int currentIndex);
53 void setFocusRingState(bool suppressed, bool tabEngaged, bool inset);
54 Q_SIGNAL void geometryChanged();
55 Q_SIGNAL void contextChanged();
56 Q_SIGNAL void focusRingChanged();
57
58private:
59 qreal m_width = 0;
60 qreal m_height = 0;
61 qreal m_mask_start = 0;
62 qreal m_mask_end = 0;
63 qreal m_parallax_shift = 0;
64 int m_size_class = 2;
65 int m_index = -1;
66 int m_carousel_count = 0;
67 int m_orientation = static_cast<int>(Qt::Horizontal);
68 int m_current_index = 0;
69 bool m_is_active = false;
70 bool m_focus_ring_suppressed = true;
71 bool m_tab_focus_engaged = false;
72 bool m_focus_ring_inset = false;
73};
74
75} // namespace qml_material
Attached properties exposed on carousel delegates.
Definition carousel_attached.hpp:13
bool isActive
True when this item is the focal carousel card (title visible).
Definition carousel_attached.hpp:28