42 #ifndef QABSTRACTITEMVIEW_P_H 43 #define QABSTRACTITEMVIEW_P_H 56 #include "private/qabstractscrollarea_p.h" 57 #include "private/qabstractitemmodel_p.h" 58 #include "QtGui/qapplication.h" 59 #include "QtGui/qevent.h" 60 #include "QtGui/qmime.h" 61 #include "QtGui/qpainter.h" 62 #include "QtCore/qpair.h" 63 #include "QtGui/qregion.h" 64 #include "QtCore/qdebug.h" 65 #include "QtGui/qpainter.h" 66 #include "QtCore/qbasictimer.h" 67 #include "QtCore/qelapsedtimer.h" 69 #ifndef QT_NO_ITEMVIEWS 110 virtual void _q_rowsRemoved(
const QModelIndex &parent,
int start,
int end);
111 virtual void _q_rowsInserted(
const QModelIndex &parent,
int start,
int end);
112 virtual void _q_columnsAboutToBeRemoved(
const QModelIndex &parent,
int start,
int end);
113 virtual void _q_columnsRemoved(
const QModelIndex &parent,
int start,
int end);
114 virtual void _q_columnsInserted(
const QModelIndex &parent,
int start,
int end);
115 virtual void _q_modelDestroyed();
116 virtual void _q_layoutChanged();
123 bool shouldAutoScroll(
const QPoint &pos)
const;
124 void doDelayedItemsLayout(
int delay = 0);
125 void interruptDelayedItemsLayout()
const;
130 autoScrollTimer.start(scrollInterval, q_func());
135 #ifndef QT_NO_DRAGANDDROP 145 QItemSelectionModel::SelectionFlags multiSelectionCommand(
const QModelIndex &index,
146 const QEvent *event)
const;
147 QItemSelectionModel::SelectionFlags extendedSelectionCommand(
const QModelIndex &index,
148 const QEvent *event)
const;
149 QItemSelectionModel::SelectionFlags contiguousSelectionCommand(
const QModelIndex &index,
150 const QEvent *event)
const;
151 virtual void selectAll(QItemSelectionModel::SelectionFlags command);
160 switch (selectionBehavior) {
167 #ifndef QT_NO_DRAGANDDROP 173 for (
int i = 0; i < modelTypes.
count(); ++i)
175 && (e->
dropAction() & model->supportedDropActions()))
189 opt.
rect = dropIndicatorRect;
211 interruptDelayedItemsLayout();
217 updateRegion += visualRegion;
218 if (!updateTimer.isActive())
219 updateTimer.start(0, q_func());
223 scrollDelayOffset =
QPoint(-dx, -dy);
225 scrollDelayOffset =
QPoint(0, 0);
229 scrollDirtyRegion(dx, dy);
230 viewport->scroll(dx, dy);
235 viewport->update(updateRegion);
239 void clearOrRemove();
240 void checkPersistentEditorFocus();
246 return QPoint(q->isRightToLeft() ? -q->horizontalOffset()
247 : q->horizontalOffset(), q->verticalOffset());
252 return indexEditorHash.find(index) != indexEditorHash.constEnd();
257 void removeEditor(
QWidget *editor);
266 it = rowDelegates.
find(index.
row());
267 if (it != rowDelegates.
end())
271 if (it != columnDelegates.
end())
278 return (index.
row() >= 0) && (index.
column() >= 0) && (index.
model() == model);
295 return isIndexValid(index) && isIndexSelectable(index);
301 return QPoint(q->horizontalOffset(), q->verticalOffset());
311 if (itemDelegate == delegate)
314 for (
int maps = 0; maps < 2; ++maps) {
317 it != delegates->
end(); ++
it) {
318 if (
it.value() == delegate) {
347 if (!delayedReset.isActive())
348 delayedReset.start(0, q_func());
387 #ifndef QT_NO_DRAGANDDROP 397 #ifdef QT_SOFTKEYS_ENABLED 442 template <
typename T>
445 int i = (start + end + 1) >> 1;
446 while (end - start > 0) {
447 if (vec.
at(i) > item)
451 i = (start + end + 1) >> 1;
458 #endif // QT_NO_ITEMVIEWS 460 #endif // QABSTRACTITEMVIEW_P_H The QVariant class acts like a union for the most common Qt data types.
SelectionMode
This enum indicates how the view responds to user selections:
The QPainter class performs low-level painting on widgets and other paint devices.
QAbstractItemView::DropIndicatorPosition dropIndicatorPosition
QPersistentModelIndex hover
The QAbstractItemDelegate class is used to display and edit data items from a model.
QWidget * currentlyCommittingEditor
bool isIndexDragEnabled(const QModelIndex &index) const
bool hasEditor(const QModelIndex &index) const
#define QT_END_NAMESPACE
This macro expands to.
QAbstractItemView::EditTrigger lastTrigger
#define it(className, varName)
int qBinarySearch(const QVector< T > &vec, const T &item, int start, int end)
QWeakPointer< QWidget > widget
QAbstractItemView::State state
void setDirtyRegion(const QRegion &visualRegion)
bool isIndexDropEnabled(const QModelIndex &index) const
bool hasChildren(const QModelIndex &) const
Returns true if parent has any children; otherwise returns false.
void removeEventFilter(QObject *)
Removes an event filter object obj from this object.
QHash< QPersistentModelIndex, QEditorInfo > QIndexEditorHash
SelectionFlag
This enum describes the way the selection model will be updated.
static qreal position(QGraphicsObject *item, QDeclarativeAnchorLine::AnchorLine anchorLine)
The QStyleOptionViewItemV4 class is used to describe the parameters necessary for drawing a frame in ...
Qt::DropAction dropAction() const
Returns the action to be performed on the data by the target.
QAbstractItemView::SelectionBehavior selectionBehavior
QItemSelectionModel::SelectionFlags selectionBehaviorFlags() const
void init(const QWidget *w)
Use initFrom(widget) instead.
QAbstractItemView::SelectionMode selectionMode
#define QT_END_INCLUDE_NAMESPACE
This macro is equivalent to QT_BEGIN_NAMESPACE.
QPointer< QItemSelectionModel > selectionModel
bool moveCursorUpdatedView
bool pressedAlreadySelected
int count(const T &t) const
Returns the number of occurrences of value in the list.
QMap< int, QPointer< QAbstractItemDelegate > > columnDelegates
iterator find(const Key &key)
Returns an iterator pointing to the item with key key in the map.
DropIndicatorPosition
This enum indicates the position of the drop indicator in relation to the index at the current mouse ...
QAbstractItemView::ScrollMode horizontalScrollMode
void scrollContentsBy(int dx, int dy)
The QString class provides a Unicode character string.
Qt::DropAction defaultDropAction
The QVector class is a template class that provides a dynamic array.
The QObject class is the base class of all Qt objects.
QPair< QRect, QModelIndex > QItemViewPaintPair
void _q_headerDataChanged()
The QElapsedTimer class provides a fast way to calculate elapsed times.
QEmptyModel(QObject *parent=0)
QBasicTimer delayedEditing
virtual bool selectionAllowed(const QModelIndex &index) const
QPersistentModelIndex pressedIndex
QVariant data(const QModelIndex &, int) const
Returns the data stored under the given role for the item referred to by the index.
void checkMouseMove(const QPoint &pos)
bool shouldClearStatusTip
#define QT_BEGIN_NAMESPACE
This macro expands to.
void releaseEditor(QWidget *editor) const
QAbstractItemView::ScrollMode verticalScrollMode
bool isIndexEnabled(const QModelIndex &index) const
The QStyleOption class stores the parameters used by QStyle functions.
QEditorIndexHash editorIndexHash
QAbstractItemView::State stateBeforeAnimation
int row() const
Returns the row this model index refers to.
const T value(const Key &key) const
Returns the value associated with the key key.
const T & at(int i) const
Returns the item at index position i in the list.
const QAbstractItemModel * model() const
Returns a pointer to the model containing the item that this index refers to.
The QStringList class provides a list of strings.
void scrollDirtyRegion(int dx, int dy)
bool canDecode(QDropEvent *e) const
QAbstractItemView::DragDropMode dragDropMode
The QRegion class specifies a clip region for a painter.
State
Describes the different states the view can be in.
void executePostedLayout() const
QBasicTimer autoScrollTimer
QBasicTimer delayedLayout
DragDropMode
Describes the various drag and drop events the view can act upon.
bool delayedPendingLayout
The QMimeData class provides a container for data that records information about its MIME type...
bool isIndexSelectable(const QModelIndex &index) const
const T & at(int i) const
Returns the item at index position i in the vector.
QItemSelectionModel::SelectionFlag ctrlDragSelectionFlag
The QAbstractItemModel class provides the abstract interface for item model classes.
iterator begin()
Returns an STL-style iterator pointing to the first item in the map.
QEditorInfo(QWidget *e, bool s)
QPersistentModelIndex root
Qt::TextElideMode textElideMode
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
Disconnects signal in object sender from method in object receiver.
QHash< QWidget *, QPersistentModelIndex > QEditorIndexHash
virtual bool hasFormat(const QString &mimetype) const
Returns true if the object can return data for the MIME type specified by mimeType; otherwise returns...
The QAbstractItemView class provides the basic functionality for item view classes.
#define Q_DECLARE_PUBLIC(Class)
The QDropEvent class provides an event which is sent when a drag and drop action is completed...
The QPersistentModelIndex class is used to locate data in a data model.
bool shouldScrollToCurrentOnShow
QPointer< QAbstractItemDelegate > itemDelegate
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the map...
QElapsedTimer keyboardInputTime
virtual QPoint contentsOffset() const
QPersistentModelIndex enteredIndex
bool noSelectionOnMousePress
QAbstractItemView::EditTriggers editTriggers
The QPoint class defines a point in the plane using integer precision.
The QModelIndex class is used to locate data in a data model.
QAbstractItemDelegate * delegateForIndex(const QModelIndex &index) const
The QRect class defines a rectangle in the plane using integer precision.
#define Q_AUTOTEST_EXPORT
int rowCount(const QModelIndex &) const
Returns the number of rows under the given parent.
bool isPersistent(const QModelIndex &index) const
QList< QItemViewPaintPair > QItemViewPaintPairs
The QPixmap class is an off-screen image representation that can be used as a paint device...
EditTrigger
This enum describes actions which will initiate item editing.
#define QT_BEGIN_INCLUDE_NAMESPACE
This macro is equivalent to QT_END_NAMESPACE.
The QBasicTimer class provides timer events for objects.
const QMimeData * mimeData() const
Returns the data that was dropped on the widget and its associated MIME type information.
The QSize class defines the size of a two-dimensional object using integer point precision.
Qt::KeyboardModifiers pressedModifiers
QBasicTimer fetchMoreTimer
virtual void adjustViewOptionsForIndex(QStyleOptionViewItemV4 *, const QModelIndex &) const
The QStyleOptionViewItem class is used to describe the parameters used to draw an item in a view widg...
QBasicTimer delayedAutoScroll
QModelIndex index(int, int, const QModelIndex &) const
Returns the index of the item in the model specified by the given row, column and parent index...
static const KeyPair *const end
QMap< int, QPointer< QAbstractItemDelegate > > rowDelegates
bool isIndexValid(const QModelIndex &index) const
The QEvent class is the base class of all event classes.
QAbstractItemModel * model
QSet< QWidget * > persistent
int columnCount(const QModelIndex &) const
Returns the number of columns for the children of the given parent.
void deleteLater()
Schedules this object for deletion.
QRect rect
the area that should be used for various calculations and painting
int delegateRefCount(const QAbstractItemDelegate *delegate) const
The QAction class provides an abstract user interface action that can be inserted into widgets...
The QMap class is a template class that provides a skip-list-based dictionary.
bool viewportEnteredNeeded
QIndexEditorHash indexEditorHash
The QWeakPointer class holds a weak reference to a shared pointer.
int column() const
Returns the column this model index refers to.
The QList class is a template class that provides lists.
QModelIndex parent(const QModelIndex &) const
Returns the parent of the model item with the given index.
void paintDropIndicator(QPainter *painter)