/usr/include/libdtk-2.0.7/DWidget/dlistview.h is in libdtkwidget-dev 2.0.7.2-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | /*
* Copyright (C) 2015 ~ 2017 Deepin Technology Co., Ltd.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DLISTVIEW_H
#define DLISTVIEW_H
#include "dtkwidget_global.h"
#include <dobject.h>
#include <QStyledItemDelegate>
#include <QListView>
DWIDGET_BEGIN_NAMESPACE
class DVariantListModel : public QAbstractListModel
{
public:
explicit DVariantListModel(QObject *parent = 0);
int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
bool setData(const QModelIndex &index, const QVariant &value, int role) Q_DECL_OVERRIDE;
bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE;
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE;
private:
QList<QVariant> dataList;
};
class DListViewPrivate;
class LIBDTKWIDGETSHARED_EXPORT DListView : public QListView, public DTK_CORE_NAMESPACE::DObject
{
Q_OBJECT
/// item count.
Q_PROPERTY(int count READ count NOTIFY rowCountChanged)
/// list layout orientation
Q_PROPERTY(Qt::Orientation orientation READ orientation NOTIFY orientationChanged)
public:
explicit DListView(QWidget *parent = 0);
State state() const;
QWidget *getHeaderWidget(int index) const;
QWidget *getFooterWidget(int index) const;
/// return true if rect intersects contentsVisualRect+qMax(cacheBuffer,cacheCount)
bool isActiveRect(const QRect &rect) const;
bool isVisualRect(const QRect &rect) const;
int count() const;
Qt::Orientation orientation() const;
void setModel(QAbstractItemModel *model) Q_DECL_OVERRIDE;
public Q_SLOTS:
bool addItem(const QVariant &data);
bool addItems(const QVariantList &datas);
bool insertItem(int index, const QVariant &data);
bool insertItems(int index, const QVariantList &datas);
bool removeItem(int index);
bool removeItems(int index, int count);
int addHeaderWidget(QWidget *widget);
void removeHeaderWidget(int index);
QWidget *takeHeaderWidget(int index);
int addFooterWidget(QWidget *widget);
void removeFooterWidget(int index);
QWidget *takeFooterWidget(int index);
void setOrientation(QListView::Flow flow, bool wrapping);
void edit(const QModelIndex &index);
Q_SIGNALS:
void rowCountChanged();
void orientationChanged(Qt::Orientation orientation);
void currentChanged(const QModelIndex &previous);
void triggerEdit(const QModelIndex &index);
protected:
#if(QT_VERSION < 0x050500)
void setViewportMargins(int left, int top, int right, int bottom);
void setViewportMargins(const QMargins &margins);
QMargins viewportMargins() const;
#endif
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
void currentChanged(const QModelIndex ¤t, const QModelIndex &previous) Q_DECL_OVERRIDE;
bool edit(const QModelIndex &index, EditTrigger trigger, QEvent *event) Q_DECL_OVERRIDE;
private:
void setFlow(QListView::Flow flow);
void setWrapping(bool enable);
D_DECLARE_PRIVATE(DListView)
};
DWIDGET_END_NAMESPACE
#endif // DLISTVIEW_H
|