1/*
2 * SPDX-FileCopyrightText: 2019 Marco Martin <mart@kde.org>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7#pragma once
8
9#include <QObject>
10#include <QPointer>
11#include <QQuickItem>
12#include <QVariant>
13
14class ContentItem;
15class ColumnView;
16
17class ScrollIntentionEvent : public QObject
18{
19 Q_OBJECT
20 Q_PROPERTY(QPointF delta MEMBER delta CONSTANT FINAL)
21 Q_PROPERTY(bool accepted MEMBER accepted FINAL)
22public:
23 ScrollIntentionEvent()
24 {
25 }
26 ~ScrollIntentionEvent() override
27 {
28 }
29
30 QPointF delta;
31 bool accepted = false;
32};
33
34class ColumnViewAttached : public QObject
35{
36 Q_OBJECT
37
38 /*!
39 * \qmlattachedproperty int ColumnView::index
40 *
41 * The index position of the column in the view, starting from 0
42 */
43 Q_PROPERTY(int index READ index WRITE setIndex NOTIFY indexChanged FINAL)
44
45 /*!
46 * \qmlattachedproperty bool ColumnView::fillWidth
47 *
48 * If true, the column will expand to take the whole viewport space minus reservedSpace
49 */
50 Q_PROPERTY(bool fillWidth READ fillWidth WRITE setFillWidth NOTIFY fillWidthChanged FINAL)
51
52 /*!
53 * \qmlattachedproperty real ColumnView::reservedSpace
54 *
55 * When a column is fillWidth, it will keep reservedSpace amount of pixels from going to fill the full viewport width
56 */
57 Q_PROPERTY(qreal reservedSpace READ reservedSpace WRITE setReservedSpace NOTIFY reservedSpaceChanged FINAL)
58
59 /*!
60 * \qmlattachedproperty real ColumnView::minimumWidth
61 *
62 * When a column is interactiveResizeEnabled, when resizing manually it will bound
63 * the column size between minimumWidth and maximumWidth
64 *
65 * \since 6.16
66 */
67 Q_PROPERTY(qreal minimumWidth READ minimumWidth WRITE setMinimumWidth NOTIFY minimumWidthChanged FINAL)
68
69 /*!
70 * \qmlattachedproperty real ColumnView::preferredWidth
71 *
72 * When we are in DynamicColumns mode, the columns will be resized to preferredWidth.
73 * When the column are resized with the mouse, this propoerty will be updated by the drag
74 * And will always be between minimumWidth and maximumWidth
75 *
76 * \since 6.16
77 */
78 Q_PROPERTY(qreal preferredWidth READ preferredWidth WRITE setPreferredWidth NOTIFY preferredWidthChanged FINAL)
79
80 /*!
81 * \qmlattachedproperty real ColumnView::maximumWidth
82 *
83 * When a column is interactiveResizeEnabled, when resizing manually it will bound
84 * the column size between minimumWidth and maximumWidth
85 *
86 * \since 6.16
87 */
88 Q_PROPERTY(qreal maximumWidth READ maximumWidth WRITE setMaximumWidth NOTIFY maximumWidthChanged FINAL)
89
90 /*!
91 * \qmlattachedproperty bool ColumnView::preventStealing
92 *
93 * Like the same property of MouseArea, when this is true, the column view won't
94 * try to manage events by itself when filtering from a child, not
95 * disturbing user interaction
96 */
97 Q_PROPERTY(bool preventStealing READ preventStealing WRITE setPreventStealing NOTIFY preventStealingChanged FINAL)
98
99 /*!
100 * \qmlattachedproperty bool ColumnView::pinned
101 *
102 * If true the page will never go out of view, but will stay either
103 * at the right or left side of the ColumnView
104 */
105 Q_PROPERTY(bool pinned READ isPinned WRITE setPinned NOTIFY pinnedChanged FINAL)
106
107 /*!
108 * \qmlattachedproperty ColumnView ColumnView::view
109 * \readonly
110 *
111 * The view this column belongs to
112 */
113 Q_PROPERTY(ColumnView *view READ view NOTIFY viewChanged FINAL)
114
115 /*!
116 * \qmlattachedproperty bool ColumnView::inViewport
117 * \readonly
118 *
119 * True if this column is at least partly visible in the ColumnView's viewport.
120 * \since 5.77
121 */
122 Q_PROPERTY(bool inViewport READ inViewport NOTIFY inViewportChanged FINAL)
123
124 /*!
125 * \qmlattachedproperty bool ColumnView::interactiveResizeEnabled
126 *
127 * True if this column supports interactive resize with mouse.
128 *
129 * If the sizes should be saved and restored on application startup,
130 * it is the application responsibility to implement this, for instance exposing
131 * and object with properties for the desired column widths which
132 * reads and writes to the config. at the main Component.onCompleted of the
133 * ApplicationWindow root Item it will apply the preferred sizes of the desired pages.
134 *
135 * The property will be written at interactiveResizingChanged signal handler.
136 *
137 * \since 6.16
138 */
139 Q_PROPERTY(bool interactiveResizeEnabled READ interactiveResizeEnabled WRITE setInteractiveResizeEnabled NOTIFY interactiveResizeEnabledChanged)
140
141 /*!
142 * \qmlattachedproperty bool ColumnView::interactiveResizing
143 *
144 * True when the user is actively resizing a column with the mouse.
145 * If the application wants to write the column sizes to config,
146 * it can sync to some global object property at interactiveResizingChanged:
147 * \qml
148 * Kirigami.ColumnView.onInteractiveResizingChanged: {
149 * if (!Kirigami.ColumnView.interactiveResizing) {
150 * myAppObject.leftColumnWidth = page.implicitWidth;
151 * }
152 * }
153 * \endqml
154 * \since 6.16
155 */
156 Q_PROPERTY(bool interactiveResizing READ interactiveResizing WRITE setInteractiveResizing NOTIFY interactiveResizingChanged)
157
158 /*!
159 * \qmlattachedproperty Item ColumnView::globalHeader
160 */
161 Q_PROPERTY(QQuickItem *globalHeader READ globalHeader WRITE setGlobalHeader NOTIFY globalHeaderChanged FINAL)
162
163 /*!
164 * \qmlattachedproperty Item ColumnView::globalFooter
165 */
166 Q_PROPERTY(QQuickItem *globalFooter READ globalFooter WRITE setGlobalFooter NOTIFY globalFooterChanged FINAL)
167
168public:
169 ColumnViewAttached(QObject *parent = nullptr);
170 ~ColumnViewAttached() override;
171
172 void setIndex(int index);
173 int index() const;
174
175 void setFillWidth(bool fill);
176 bool fillWidth() const;
177
178 qreal reservedSpace() const;
179 void setReservedSpace(qreal space);
180
181 qreal minimumWidth() const;
182 void setMinimumWidth(qreal space);
183
184 qreal preferredWidth() const;
185 void setPreferredWidth(qreal space);
186
187 qreal maximumWidth() const;
188 void setMaximumWidth(qreal space);
189
190 ColumnView *view();
191 void setView(ColumnView *view);
192
193 // Private API, not for QML use
194 QQuickItem *originalParent() const;
195 void setOriginalParent(QQuickItem *parent);
196
197 bool shouldDeleteOnRemove() const;
198 void setShouldDeleteOnRemove(bool del);
199
200 bool preventStealing() const;
201 void setPreventStealing(bool prevent);
202
203 bool isPinned() const;
204 void setPinned(bool pinned);
205
206 bool inViewport() const;
207 void setInViewport(bool inViewport);
208
209 bool interactiveResizeEnabled() const;
210 void setInteractiveResizeEnabled(bool interactive);
211
212 bool interactiveResizing() const;
213 void setInteractiveResizing(bool interactive);
214
215 QQuickItem *globalHeader() const;
216 void setGlobalHeader(QQuickItem *header);
217
218 QQuickItem *globalFooter() const;
219 void setGlobalFooter(QQuickItem *footer);
220
221Q_SIGNALS:
222 void indexChanged();
223 void fillWidthChanged();
224 void reservedSpaceChanged();
225 void minimumWidthChanged();
226 void preferredWidthChanged();
227 void maximumWidthChanged();
228 void viewChanged();
229 void preventStealingChanged();
230 void pinnedChanged();
231 void scrollIntention(ScrollIntentionEvent *event);
232 void inViewportChanged();
233 void interactiveResizeEnabledChanged();
234 void interactiveResizingChanged();
235 void globalHeaderChanged(QQuickItem *oldHeader, QQuickItem *newHeader);
236 void globalFooterChanged(QQuickItem *oldFooter, QQuickItem *newFooter);
237
238private:
239 int m_index = -1;
240 bool m_fillWidth = false;
241 qreal m_reservedSpace = 0;
242 qreal m_minimumWidth = -1;
243 qreal m_preferredWidth = -1;
244 qreal m_maximumWidth = -1;
245 QPointer<ColumnView> m_view;
246 QPointer<QQuickItem> m_originalParent;
247 bool m_customFillWidth = false;
248 bool m_customReservedSpace = false;
249 bool m_shouldDeleteOnRemove = true;
250 bool m_preventStealing = false;
251 bool m_pinned = false;
252 bool m_inViewport = false;
253 bool m_interactiveResizeEnabled = false;
254 bool m_interactiveResizing = false;
255 QPointer<QQuickItem> m_globalHeader;
256 QPointer<QQuickItem> m_globalFooter;
257};
258
259/*!
260 * \qmltype ColumnView
261 * \inqmlmodule org.kde.kirigami.layouts
262 *
263 * \brief A container that lays out items horizontally in a row.
264 *
265 * When not all items fit in the ColumnView, it will behave like a Flickable and will be a scrollable view which shows only a determined number of columns.
266 *
267 * The columns can either all have the same fixed size (recommended),
268 * size themselves with implicitWidth, or automatically expand to take all the available width: by default the last column will always be the expanding one.
269 *
270 * Items inside the ColumnView can access info of the view and set layouting hints via the ColumnView attached property.
271 *
272 * This is the base for the implementation of PageRow.
273 * \since 2.7
274 */
275class ColumnView : public QQuickItem
276{
277 Q_OBJECT
278 QML_ELEMENT
279 QML_ATTACHED(ColumnViewAttached)
280
281 /*!
282 * \qmlproperty enumeration ColumnView::columnResizeMode
283 *
284 * The strategy to follow while automatically resizing the columns
285 *
286 * \qmlenumeratorsfrom ColumnView::ColumnResizeMode
287 *
288 * The default is FixedColumns.
289 */
290 Q_PROPERTY(ColumnResizeMode columnResizeMode READ columnResizeMode WRITE setColumnResizeMode NOTIFY columnResizeModeChanged FINAL)
291
292 /*!
293 * \qmlproperty real ColumnView::columnWidth
294 *
295 * The width of all columns when columnResizeMode is FixedColumns
296 */
297 Q_PROPERTY(qreal columnWidth READ columnWidth WRITE setColumnWidth NOTIFY columnWidthChanged FINAL)
298
299 /*!
300 * \qmlproperty int ColumnView::count
301 * \readonly
302 *
303 * How many columns this view contains
304 */
305 Q_PROPERTY(int count READ count NOTIFY countChanged FINAL)
306
307 /*!
308 * \qmlproperty int ColumnView::currentIndex
309 *
310 * The position of the currently active column. The current column will also have keyboard focus
311 */
312 Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged FINAL)
313
314 /*!
315 * \qmlproperty Item ColumnView::currentItem
316 * \readonly
317 *
318 * The currently active column. The current column will also have keyboard focus
319 */
320 Q_PROPERTY(QQuickItem *currentItem READ currentItem NOTIFY currentItemChanged FINAL)
321
322 /*!
323 * \qmlproperty Item ColumnView::contentItem
324 * \readonly
325 *
326 * The main content item of this view: it's the parent of the column items
327 */
328 Q_PROPERTY(QQuickItem *contentItem READ contentItem CONSTANT FINAL)
329
330 /*!
331 * \qmlproperty real ColumnView::contentX
332 *
333 * The value of the horizontal scroll of the view, in pixels
334 */
335 Q_PROPERTY(qreal contentX READ contentX WRITE setContentX NOTIFY contentXChanged FINAL)
336
337 /*!
338 * \qmlproperty real ColumnView::contentWidth
339 * \readonly
340 *
341 * The compound width of all columns in the view
342 */
343 Q_PROPERTY(qreal contentWidth READ contentWidth NOTIFY contentWidthChanged FINAL)
344
345 /*!
346 * \qmlproperty real ColumnView::topPadding
347 *
348 * The padding this will have at the top
349 */
350 Q_PROPERTY(qreal topPadding READ topPadding WRITE setTopPadding NOTIFY topPaddingChanged FINAL)
351
352 /*!
353 * \qmlproperty real ColumnView::bottomPadding
354 *
355 * The padding this will have at the bottom
356 */
357 Q_PROPERTY(qreal bottomPadding READ bottomPadding WRITE setBottomPadding NOTIFY bottomPaddingChanged FINAL)
358
359 /*!
360 * \qmlproperty int ColumnView::scrollDuration
361 *
362 * The duration for scrolling animations
363 */
364 Q_PROPERTY(int scrollDuration READ scrollDuration WRITE setScrollDuration NOTIFY scrollDurationChanged FINAL)
365
366 /*!
367 * \qmlproperty bool ColumnView::separatorVisible
368 *
369 * True if columns should be visually separated by a separator line
370 */
371 Q_PROPERTY(bool separatorVisible READ separatorVisible WRITE setSeparatorVisible NOTIFY separatorVisibleChanged FINAL)
372
373 /*!
374 * \qmlproperty list<QtObject> ColumnView::visibleItems
375 * \readonly
376 *
377 * The list of all visible column items that are at least partially in the viewport at any given moment
378 */
379 Q_PROPERTY(QList<QQuickItem *> visibleItems READ visibleItems NOTIFY visibleItemsChanged FINAL)
380
381 /*!
382 * \qmlproperty Item ColumnView::leadingVisibleItem
383 * \readonly
384 *
385 * The first of visibleItems provided from convenience
386 */
387 Q_PROPERTY(QQuickItem *leadingVisibleItem READ leadingVisibleItem NOTIFY leadingVisibleItemChanged FINAL)
388
389 /*!
390 * \qmlproperty Item ColumnView::trailingVisibleItem
391 * \readonly
392 *
393 * The last of visibleItems provided from convenience
394 */
395 Q_PROPERTY(QQuickItem *trailingVisibleItem READ trailingVisibleItem NOTIFY trailingVisibleItemChanged FINAL)
396
397 // Properties to make it similar to Flickable
398 /*!
399 * \qmlproperty bool ColumnView::dragging
400 * \readonly
401 *
402 * True when the user is dragging around with touch gestures the view contents
403 */
404 Q_PROPERTY(bool dragging READ dragging NOTIFY draggingChanged FINAL)
405
406 /*!
407 * \qmlproperty bool ColumnView::moving
408 * \readonly
409 *
410 * True both when the user is dragging around with touch gestures the view contents or the view is animating
411 */
412 Q_PROPERTY(bool moving READ moving NOTIFY movingChanged FINAL)
413
414 /*!
415 * \qmlproperty bool ColumnView::interactive
416 *
417 * True if it supports moving the contents by dragging
418 */
419 Q_PROPERTY(bool interactive READ interactive WRITE setInteractive NOTIFY interactiveChanged FINAL)
420
421 /*!
422 * \deprecated \qmlproperty bool ColumnView::acceptsMouse
423 *
424 * This property is deprecated and doesn't have any effect
425 */
426 Q_PROPERTY(bool acceptsMouse READ acceptsMouse WRITE setAcceptsMouse NOTIFY acceptsMouseChanged FINAL)
427
428 // Default properties
429 /*!
430 * \qmlproperty list<Item> ColumnView::contentChildren
431 *
432 * Every column item the view contains
433 */
434 Q_PROPERTY(QQmlListProperty<QQuickItem> contentChildren READ contentChildren NOTIFY contentChildrenChanged FINAL)
435 /*!
436 * \qmlproperty list<QtObject> ColumnView::contentData
437 * \qmldefault
438 *
439 * every item declared inside the view, both visual and non-visual items
440 */
441 Q_PROPERTY(QQmlListProperty<QObject> contentData READ contentData FINAL)
442
443 /*!
444 * \qmlproperty string ColumnView::savedState
445 *
446 * A JSon serialization of the columns widths.
447 * When columnResizeMode is DynamicColumns, columns can be resized via mouse.
448 * When this is the case, the sizes should be saved and restored on application startup.
449 *
450 * Example code for saving and restore, assuming that the application exposes a singleton
451 * called App that has a "columnViewState" property that reads and writes to the config file:
452 *
453 * \qml
454 * Component.onCompleted: pageStack.columnView.savedState = App.columnViewState;
455 * columnView.onSavedStateChanged: {
456 * App.columnViewState = pageStack.columnView.savedState;
457 * }
458 * \endqml
459 */
460 Q_PROPERTY(QString savedState READ savedState WRITE setSavedState NOTIFY savedStateChanged)
461
462 Q_CLASSINFO("DefaultProperty", "contentData")
463
464public:
465 /*!
466 * \value FixedColumns Every column is fixed at the same width of the columnWidth property
467 * \value DynamicColumns Columns take their width from their implicitWidth
468 * \value SingleColumn Only one column at a time is shown, as wide as the viewport, eventual reservedSpace on the column's attached property is ignored
469 */
470 enum ColumnResizeMode {
471 FixedColumns = 0,
472 DynamicColumns,
473 SingleColumn,
474 };
475 Q_ENUM(ColumnResizeMode)
476
477 ColumnView(QQuickItem *parent = nullptr);
478 ~ColumnView() override;
479
480 // QML property accessors
481 ColumnResizeMode columnResizeMode() const;
482 void setColumnResizeMode(ColumnResizeMode mode);
483
484 qreal columnWidth() const;
485 void setColumnWidth(qreal width);
486
487 int currentIndex() const;
488 void setCurrentIndex(int index);
489
490 int scrollDuration() const;
491 void setScrollDuration(int duration);
492
493 bool separatorVisible() const;
494 void setSeparatorVisible(bool visible);
495
496 int count() const;
497
498 qreal topPadding() const;
499 void setTopPadding(qreal padding);
500
501 qreal bottomPadding() const;
502 void setBottomPadding(qreal padding);
503
504 QQuickItem *currentItem();
505
506 QList<QQuickItem *> visibleItems() const;
507 QQuickItem *leadingVisibleItem() const;
508 QQuickItem *trailingVisibleItem() const;
509
510 QQuickItem *contentItem() const;
511
512 QQmlListProperty<QQuickItem> contentChildren();
513 QQmlListProperty<QObject> contentData();
514
515 bool dragging() const;
516 bool moving() const;
517 qreal contentWidth() const;
518
519 qreal contentX() const;
520 void setContentX(qreal x) const;
521
522 bool interactive() const;
523 void setInteractive(bool interactive);
524
525 bool acceptsMouse() const;
526 void setAcceptsMouse(bool accepts);
527
528 /*!
529 * \qmlmethod Item ColumnView::get(int index)
530 *
531 * \brief This method gets the item at index, if available
532 *
533 * Note that if an invalid index is passed (either negative or greater
534 * then depth - 1) nullptr will be returned
535 *
536 * \a index The index of the item to get.
537 * \since 6.16
538 */
539 Q_INVOKABLE QQuickItem *get(int index);
540
541 /*!
542 * \qmlmethod Item ColumnView::pop(var item)
543 *
544 * \brief This method removes all the items after the specified item or
545 * index from the view and returns the last item that was removed.
546 *
547 * Note that if the passed value is neither of the values said below, it
548 * will return a nullptr.
549 *
550 * \a item the item to remove. It can be an item, index or not defined
551 * in which case it will pop the last item.
552 */
553 Q_INVOKABLE QQuickItem *pop(const QVariant &item);
554
555 /*!
556 * \brief This method removes all the items after the specified item from
557 * the view and returns the last item that was removed.
558 *
559 * \sa ::removeItem()
560 *
561 * \a the item where the iteration should stop at
562 *
563 * Returns the last item that has been removed
564 */
565 QQuickItem *pop(QQuickItem *item);
566
567 /*!
568 * \brief This method removes all the items after the specified position
569 * from the view and returns the last item that was removed.
570 *
571 * It starts iterating from the last item to the first item calling
572 * removeItem() for each of them until it reaches the specified position.
573 *
574 * \sa removeItem()
575 *
576 * \a index the position where the iteration should stop at
577 *
578 * Returnss the last item that has been removed
579 */
580 QQuickItem *pop(int index);
581
582 /*!
583 * \qmlmethod Item ColumnView::pop()
584 *
585 * \brief This method removes the last item from the view and returns it.
586 *
587 * This method calls removeItem() on the last item.
588 *
589 * \sa removeItem()
590 *
591 * Returns the removed item
592 */
593 Q_INVOKABLE QQuickItem *pop();
594
595 /*!
596 * \brief This method removes the specified item from the view.
597 *
598 * Items will be reparented to their old parent. If they have JavaScript
599 * ownership and they didn't have an old parent, they will be destroyed.
600 * CurrentIndex may be changed in order to keep the same currentItem
601 *
602 * \a item pointer to the item to remove
603 *
604 * Returns the removed item
605 */
606 QQuickItem *removeItem(QQuickItem *item);
607
608 /*!
609 * \brief This method removes an item at a given index from the view.
610 *
611 * This method calls removeItem(QQuickItem *item) to remove the item at
612 * the specified index.
613 *
614 * \a index the index of the item which should be removed
615 *
616 * Returns the removed item
617 */
618 QQuickItem *removeItem(int index);
619
620 QString savedState();
621 void setSavedState(const QString &state);
622
623 // QML attached property
624 static ColumnViewAttached *qmlAttachedProperties(QObject *object);
625
626public Q_SLOTS:
627 /*!
628 * Pushes a new item at the end of the view
629 *
630 * \a item the new item which will be reparented and managed
631 */
632 void addItem(QQuickItem *item);
633
634 /*!
635 * \qmlmethod Item ColumnView::removeItem(var item)
636 *
637 * \brief This method removes an item from the view.
638 *
639 * If the argument is a number, this method dispatches to removeItem(int index)
640 * to remove an item by its index. Otherwise the argument should be the item
641 * itself to be removed itself, and this method will dispatch to removeItem(QQuickItem *item).
642 *
643 * \a index the index of the item which should be removed, or the item itself
644 *
645 * Returns the removed item
646 */
647 Q_INVOKABLE QQuickItem *removeItem(const QVariant &item);
648
649 /*!
650 * Inserts a new item in the view at a given position.
651 * The current Item will not be changed, currentIndex will be adjusted
652 * accordingly if needed to keep the same current item.
653 *
654 * \a pos the position we want the new item to be inserted in
655 *
656 * \a item the new item which will be reparented and managed
657 */
658 void insertItem(int pos, QQuickItem *item);
659
660 /*!
661 * Replaces an item in the view at a given position with a new item.
662 * The current Item and currentIndex will not be changed.
663 *
664 * \a pos the position we want the new item to be placed in
665 *
666 * \a item the new item which will be reparented and managed
667 */
668 void replaceItem(int pos, QQuickItem *item);
669
670 /*!
671 * Move an item inside the view.
672 * The currentIndex property may be changed in order to keep currentItem the same.
673 *
674 * \a from the old position
675 *
676 * \a to the new position
677 */
678 void moveItem(int from, int to);
679
680 /*!
681 * Removes every item in the view.
682 * Items will be reparented to their old parent.
683 * If they have JavaScript ownership and they didn't have an old parent, they will be destroyed
684 */
685 void clear();
686
687 /*!
688 * Returnss true if the view contains the given item
689 */
690 bool containsItem(QQuickItem *item);
691
692 /*!
693 * Returns the visible item containing the point x, y in content coordinates.
694 * If there is no item at the point specified, or the item is not visible null is returned.
695 */
696 QQuickItem *itemAt(qreal x, qreal y);
697
698protected:
699 void classBegin() override;
700 void componentComplete() override;
701 void updatePolish() override;
702 void itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value) override;
703 void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
704 bool childMouseEventFilter(QQuickItem *item, QEvent *event) override;
705 bool event(QEvent *event) override;
706 void mousePressEvent(QMouseEvent *event) override;
707 void mouseReleaseEvent(QMouseEvent *event) override;
708
709Q_SIGNALS:
710 /*!
711 * \qmlsignal ColumnView::itemInserted(int position, Item item)
712 *
713 * A new item has been inserted
714 *
715 * \a position where the page has been inserted
716 *
717 * \a item a pointer to the new item
718 */
719 void itemInserted(int position, QQuickItem *item);
720
721 /*!
722 * \qmlsignal ColumnView::itemRemoved(Item item)
723 *
724 * An item has just been removed from the view
725 *
726 * \a item a pointer to the item that has just been removed
727 */
728 void itemRemoved(QQuickItem *item);
729
730 // Property notifiers
731 void contentChildrenChanged();
732 void columnResizeModeChanged();
733 void columnWidthChanged();
734 void currentIndexChanged();
735 void currentItemChanged();
736 void visibleItemsChanged();
737 void countChanged();
738 void draggingChanged();
739 void movingChanged();
740 void contentXChanged();
741 void contentWidthChanged();
742 void interactiveChanged();
743 void acceptsMouseChanged();
744 void scrollDurationChanged();
745 void separatorVisibleChanged();
746 void leadingVisibleItemChanged();
747 void trailingVisibleItemChanged();
748 void topPaddingChanged();
749 void bottomPaddingChanged();
750 void savedStateChanged();
751
752private:
753 static void contentChildren_append(QQmlListProperty<QQuickItem> *prop, QQuickItem *object);
754 static qsizetype contentChildren_count(QQmlListProperty<QQuickItem> *prop);
755 static QQuickItem *contentChildren_at(QQmlListProperty<QQuickItem> *prop, qsizetype index);
756 static void contentChildren_clear(QQmlListProperty<QQuickItem> *prop);
757
758 static void contentData_append(QQmlListProperty<QObject> *prop, QObject *object);
759 static qsizetype contentData_count(QQmlListProperty<QObject> *prop);
760 static QObject *contentData_at(QQmlListProperty<QObject> *prop, qsizetype index);
761 static void contentData_clear(QQmlListProperty<QObject> *prop);
762
763 QList<QObject *> m_contentData;
764
765 ContentItem *m_contentItem;
766 QPointer<QQuickItem> m_currentItem;
767 QHash<int, qreal> m_state;
768
769 int m_currentIndex = -1;
770 qreal m_topPadding = 0;
771 qreal m_bottomPadding = 0;
772
773 bool m_interactive = true;
774 // The user is dragging horizontally the ColumnView
775 bool m_dragging = false;
776 // The user is dragging vertically the contents of a page
777 bool m_verticalScrollIntercepted = false;
778 bool m_moving = false;
779 bool m_separatorVisible = true;
780 bool m_complete = false;
781 bool m_acceptsMouse = false;
782};
783
784QML_DECLARE_TYPEINFO(ColumnView, QML_HAS_ATTACHED_PROPERTIES)
785

source code of kirigami/src/layouts/columnview.h