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