Qt 4.8
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 
45 #include <QtGui/qabstractitemview.h>
46 
48 
50 
51 QT_MODULE(Gui)
52 
53 #ifndef QT_NO_COLUMNVIEW
54 
55 class QColumnViewPrivate;
56 
58 
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);
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:
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 
The QItemSelectionModel class keeps track of a view&#39;s selected items.
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
EventRef event
QPointer< QWidget > widget
#define QT_MODULE(x)
Definition: qglobal.h:2783
virtual void setSelectionModel(QItemSelectionModel *selectionModel)
Sets the current selection model to the given selectionModel.
#define QT_BEGIN_HEADER
Definition: qglobal.h:136
bool resizeGripsVisible
the way to specify if the list views gets resize grips or not
Definition: qcolumnview.h:60
virtual bool isIndexHidden(const QModelIndex &index) const =0
Returns true if the item referred to by the given index is hidden in the view, otherwise returns fals...
virtual QRect visualRect(const QModelIndex &index) const =0
Returns the rectangle on the viewport occupied by the item at index.
#define Q_GUI_EXPORT
Definition: qglobal.h:1450
virtual void setRootIndex(const QModelIndex &index)
Sets the root item to the item at the given index.
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_DISABLE_COPY(Class)
Disables the use of copy constructors and assignment operators for the given Class.
Definition: qglobal.h:2523
#define Q_PRIVATE_SLOT(d, signature)
Definition: qobjectdefs.h:73
virtual QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers)=0
Returns a QModelIndex object pointing to the next object in the view, based on the given cursorAction...
#define Q_SIGNALS
Definition: qobjectdefs.h:72
virtual int verticalOffset() const =0
Returns the vertical offset of the view.
virtual void setModel(QAbstractItemModel *model)
Sets the model for the view to present.
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
virtual void selectAll()
Selects all items in the view.
virtual void scrollTo(const QModelIndex &index, ScrollHint hint=EnsureVisible)=0
Scrolls the view if necessary to ensure that the item at index is visible.
virtual void currentChanged(const QModelIndex &current, const QModelIndex &previous)
This slot is called when a new item becomes the current item.
The QResizeEvent class contains event parameters for resize events.
Definition: qevent.h:349
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
virtual int horizontalOffset() const =0
Returns the horizontal offset of the view.
#define Q_OBJECT
Definition: qobjectdefs.h:157
The QAbstractItemModel class provides the abstract interface for item model classes.
The QAbstractItemView class provides the basic functionality for item view classes.
The QItemSelection class manages information about selected items in a model.
virtual void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command)=0
Applies the selection flags to the items in or touched by the rectangle, rect.
void resizeEvent(QResizeEvent *event)
This function is called with the given event when a resize event is sent to the widget.
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
The QModelIndex class is used to locate data in a data model.
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
The QColumnView class provides a model/view implementation of a column view.
Definition: qcolumnview.h:57
virtual void scrollContentsBy(int dx, int dy)
This virtual handler is called when the scroll bars are moved by dx, dy, and consequently the viewpor...
quint16 index
virtual void rowsInserted(const QModelIndex &parent, int start, int end)
This slot is called when rows are inserted.
virtual QRegion visualRegionForSelection(const QItemSelection &selection) const =0
Returns the region from the viewport of the items in the given selection.
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
#define Q_DECLARE_PRIVATE(Class)
Definition: qglobal.h:2467
CursorAction
This enum describes the different ways to navigate between items,.
static const KeyPair *const end
#define QT_END_HEADER
Definition: qglobal.h:137
QSize sizeHint() const
Reimplemented Function
virtual QModelIndex indexAt(const QPoint &point) const =0
Returns the model index of the item at the viewport coordinates point.