QtGui/qcolumnview.h Source File

qcolumnview.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui 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 Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QCOLUMNVIEW_H
43 #define QCOLUMNVIEW_H
44 
46 
48 
50 
51 QT_MODULE(Gui)
52 
53 #ifndef QT_NO_COLUMNVIEW
54 
55 class QColumnViewPrivate;
56 
57 class Q_GUI_EXPORT QColumnView : public QAbstractItemView {
58 
60  Q_PROPERTY(bool resizeGripsVisible READ resizeGripsVisible WRITE setResizeGripsVisible)
61 
62 Q_SIGNALS:
63  void updatePreviewWidget(const QModelIndex &index);
64 
65 public:
66  explicit QColumnView(QWidget *parent = 0);
67  ~QColumnView();
68 
69  // QAbstractItemView overloads
70  QModelIndex indexAt(const QPoint &point) const;
71  void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible);
72  QSize sizeHint() const;
73  QRect visualRect(const QModelIndex &index) const;
74  void setModel(QAbstractItemModel *model);
75  void setSelectionModel(QItemSelectionModel * selectionModel);
76  void setRootIndex(const QModelIndex &index);
77  void selectAll();
78 
79  // QColumnView functions
80  void setResizeGripsVisible(bool visible);
81  bool resizeGripsVisible() const;
82 
83  QWidget *previewWidget() const;
84  void setPreviewWidget(QWidget *widget);
85 
86  void setColumnWidths(const QList<int> &list);
87  QList<int> columnWidths() const;
88 
89 protected:
90  QColumnView(QColumnViewPrivate &dd, QWidget *parent = 0);
91 
92  // QAbstractItemView overloads
93  bool isIndexHidden(const QModelIndex &index) const;
94  QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers);
95  void resizeEvent(QResizeEvent *event);
96  void setSelection(const QRect & rect, QItemSelectionModel::SelectionFlags command);
97  QRegion visualRegionForSelection(const QItemSelection &selection) const;
98  int horizontalOffset() const;
99  int verticalOffset() const;
100  void rowsInserted(const QModelIndex &parent, int start, int end);
101  void currentChanged(const QModelIndex &current, const QModelIndex &previous);
102 
103  // QColumnView functions
104  void scrollContentsBy(int dx, int dy);
105  virtual QAbstractItemView* createColumn(const QModelIndex &rootIndex);
106  void initializeColumn(QAbstractItemView *column) const;
107 
108 private:
109  Q_DECLARE_PRIVATE(QColumnView)
110  Q_DISABLE_COPY(QColumnView)
111  Q_PRIVATE_SLOT(d_func(), void _q_gripMoved(int))
112  Q_PRIVATE_SLOT(d_func(), void _q_changeCurrentColumn())
113  Q_PRIVATE_SLOT(d_func(), void _q_clicked(const QModelIndex &))
114 };
115 
116 #endif // QT_NO_COLUMNVIEW
117 
119 
121 
122 #endif // QCOLUMNVIEW_H
123 
virtual void setRootIndex(const QModelIndex &index)
int int int int * dy
Definition: GLee.h:10535
virtual void rowsInserted(const QModelIndex &parent, int start, int end)
#define QT_END_NAMESPACE
Definition: qglobal.h:128
#define Q_PROPERTY(text)
Definition: qobjectdefs.h:80
GLuint start
Definition: GLee.h:872
#define QT_BEGIN_HEADER
Definition: qglobal.h:141
virtual void setSelectionModel(QItemSelectionModel *selectionModel)
virtual void setModel(QAbstractItemModel *model)
virtual int verticalOffset() const =0
#define Q_PRIVATE_SLOT(d, signature)
Definition: qobjectdefs.h:73
#define Q_SIGNALS
Definition: qobjectdefs.h:72
virtual bool isIndexHidden(const QModelIndex &index) const =0
Definition: qpoint.h:53
#define QT_BEGIN_NAMESPACE
Definition: qglobal.h:127
virtual void scrollTo(const QModelIndex &index, ScrollHint hint=EnsureVisible)=0
virtual QRect visualRect(const QModelIndex &index) const =0
virtual QModelIndex indexAt(const QPoint &point) const =0
void resizeEvent(QResizeEvent *event)
#define Q_OBJECT
Definition: qobjectdefs.h:157
QSize sizeHint() const
GLuint GLuint end
Definition: GLee.h:872
Definition: qrect.h:58
virtual int horizontalOffset() const =0
GLenum GLenum GLvoid GLvoid * column
Definition: GLee.h:893
Definition: qsize.h:53
virtual void currentChanged(const QModelIndex &current, const QModelIndex &previous)
virtual void selectAll()
int int int * dx
Definition: GLee.h:10535
virtual QRegion visualRegionForSelection(const QItemSelection &selection) const =0
virtual void scrollContentsBy(int dx, int dy)
#define QT_END_HEADER
Definition: qglobal.h:142
virtual void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command)=0
virtual QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers)=0
GLuint index
Definition: GLee.h:1704