2 * Copyright (C) 2013 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 VERTICALJOURNAL_H
18#define VERTICALJOURNAL_H
20#include "abstractdashview.h"
22 /** A vertical journal is a view that creates delegates
23 * based on a model and layouts them in columns following
24 * a top-left most position rule.
26 * The number of columns is calculated using the width of
27 * the view itself, the columnWidth (i.e. the width of each individual delegate)
28 * and the columnSpacing between columns.
30 * All delegates are forced to columnWidth if they don't have it.
32 * The first nColumns items are layouted at row 0 from column 0
33 * to column nColumns-1 in order. After that every new item
34 * is positioned in the column which provides the free topmost
35 * position as possible. If more than one column tie in providing
36 * the topmost free position the leftmost column will be used.
40 * +-----+ +-----+ +-----+
46 * +-----+ | 4 | +-----+
54class VerticalJournal : public AbstractDashView
58 Q_PROPERTY(qreal columnWidth READ columnWidth WRITE setColumnWidth NOTIFY columnWidthChanged)
60friend class VerticalJournalTest;
65 qreal columnWidth() const;
66 void setColumnWidth(qreal columnWidth);
69 void columnWidthChanged();
75 ViewItem(QQuickItem *item, int modelIndex) : m_item(item), m_modelIndex(modelIndex) {}
76 qreal x() const { return m_item->x(); }
77 qreal y() const { return m_item->y(); }
78 qreal height() const { return m_item->height(); }
79 bool operator<(const ViewItem &v) const { return m_modelIndex < v.m_modelIndex; }
85 void findBottomModelIndexToAdd(int *modelIndex, qreal *yPos) override;
86 void findTopModelIndexToAdd(int *modelIndex, qreal *yPos) override;
87 bool removeNonVisibleItems(qreal bufferFromY, qreal bufferToY) override;
88 void addItemToView(int modelIndex, QQuickItem *item) override;
89 void cleanupExistingItems() override;
90 void calculateImplicitHeight() override;
91 void doRelayout() override;
92 void updateItemCulling(qreal visibleFromY, qreal visibleToY) override;
93#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
94 void processModelRemoves(const QVector<QQuickChangeSet::Remove> &removes) override;
96 void processModelRemoves(const QVector<QQmlChangeSet::Remove> &removes) override;
99 QVector<QList<ViewItem>> m_columnVisibleItems;
100 QHash<int, int> m_indexColumnMap;
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