Qt 4.8
qcolumnview_p.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_P_H
43 #define QCOLUMNVIEW_P_H
44 
45 //
46 // W A R N I N G
47 // -------------
48 //
49 // This file is not part of the Qt API. It exists for the convenience
50 // of other Qt classes. This header file may change from version to
51 // version without notice, or even be removed.
52 //
53 // We mean it.
54 //
55 
56 #include "qcolumnview.h"
57 
58 #ifndef QT_NO_QCOLUMNVIEW
59 
60 #include <private/qabstractitemview_p.h>
61 
62 #include <QtCore/qabstractitemmodel.h>
63 #include <QtCore/qpropertyanimation.h>
64 #include <QtGui/qabstractitemdelegate.h>
65 #include <QtGui/qabstractitemview.h>
66 #include <QtGui/qitemdelegate.h>
67 #include <qlistview.h>
68 #include <qevent.h>
69 #include <qscrollbar.h>
70 
72 
74 
75 public:
77  }
78 
82  }
83 
85  if (!previewWidget)
86  return;
88  qMax(previewWidget->minimumWidth(), event->size().width()),
90  QSize p = viewport()->size();
91  QSize v = previewWidget->size();
92  horizontalScrollBar()->setRange(0, v.width() - p.width());
94  verticalScrollBar()->setRange(0, v.height() - p.height());
96 
98  }
99 
100  QRect visualRect(const QModelIndex &) const
101  {
102  return QRect();
103  }
105  {
106  }
107  QModelIndex indexAt(const QPoint &) const
108  {
109  return QModelIndex();
110  }
111  QModelIndex moveCursor(CursorAction, Qt::KeyboardModifiers)
112  {
113  return QModelIndex();
114  }
115  int horizontalOffset () const {
116  return 0;
117  }
118  int verticalOffset () const {
119  return 0;
120  }
122  {
123  return QRegion();
124  }
125  bool isIndexHidden(const QModelIndex &) const
126  {
127  return false;
128  }
129  void setSelection(const QRect &, QItemSelectionModel::SelectionFlags)
130  {
131  }
132 private:
134 };
135 
137 {
139 
140 public:
143  void initialize();
144 
145  QAbstractItemView *createColumn(const QModelIndex &index, bool show);
146 
147  void updateScrollbars();
148  void closeColumns(const QModelIndex &parent = QModelIndex(), bool build = false);
149  void doLayout();
151  void checkColumnCreation(const QModelIndex &parent);
152 
153 
154  void _q_gripMoved(int offset);
155  void _q_changeCurrentColumn();
156  void _q_clicked(const QModelIndex &index);
157  void _q_columnsInserted(const QModelIndex &parent, int start, int end);
158 
160  QVector<int> columnSizes; // used during init and corner moving
162  int offset;
163 #ifndef QT_NO_ANIMATION
165 #endif
168 };
169 
174 {
175 
176 public:
179 
180  void paint(QPainter *painter,
181  const QStyleOptionViewItem &option,
182  const QModelIndex &index) const;
183 };
184 #endif // QT_NO_QCOLUMNVIEW
185 
186 
188 #endif //QCOLUMNVIEW_P_H
189 
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
The QPropertyAnimation class animates Qt properties.
bool isIndexHidden(const QModelIndex &) const
Returns true if the item referred to by the given index is hidden in the view, otherwise returns fals...
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
QPointer< QWidget > widget
void setSelection(const QRect &, QItemSelectionModel::SelectionFlags)
Applies the selection flags to the items in or touched by the rectangle, rect.
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QScrollBar * verticalScrollBar() const
Returns the vertical scroll bar.
QRect visualRect(const QModelIndex &) const
Returns the rectangle on the viewport occupied by the item at index.
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
void setPreviewWidget(QWidget *widget)
Definition: qcolumnview_p.h:79
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
void setRange(int min, int max)
Sets the slider&#39;s minimum to min and its maximum to max.
QWidget * viewport() const
Returns the viewport widget.
void resizeEvent(QResizeEvent *)
This event handler can be reimplemented in a subclass to receive resize events (passed in event)...
int width() const
Returns the width.
Definition: qsize.h:126
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
QAbstractItemView * previewColumn
int height
the height of the widget excluding any window frame
Definition: qwidget.h:167
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
QSize size
the size of the widget excluding any window frame
Definition: qwidget.h:165
void show()
Shows the widget and its child widgets.
This is a delegate that will paint the triangle.
QRegion visualRegionForSelection(const QItemSelection &) const
Returns the region from the viewport of the items in the given selection.
QColumnViewPreviewColumn(QWidget *parent)
Definition: qcolumnview_p.h:76
int minimumWidth
the widget&#39;s minimum width in pixels
Definition: qwidget.h:174
The QAbstractItemView class provides the basic functionality for item view classes.
#define Q_DECLARE_PUBLIC(Class)
Definition: qglobal.h:2477
The QItemSelection class manages information about selected items in a model.
void resize(int w, int h)
This corresponds to resize(QSize(w, h)).
Definition: qwidget.h:1014
int horizontalOffset() const
Returns the horizontal offset of the view.
The QItemDelegate class provides display and editing facilities for data items from a model...
Definition: qitemdelegate.h:61
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
QModelIndex indexAt(const QPoint &) const
Returns the model index of the item at the viewport coordinates point.
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.
QScrollBar * horizontalScrollBar() const
Returns the horizontal scroll bar.
int height() const
Returns the height.
Definition: qsize.h:129
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
void setMinimumWidth(int minw)
Definition: qwidget.cpp:4325
#define Q_AUTOTEST_EXPORT
Definition: qglobal.h:1510
The QColumnView class provides a model/view implementation of a column view.
Definition: qcolumnview.h:57
QModelIndex moveCursor(CursorAction, Qt::KeyboardModifiers)
Returns a QModelIndex object pointing to the next object in the view, based on the given cursorAction...
quint16 index
QPropertyAnimation currentAnimation
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
CursorAction
This enum describes the different ways to navigate between items,.
The QStyleOptionViewItem class is used to describe the parameters used to draw an item in a view widg...
Definition: qstyleoption.h:539
QWidget * previewWidget
static const KeyPair *const end
bool event(QEvent *event)
Reimplemented Function
int verticalOffset() const
Returns the vertical offset of the view.
void resizeEvent(QResizeEvent *event)
This function is called with the given event when a resize event is sent to the widget.
Definition: qcolumnview_p.h:84
QColumnViewDelegate(QObject *parent=0)
QVector< int > columnSizes
void scrollTo(const QModelIndex &, ScrollHint)
Scrolls the view if necessary to ensure that the item at index is visible.
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
QList< QAbstractItemView * > columns