2 * Copyright (C) 2013, 2014 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17#ifndef ABSTRACTDASHVIEW_H
18#define ABSTRACTDASHVIEW_H
22class QAbstractItemModel;
24#pragma GCC diagnostic push
25#pragma GCC diagnostic ignored "-pedantic"
26#include <private/qqmldelegatemodel_p.h>
28#pragma GCC diagnostic pop
30class AbstractDashView : public QQuickItem
34 Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelChanged)
35 Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged)
36 Q_PROPERTY(qreal columnSpacing READ columnSpacing WRITE setColumnSpacing NOTIFY columnSpacingChanged)
37 Q_PROPERTY(qreal rowSpacing READ rowSpacing WRITE setRowSpacing NOTIFY rowSpacingChanged)
38 Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer NOTIFY cacheBufferChanged)
39 Q_PROPERTY(qreal displayMarginBeginning READ displayMarginBeginning
40 WRITE setDisplayMarginBeginning
41 NOTIFY displayMarginBeginningChanged)
42 Q_PROPERTY(qreal displayMarginEnd READ displayMarginEnd
43 WRITE setDisplayMarginEnd
44 NOTIFY displayMarginEndChanged)
46friend class VerticalJournalTest;
47friend class HorizontalJournalTest;
48friend class OrganicGridTest;
53 QAbstractItemModel *model() const;
54 void setModel(QAbstractItemModel *model);
56 QQmlComponent *delegate() const;
57 void setDelegate(QQmlComponent *delegate);
59 qreal columnSpacing() const;
60 void setColumnSpacing(qreal columnSpacing);
62 qreal rowSpacing() const;
63 void setRowSpacing(qreal rowSpacing);
65 int cacheBuffer() const;
66 void setCacheBuffer(int);
68 qreal displayMarginBeginning() const;
69 void setDisplayMarginBeginning(qreal);
71 qreal displayMarginEnd() const;
72 void setDisplayMarginEnd(qreal);
76 void delegateChanged();
77 void columnSpacingChanged();
78 void rowSpacingChanged();
79 void cacheBufferChanged();
80 void displayMarginBeginningChanged();
81 void displayMarginEndChanged();
87 void updatePolish() override;
88 void componentComplete() override;
90 void releaseItem(QQuickItem *item);
91 void setImplicitHeightDirty();
94 void itemCreated(int modelIndex, QObject *object);
95 void onModelUpdated(const QQmlChangeSet &changeSet, bool reset);
96 void onHeightChanged();
99 void createDelegateModel();
101 bool addVisibleItems(qreal fillFromY, qreal fillToY, bool asynchronous);
102 QQuickItem *createItem(int modelIndex, bool asynchronous);
104 virtual void findBottomModelIndexToAdd(int *modelIndex, qreal *yPos) = 0;
105 virtual void findTopModelIndexToAdd(int *modelIndex, qreal *yPos) = 0;
106 virtual void addItemToView(int modelIndex, QQuickItem *item) = 0;
107 virtual bool removeNonVisibleItems(qreal bufferFromY, qreal bufferToY) = 0;
108 virtual void cleanupExistingItems() = 0;
109 virtual void doRelayout() = 0;
110 virtual void updateItemCulling(qreal visibleFromY, qreal visibleToY) = 0;
111 virtual void calculateImplicitHeight() = 0;
112#if (QT_VERSION < QT_VERSION_CHECK(5, 4, 0))
113 virtual void processModelRemoves(const QVector<QQmlChangeSet::Remove> &removes) = 0;
115 virtual void processModelRemoves(const QVector<QQmlChangeSet::Change> &removes) = 0;
118 QQmlDelegateModel *m_delegateModel;
120 // Index we are waiting because we requested it asynchronously
121 int m_asyncRequestedIndex;
126 qreal m_displayMarginBeginning;
127 qreal m_displayMarginEnd;
128 bool m_needsRelayout;
129 bool m_delegateValidated;
130 bool m_implicitHeightDirty;
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list