2 * Copyright (C) 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/>.
20#include "abstractdashview.h"
22 /** An Organic Grid is is a view that creates delegates
23 * based on a model and layouts them in groups of six items (called module).
25 * In each module there are 4 items that are forced to the small delegate size
26 * and two that are forced to the big delegate size.
39 * Modules are positioned one after the other in a grid like fashion, i.e.
49class OrganicGrid : public AbstractDashView
53 Q_PROPERTY(QSizeF smallDelegateSize READ smallDelegateSize WRITE setSmallDelegateSize NOTIFY smallDelegateSizeChanged)
54 Q_PROPERTY(QSizeF bigDelegateSize READ bigDelegateSize WRITE setBigDelegateSize NOTIFY bigDelegateSizeChanged)
56friend class OrganicGridTest;
61 QSizeF smallDelegateSize() const;
62 void setSmallDelegateSize(const QSizeF &size);
64 QSizeF bigDelegateSize() const;
65 void setBigDelegateSize(const QSizeF &size);
68 void smallDelegateSizeChanged();
69 void bigDelegateSizeChanged();
71 QPointF positionForIndex(int modelIndex) const;
72 QSizeF sizeForIndex(int modelIndex) const;
74 void findBottomModelIndexToAdd(int *modelIndex, qreal *yPos) override;
75 void findTopModelIndexToAdd(int *modelIndex, qreal *yPos) override;
76 void addItemToView(int modelIndex, QQuickItem *item) override;
77 bool removeNonVisibleItems(qreal bufferFromY, qreal bufferToY) override;
78 void cleanupExistingItems() override;
79 void doRelayout() override;
80 void updateItemCulling(qreal visibleFromY, qreal visibleToY) override;
81 void calculateImplicitHeight() override;
82#if (QT_VERSION < QT_VERSION_CHECK(5, 4, 0))
83 void processModelRemoves(const QVector<QQmlChangeSet::Remove> &removes) override;
85 void processModelRemoves(const QVector<QQmlChangeSet::Change> &removes) override;
88 QSizeF m_smallDelegateSize;
89 QSizeF m_bigDelegateSize;
90 int m_firstVisibleIndex;
91 int m_numberOfModulesPerRow;
92 QList<QQuickItem*> m_visibleItems;
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