Changeset View
Changeset View
Standalone View
Standalone View
src/filewidgets/kcolumnview.h
- This file was added.
| 1 | /**************************************************************************** | ||||
|---|---|---|---|---|---|
| 2 | ** | ||||
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. | ||||
| 4 | ** Contact: https://www.qt.io/licensing/ | ||||
| 5 | ** | ||||
| 6 | ** This file is part of the QtWidgets module of the Qt Toolkit. | ||||
| 7 | ** | ||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | ||||
| 9 | ** Commercial License Usage | ||||
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | ||||
| 11 | ** accordance with the commercial license agreement provided with the | ||||
| 12 | ** Software or, alternatively, in accordance with the terms contained in | ||||
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | ||||
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further | ||||
| 15 | ** information use the contact form at https://www.qt.io/contact-us. | ||||
| 16 | ** | ||||
| 17 | ** GNU Lesser General Public License Usage | ||||
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | ||||
| 19 | ** General Public License version 3 as published by the Free Software | ||||
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | ||||
| 21 | ** packaging of this file. Please review the following information to | ||||
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | ||||
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | ||||
| 24 | ** | ||||
| 25 | ** GNU General Public License Usage | ||||
| 26 | ** Alternatively, this file may be used under the terms of the GNU | ||||
| 27 | ** General Public License version 2.0 or (at your option) the GNU General | ||||
| 28 | ** Public license version 3 or any later version approved by the KDE Free | ||||
| 29 | ** Qt Foundation. The licenses are as published by the Free Software | ||||
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | ||||
| 31 | ** included in the packaging of this file. Please review the following | ||||
| 32 | ** information to ensure the GNU General Public License requirements will | ||||
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | ||||
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | ||||
| 35 | ** | ||||
| 36 | ** $QT_END_LICENSE$ | ||||
| 37 | ** | ||||
| 38 | ****************************************************************************/ | ||||
| 39 | | ||||
| 40 | #ifndef KCOLUMNVIEW_H | ||||
| 41 | #define KCOLUMNVIEW_H | ||||
| 42 | | ||||
| 43 | #include <QAbstractItemView> | ||||
| 44 | | ||||
| 45 | class Q_WIDGETS_EXPORT KColumnView : public QAbstractItemView { | ||||
| 46 | | ||||
| 47 | Q_OBJECT | ||||
| 48 | Q_PROPERTY(bool resizeGripsVisible READ resizeGripsVisible WRITE setResizeGripsVisible) | ||||
| 49 | | ||||
| 50 | Q_SIGNALS: | ||||
| 51 | void updatePreviewWidget(const QModelIndex &index); | ||||
| 52 | | ||||
| 53 | public: | ||||
| 54 | explicit KColumnView(QWidget *parent = Q_NULLPTR); | ||||
| 55 | ~KColumnView(); | ||||
| 56 | | ||||
| 57 | // QAbstractItemView overloads | ||||
| 58 | QModelIndex indexAt(const QPoint &point) const Q_DECL_OVERRIDE; | ||||
| 59 | void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) Q_DECL_OVERRIDE; | ||||
| 60 | QSize sizeHint() const Q_DECL_OVERRIDE; | ||||
| 61 | QRect visualRect(const QModelIndex &index) const Q_DECL_OVERRIDE; | ||||
| 62 | void setModel(QAbstractItemModel *model) Q_DECL_OVERRIDE; | ||||
| 63 | void setSelectionModel(QItemSelectionModel * selectionModel) Q_DECL_OVERRIDE; | ||||
| 64 | void setRootIndex(const QModelIndex &index) Q_DECL_OVERRIDE; | ||||
| 65 | void selectAll() Q_DECL_OVERRIDE; | ||||
| 66 | | ||||
| 67 | /* Shows all columns from the root until index and scrolls to | ||||
| 68 | * the rightmost one. If index hasChildren(), a column with | ||||
| 69 | * index as rootIndex is shown and scrolled to. */ | ||||
| 70 | void showPathTo(const QModelIndex &index); | ||||
| 71 | | ||||
| 72 | // KColumnView functions | ||||
| 73 | void setResizeGripsVisible(bool visible); | ||||
| 74 | bool resizeGripsVisible() const; | ||||
| 75 | | ||||
| 76 | QWidget *previewWidget() const; | ||||
| 77 | void setPreviewWidget(QWidget *widget); | ||||
| 78 | | ||||
| 79 | void setColumnWidths(const QList<int> &list); | ||||
| 80 | QList<int> columnWidths() const; | ||||
| 81 | | ||||
| 82 | protected: | ||||
| 83 | // QAbstractItemView overloads | ||||
| 84 | bool isIndexHidden(const QModelIndex &index) const Q_DECL_OVERRIDE; | ||||
| 85 | QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) Q_DECL_OVERRIDE; | ||||
| 86 | void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE; | ||||
| 87 | void setSelection(const QRect & rect, QItemSelectionModel::SelectionFlags command) Q_DECL_OVERRIDE; | ||||
| 88 | QRegion visualRegionForSelection(const QItemSelection &selection) const Q_DECL_OVERRIDE; | ||||
| 89 | int horizontalOffset() const Q_DECL_OVERRIDE; | ||||
| 90 | int verticalOffset() const Q_DECL_OVERRIDE; | ||||
| 91 | void rowsInserted(const QModelIndex &parent, int start, int end) Q_DECL_OVERRIDE; | ||||
| 92 | void currentChanged(const QModelIndex ¤t, const QModelIndex &previous) Q_DECL_OVERRIDE; | ||||
| 93 | void changeEvent(QEvent *event) Q_DECL_OVERRIDE; | ||||
| 94 | void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) Q_DECL_OVERRIDE; | ||||
| 95 | | ||||
| 96 | bool eventFilter(QObject *, QEvent *event) Q_DECL_OVERRIDE; | ||||
| 97 | | ||||
| 98 | // KColumnView functions | ||||
| 99 | void scrollContentsBy(int dx, int dy) Q_DECL_OVERRIDE; | ||||
| 100 | virtual QAbstractItemView* createColumn(const QModelIndex &rootIndex); | ||||
| 101 | void initializeColumn(QAbstractItemView *column); | ||||
| 102 | | ||||
| 103 | private: | ||||
| 104 | class Private; | ||||
| 105 | Private * const d; | ||||
| 106 | Q_DISABLE_COPY(KColumnView) | ||||
| 107 | Q_PRIVATE_SLOT(d, void _q_gripMoved(int)) | ||||
| 108 | Q_PRIVATE_SLOT(d, void _q_changeCurrentColumn()) | ||||
| 109 | Q_PRIVATE_SLOT(d, void _q_columnsInserted(QModelIndex,int,int)) | ||||
| 110 | Q_PRIVATE_SLOT(d, void _q_iconSizeChanged(QSize)) | ||||
| 111 | Q_PRIVATE_SLOT(d, void _q_clicked(const QModelIndex &)) | ||||
| 112 | }; | ||||
| 113 | | ||||
| 114 | QT_END_NAMESPACE | ||||
| 115 | | ||||
| 116 | #endif // KCOLUMNVIEW_H | ||||
| 117 | | ||||