QtBase  v6.3.1
abstractitemcontainer.h
Go to the documentation of this file.
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 examples of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:GPL-EXCEPT$
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 General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
21 ** included in the packaging of this file. Please review the following
22 ** information to ensure the GNU General Public License requirements will
23 ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
24 **
25 ** $QT_END_LICENSE$
26 **
27 ****************************************************************************/
28 
29 #ifndef ABSTRACTITEMCONTAINER_H
30 #define ABSTRACTITEMCONTAINER_H
31 
32 #include <QModelIndex>
33 
34 #include "gvbwidget.h"
35 
36 class QGraphicsWidget;
37 class AbstractItemView;
38 class AbstractViewItem;
39 
41 {
42  Q_OBJECT
43 public:
45  virtual ~AbstractItemContainer();
46 
47  virtual void addItem(const QModelIndex &index);
48  virtual void removeItem(const QModelIndex &index);
49 
50  virtual void setItemView(AbstractItemView *view);
51  virtual void setItemPrototype(AbstractViewItem *ptype);
52  virtual void reset();
53  virtual int itemCount() const;
54  virtual AbstractViewItem* itemAt(const int row) const;
58  void updateContent();
59  void themeChange();
60  int bufferSize() const;
61  virtual void setTwoColumns(const bool enabled);
62  bool twoColumns();
63 
64  void setSubtreeCacheEnabled(const bool enabled);
65  virtual void setListItemCaching(const bool enabled, const int index) = 0;
66 
67 protected:
68  virtual void adjustVisibleContainerSize(const QSizeF &size) = 0;
71 
72  virtual bool event(QEvent *e);
73  virtual bool eventFilter(QObject *obj, QEvent *event);
74  virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
75  virtual int maxItemCountInItemBuffer() const;
76  bool itemVisibleInView(AbstractViewItem* item, const QRectF &viewRect, bool fullyVisible = true) const;
77 
78 protected:
79  void updateItemBuffer();
80  void findFirstAndLastVisibleBufferIndex(int &firstVisibleBufferIndex,
81  int &lastVisibleBufferIndex,
82  const QRectF &viewRect,
83  bool fullyVisible) const;
88 
89 private:
90  void insertItem(int pos, const QModelIndex &index);
91  bool m_twoColumns;
92 
94 };
95 
96 #endif // ABSTRACTITEMCONTAINER_H
QList< AbstractViewItem * > m_items
AbstractViewItem * m_prototype
virtual void addItem(const QModelIndex &index)
virtual void removeItemFromVisibleLayout(AbstractViewItem *item)=0
void setSubtreeCacheEnabled(const bool enabled)
virtual int itemCount() const
virtual void addItemToVisibleLayout(int index, AbstractViewItem *item)=0
AbstractViewItem * firstItem()
virtual bool event(QEvent *e)
virtual bool eventFilter(QObject *obj, QEvent *event)
AbstractItemContainer(int bufferSize, QGraphicsWidget *parent=0)
virtual void setListItemCaching(const bool enabled, const int index)=0
bool itemVisibleInView(AbstractViewItem *item, const QRectF &viewRect, bool fullyVisible=true) const
virtual void adjustVisibleContainerSize(const QSizeF &size)=0
virtual void removeItem(const QModelIndex &index)
virtual AbstractViewItem * itemAt(const int row) const
virtual void setItemView(AbstractItemView *view)
virtual int maxItemCountInItemBuffer() const
AbstractItemView * m_itemView
AbstractViewItem * prototype()
virtual void setTwoColumns(const bool enabled)
void findFirstAndLastVisibleBufferIndex(int &firstVisibleBufferIndex, int &lastVisibleBufferIndex, const QRectF &viewRect, bool fullyVisible) const
AbstractViewItem * findItemByIndex(const QModelIndex &index) const
virtual void setItemPrototype(AbstractViewItem *ptype)
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value)
The QEvent class is the base class of all event classes. Event objects contain event parameters.
Definition: qcoreevent.h:58
QPointF pos
the position of the item
QGraphicsObject * parent
the parent of the item
The QGraphicsWidget class is the base class for all widget items in a QGraphicsScene.
The QModelIndex class is used to locate data in a data model.
The QObject class is the base class of all Qt objects.
Definition: qobject.h:125
The QRectF class defines a finite rectangle in the plane using floating point precision.
Definition: qrect.h:511
The QSizeF class defines the size of a two-dimensional object using floating point precision.
Definition: qsize.h:235
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:95
double e
EGLOutputLayerEXT EGLint EGLAttrib value
#define Q_DISABLE_COPY(Class)
Definition: qglobal.h:515
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint index
[2]
GLenum GLenum GLsizei const GLuint GLboolean enabled
struct _cl_event * event
Definition: qopenglext.h:2998
GLhandleARB obj
[2]
Definition: qopenglext.h:4164
GLenum GLenum GLsizei void * row
Definition: qopenglext.h:2747
#define Q_OBJECT
Definition: qtmetamacros.h:158
QGraphicsItem * item
QQuickView * view
[0]