Qt 4.8
Public Functions | Public Variables | Properties | List of all members
QAbstractItemViewPrivate Class Reference

#include <qabstractitemview_p.h>

Inheritance diagram for QAbstractItemViewPrivate:
QAbstractScrollAreaPrivate QFramePrivate QWidgetPrivate QObjectPrivate QObjectData QColumnViewPrivate QHeaderViewPrivate QListViewPrivate QTableViewPrivate QTreeViewPrivate QListWidgetPrivate QUndoViewPrivate QTableWidgetPrivate QTreeWidgetPrivate

Public Functions

virtual void _q_columnsAboutToBeRemoved (const QModelIndex &parent, int start, int end)
 This slot is called when columns are about to be removed. More...
 
virtual void _q_columnsInserted (const QModelIndex &parent, int start, int end)
 This slot is called when columns have been inserted. More...
 
virtual void _q_columnsRemoved (const QModelIndex &parent, int start, int end)
 This slot is called when columns have been removed. More...
 
void _q_headerDataChanged ()
 
virtual void _q_layoutChanged ()
 This slot is called when the layout is changed. More...
 
virtual void _q_modelDestroyed ()
 
virtual void _q_rowsInserted (const QModelIndex &parent, int start, int end)
 This slot is called when rows have been inserted. More...
 
virtual void _q_rowsRemoved (const QModelIndex &parent, int start, int end)
 This slot is called when rows have been removed. More...
 
void addEditor (const QModelIndex &index, QWidget *editor, bool isStatic)
 
virtual void adjustViewOptionsForIndex (QStyleOptionViewItemV4 *, const QModelIndex &) const
 
bool canDecode (QDropEvent *e) const
 
void checkMouseMove (const QPersistentModelIndex &index)
 
void checkMouseMove (const QPoint &pos)
 
void checkPersistentEditorFocus ()
 When persistent aeditor gets/loses focus, we need to check and setcorrectly the current index. More...
 
void clearOrRemove ()
 In DND if something has been moved then this is called. More...
 
virtual QPoint contentsOffset () const
 
QItemSelectionModel::SelectionFlags contiguousSelectionCommand (const QModelIndex &index, const QEvent *event) const
 
QAbstractItemDelegatedelegateForIndex (const QModelIndex &index) const
 
int delegateRefCount (const QAbstractItemDelegate *delegate) const
 
void doDelayedItemsLayout (int delay=0)
 
void doDelayedReset ()
 
virtual QItemViewPaintPairs draggablePaintPairs (const QModelIndexList &indexes, QRect *r) const
 
virtual bool dropOn (QDropEvent *event, int *row, int *col, QModelIndex *index)
 If the event hasn't already been accepted, determines the index to drop on. More...
 
bool droppingOnItself (QDropEvent *event, const QModelIndex &index)
 Return true if this is a move from ourself and index is a child of the selection that is being moved. More...
 
QWidgeteditor (const QModelIndex &index, const QStyleOptionViewItem &options)
 
const QEditorInfoeditorForIndex (const QModelIndex &index) const
 
void executePostedLayout () const
 
QItemSelectionModel::SelectionFlags extendedSelectionCommand (const QModelIndex &index, const QEvent *event) const
 
void fetchMore ()
 
bool hasEditor (const QModelIndex &index) const
 
QModelIndex indexForEditor (QWidget *editor) const
 
void init ()
 
void interruptDelayedItemsLayout () const
 
bool isAnimating () const
 
bool isIndexDragEnabled (const QModelIndex &index) const
 
bool isIndexDropEnabled (const QModelIndex &index) const
 
bool isIndexEnabled (const QModelIndex &index) const
 
bool isIndexSelectable (const QModelIndex &index) const
 
bool isIndexValid (const QModelIndex &index) const
 
bool isPersistent (const QModelIndex &index) const
 
QItemSelectionModel::SelectionFlags multiSelectionCommand (const QModelIndex &index, const QEvent *event) const
 
QPoint offset () const
 
bool openEditor (const QModelIndex &index, QEvent *event)
 
void paintDropIndicator (QPainter *painter)
 
virtual QAbstractItemView::DropIndicatorPosition position (const QPoint &pos, const QRect &rect, const QModelIndex &idx) const
 
 QAbstractItemViewPrivate ()
 
void releaseEditor (QWidget *editor) const
 
void removeEditor (QWidget *editor)
 
QPixmap renderToPixmap (const QModelIndexList &indexes, QRect *r) const
 
void scrollContentsBy (int dx, int dy)
 
void scrollDirtyRegion (int dx, int dy)
 
virtual void selectAll (QItemSelectionModel::SelectionFlags command)
 
QModelIndexList selectedDraggableIndexes () const
 
virtual bool selectionAllowed (const QModelIndex &index) const
 
QItemSelectionModel::SelectionFlags selectionBehaviorFlags () const
 
bool sendDelegateEvent (const QModelIndex &index, QEvent *event) const
 
void setDirtyRegion (const QRegion &visualRegion)
 
void setHoverIndex (const QPersistentModelIndex &index)
 
bool shouldAutoScroll (const QPoint &pos) const
 
bool shouldEdit (QAbstractItemView::EditTrigger trigger, const QModelIndex &index) const
 
bool shouldForwardEvent (QAbstractItemView::EditTrigger trigger, const QEvent *event) const
 
void startAutoScroll ()
 
void stopAutoScroll ()
 
void updateDirtyRegion ()
 
void updateEditorData (const QModelIndex &topLeft, const QModelIndex &bottomRight)
 
QStyleOptionViewItemV4 viewOptionsV4 () const
 
virtual ~QAbstractItemViewPrivate ()
 
- Public Functions inherited from QAbstractScrollAreaPrivate
void _q_hslide (int)
 
void _q_showOrHideScrollBars ()
 
void _q_vslide (int)
 
void init ()
 
void layoutChildren ()
 
 QAbstractScrollAreaPrivate ()
 
void replaceScrollBar (QScrollBar *scrollBar, Qt::Orientation orientation)
 
virtual void scrollBarPolicyChanged (Qt::Orientation, Qt::ScrollBarPolicy)
 
void setSingleFingerPanEnabled (bool on=true)
 
bool viewportEvent (QEvent *event)
 
- Public Functions inherited from QFramePrivate
void init ()
 
 QFramePrivate ()
 
void updateFrameWidth ()
 Updated the frameWidth parameter. More...
 
void updateStyledFrameWidths ()
 Updates the frame widths from the style. More...
 
- Public Functions inherited from QWidgetPrivate
void _q_showIfNotHidden ()
 
virtual void aboutToDestroy ()
 
void activateChildLayoutsRecursively ()
 
QSize adjustedSize () const
 
void adjustQuitOnCloseAttribute ()
 
QInputContextassignedInputContext () const
 
QPainterbeginSharedPainter ()
 
QWidgetchildAt_helper (const QPoint &, bool) const
 
QWidgetchildAtRecursiveHelper (const QPoint &p, bool, bool includeFrame=false) const
 
QRect clipRect () const
 
QRegion clipRegion () const
 
void clipToEffectiveMask (QRegion &region) const
 
bool close_helper (CloseMode mode)
 
void create_sys (WId window, bool initializeWindow, bool destroyOldWindow)
 
QWindowSurfacecreateDefaultWindowSurface ()
 
QWindowSurfacecreateDefaultWindowSurface_sys ()
 
void createExtra ()
 Creates the widget extra data. More...
 
void createRecursively ()
 
void createSysExtra ()
 
void createTLExtra ()
 
void createTLSysExtra ()
 
void createWinId (WId id=0)
 
void deactivateWidgetCleanup ()
 
void deleteExtra ()
 Deletes the widget extra data. More...
 
void deleteSysExtra ()
 
void deleteTLSysExtra ()
 
void drawWidget (QPaintDevice *pdev, const QRegion &rgn, const QPoint &offset, int flags, QPainter *sharedPainter=0, QWidgetBackingStore *backingStore=0)
 
QWidgeteffectiveFocusWidget ()
 
QRect effectiveRectFor (const QRect &rect) const
 
bool endSharedPainter ()
 
void enforceNativeChildren ()
 
QWExtraextraData () const
 
QRect frameStrut () const
 
void getLayoutItemMargins (int *left, int *top, int *right, int *bottom) const
 
const QRegiongetOpaqueChildren () const
 
void handleSoftwareInputPanel (Qt::MouseButton button, bool clickCausedFocus)
 
virtual bool hasHeightForWidth () const
 
void hide_helper ()
 
void hide_sys ()
 Platform-specific part of QWidget::hide(). More...
 
void hideChildren (bool spontaneous)
 
void inheritStyle ()
 
void init (QWidget *desktopWidget, Qt::WindowFlags f)
 
QInputContextinputContext () const
 
void invalidateBuffer (const QRegion &)
 Invalidates the rgn (in widget's coordinates) of the backing store, i.e. More...
 
void invalidateBuffer (const QRect &)
 This function is equivalent to calling invalidateBuffer(QRegion(rect), ...), but is more efficient as it eliminates QRegion operations/allocations and can use the rect more precisely for additional cut-offs. More...
 
void invalidateBuffer_resizeHelper (const QPoint &oldPos, const QSize &oldSize)
 Invalidates the buffer when the widget is resized. More...
 
void invalidateGraphicsEffectsRecursively ()
 
bool isAboutToShow () const
 
bool isBackgroundInherited () const
 
bool isOverlapped (const QRect &) const
 
void lower_sys ()
 
QPoint mapFromGlobal (const QPoint &pos) const
 
QPoint mapToGlobal (const QPoint &pos) const
 
QWidgetBackingStoremaybeBackingStore () const
 
QTLWExtramaybeTopData () const
 
void moveRect (const QRect &, int dx, int dy)
 
bool nativeChildrenForced () const
 
QFont naturalWidgetFont (uint inheritedMask) const
 
QPalette naturalWidgetPalette (uint inheritedMask) const
 Returns the palette that the widget w inherits from its ancestors and QApplication::palette. More...
 
void paintBackground (QPainter *, const QRegion &, int flags=DrawAsRoot) const
 
bool paintOnScreen () const
 
void paintSiblingsRecursive (QPaintDevice *pdev, const QObjectList &children, int index, const QRegion &rgn, const QPoint &offset, int flags, QPainter *sharedPainter, QWidgetBackingStore *backingStore)
 
bool pointInsideRectAndMask (const QPoint &) const
 
QRegion prepareToRender (const QRegion &region, QWidget::RenderFlags renderFlags)
 
void propagatePaletteChange ()
 Propagate this widget's palette to all children, except style sheet widgets, and windows that don't enable window propagation (palettes don't normally propagate to windows). More...
 
 QWidgetPrivate (int version=QObjectPrivateVersion)
 
void raise_sys ()
 
QPaintDeviceredirected (QPoint *offset) const
 
void registerDropSite (bool)
 
void render (QPaintDevice *target, const QPoint &targetOffset, const QRegion &sourceRegion, QWidget::RenderFlags renderFlags, bool readyToRender)
 
void render_helper (QPainter *painter, const QPoint &targetOffset, const QRegion &sourceRegion, QWidget::RenderFlags renderFlags)
 
void repaint_sys (const QRegion &rgn)
 
void reparentFocusWidgets (QWidget *oldtlw)
 
void resolveFont ()
 Determine which font is implicitly imposed on this widget by its ancestors and QApplication::font, resolve this against its own font (attributes from the implicit font are copied over). More...
 
void resolveLayoutDirection ()
 
void resolveLocale ()
 
void resolvePalette ()
 Determine which palette is inherited from this widget's ancestors and QApplication::palette, resolve this against this widget's palette (attributes from the inherited palette are copied over this widget's palette). More...
 
void restoreRedirected ()
 
void scroll_sys (int dx, int dy)
 
void scroll_sys (int dx, int dy, const QRect &r)
 
void scrollChildren (int dx, int dy)
 
void scrollRect (const QRect &, int dx, int dy)
 
void sendPendingMoveAndResizeEvents (bool recursive=false, bool disableUpdates=false)
 
void sendStartupMessage (const char *message) const
 Platform-specific part of QWidget::show(). More...
 
void setConstraints_sys ()
 
void setCursor_sys (const QCursor &cursor)
 
void setDirtyOpaqueRegion ()
 
void setEnabled_helper (bool)
 
void setFocus_sys ()
 
void setFont_helper (const QFont &font)
 
void setGeometry_sys (int, int, int, int, bool)
 
void setLayoutDirection_helper (Qt::LayoutDirection)
 
void setLayoutItemMargins (int left, int top, int right, int bottom)
 
void setLayoutItemMargins (QStyle::SubElement element, const QStyleOption *opt=0)
 
void setLocale_helper (const QLocale &l, bool forceUpdate=false)
 
void setMask_sys (const QRegion &)
 
bool setMaximumSize_helper (int &maxw, int &maxh)
 
bool setMinimumSize_helper (int &minw, int &minh)
 
void setModal_sys ()
 
void setNetWmWindowTypes ()
 
void setOpaque (bool opaque)
 
void setPalette_helper (const QPalette &)
 
void setParent_sys (QWidget *parent, Qt::WindowFlags)
 
void setRedirected (QPaintDevice *replacement, const QPoint &offset)
 
void setSharedPainter (QPainter *painter)
 
void setStyle_helper (QStyle *newStyle, bool propagate, bool metalHack=false)
 
void setUpdatesEnabled_helper (bool)
 
void setWindowFilePath_helper (const QString &filePath)
 
void setWindowIcon_helper ()
 
void setWindowIcon_sys (bool forceReset=false)
 
void setWindowIconText_helper (const QString &cap)
 
void setWindowIconText_sys (const QString &cap)
 
void setWindowOpacity_sys (qreal opacity)
 
void setWindowRole ()
 
void setWindowTitle_helper (const QString &cap)
 
void setWindowTitle_sys (const QString &cap)
 
void setWinId (WId)
 
QPaintersharedPainter () const
 
void show_helper ()
 
void show_recursive ()
 Makes the widget visible in the isVisible() meaning of the word. More...
 
void show_sys ()
 Platform-specific part of QWidget::show(). More...
 
void showChildren (bool spontaneous)
 
void stackUnder_sys (QWidget *)
 
void subtractOpaqueChildren (QRegion &rgn, const QRect &clipRect) const
 
void subtractOpaqueSiblings (QRegion &source, bool *hasDirtySiblingsAbove=0, bool alsoNonOpaque=false) const
 
void syncBackingStore ()
 
void syncBackingStore (const QRegion &region)
 
QTLWExtratopData () const
 
void unsetCursor_sys ()
 
void updateFont (const QFont &)
 Assign font to this widget, and propagate it to all children, except style sheet widgets (handled differently) and windows that don't enable window propagation. More...
 
void updateFrameStrut ()
 Computes the frame rectangle when needed. More...
 
void updateGeometry_helper (bool forceUpdate)
 
void updateIsOpaque ()
 
void updateIsTranslucent ()
 
void updateSystemBackground ()
 
void updateX11AcceptFocus ()
 
void x11UpdateIsOpaque ()
 
 ~QWidgetPrivate ()
 
- Public Functions inherited from QObjectPrivate
void _q_reregisterTimers (void *pointer)
 
void addConnection (int signal, Connection *c)
 
void cleanConnectionLists ()
 
void connectNotify (const char *signal)
 
void deleteChildren ()
 
void disconnectNotify (const char *signal)
 
bool isSender (const QObject *receiver, const char *signal) const
 
bool isSignalConnected (uint signalIdx) const
 Returns true if the signal with index signal_index from object sender is connected. More...
 
void moveToThread_helper ()
 
 QObjectPrivate (int version=QObjectPrivateVersion)
 
QObjectList receiverList (const char *signal) const
 
QObjectList senderList () const
 
void setParent_helper (QObject *)
 
void setThreadData_helper (QThreadData *currentData, QThreadData *targetData)
 
int signalIndex (const char *signalName) const
 Returns the signal index used in the internal connectionLists vector. More...
 
virtual ~QObjectPrivate ()
 
- Public Functions inherited from QObjectData
virtual ~QObjectData ()=0
 

Public Variables

bool alternatingColors
 
bool autoScroll
 
int autoScrollCount
 
int autoScrollMargin
 
QBasicTimer autoScrollTimer
 
QMap< int, QPointer< QAbstractItemDelegate > > columnDelegates
 
QItemSelectionModel::SelectionFlag ctrlDragSelectionFlag
 
bool currentIndexSet
 
QWidgetcurrentlyCommittingEditor
 
Qt::DropAction defaultDropAction
 
QBasicTimer delayedAutoScroll
 
QBasicTimer delayedEditing
 
bool delayedPendingLayout
 
QBasicTimer delayedReset
 
QAbstractItemView::DragDropMode dragDropMode
 
bool dragEnabled
 
QAbstractItemView::DropIndicatorPosition dropIndicatorPosition
 
QRect dropIndicatorRect
 
QEditorIndexHash editorIndexHash
 
QAbstractItemView::EditTriggers editTriggers
 
QPersistentModelIndex enteredIndex
 
QAbstractItemView::ScrollMode horizontalScrollMode
 
QPersistentModelIndex hover
 
QSize iconSize
 
QIndexEditorHash indexEditorHash
 
QPointer< QAbstractItemDelegateitemDelegate
 
QString keyboardInput
 
QElapsedTimer keyboardInputTime
 
QAbstractItemView::EditTrigger lastTrigger
 
QAbstractItemModelmodel
 
bool moveCursorUpdatedView
 
bool noSelectionOnMousePress
 
bool overwrite
 
QSet< QWidget * > persistent
 
bool pressedAlreadySelected
 
QPersistentModelIndex pressedIndex
 
Qt::KeyboardModifiers pressedModifiers
 
QPoint pressedPosition
 
QPersistentModelIndex root
 
QMap< int, QPointer< QAbstractItemDelegate > > rowDelegates
 
QPoint scrollDelayOffset
 
QAbstractItemView::SelectionBehavior selectionBehavior
 
QAbstractItemView::SelectionMode selectionMode
 
QPointer< QItemSelectionModelselectionModel
 
bool shouldClearStatusTip
 
bool shouldScrollToCurrentOnShow
 
bool showDropIndicator
 
QAbstractItemView::State state
 
QAbstractItemView::State stateBeforeAnimation
 
bool tabKeyNavigation
 
Qt::TextElideMode textElideMode
 
QRegion updateRegion
 
QBasicTimer updateTimer
 
QAbstractItemView::ScrollMode verticalScrollMode
 
bool viewportEnteredNeeded
 
bool wrapItemText
 
- Public Variables inherited from QAbstractScrollAreaPrivate
int bottom
 
QRect cornerPaintingRect
 
QWidgetcornerWidget
 
QScrollBarhbar
 
Qt::ScrollBarPolicy hbarpolicy
 
int left
 
QRect reverseCornerPaintingRect
 
int right
 
QAbstractScrollAreaScrollBarContainerscrollBarContainers [Qt::Vertical+1]
 
bool singleFingerPanEnabled
 
int top
 
QScrollBarvbar
 
Qt::ScrollBarPolicy vbarpolicy
 
QWidgetviewport
 
QScopedPointer< QObjectviewportFilter
 
int xoffset
 
int yoffset
 
- Public Variables inherited from QFramePrivate
short bottomFrameWidth
 
int frameStyle
 
short frameWidth
 
QRect frect
 
short leftFrameWidth
 
short lineWidth
 
short midLineWidth
 
short rightFrameWidth
 
short topFrameWidth
 
- Public Variables inherited from QWidgetPrivate
QString accessibleDescription
 
QString accessibleName
 
QList< QAction * > actions
 
QPalette::ColorRole bg_role: 8
 
signed char bottomLayoutItemMargin
 
short bottommargin
 
QWidgetData data
 
QRegion dirty
 
uint dirtyOpaqueChildren: 1
 
QWExtraextra
 
QPaintEngineextraPaintEngine
 
QPalette::ColorRole fg_role: 8
 
QWidgetfocus_child
 
QWidgetfocus_next
 
QWidgetfocus_prev
 
QMap< Qt::GestureType, Qt::GestureFlags > gestureContext
 
QGraphicsEffectgraphicsEffect
 
Qt::HANDLE hd
 
uint high_attributes [4]
 
QPointer< QInputContextic
 
Qt::InputMethodHints imHints
 
uint inDirtyList: 1
 
uint inheritedFontResolveMask
 
uint inheritedPaletteResolveMask
 
uint inheritsInputMethodHints: 1
 
uint inSetParent: 1
 
uint isGLWidget: 1
 
uint isMoved: 1
 
uint isOpaque: 1
 
uint isScrolled: 1
 
QLayoutlayout
 
signed char leftLayoutItemMargin
 
short leftmargin
 
QLocale locale
 
QRegionneedsFlush
 
QRegion opaqueChildren
 
Qt::HANDLE picture
 
const QMetaObjectpolished
 
QPaintDeviceredirectDev
 
QPoint redirectOffset
 
signed char rightLayoutItemMargin
 
short rightmargin
 
QSizePolicy size_policy
 
QString statusTip
 
QString toolTip
 
signed char topLayoutItemMargin
 
short topmargin
 
uint usesDoubleBufferedGLContext: 1
 
QString whatsThis
 
QWidgetItemV2widgetItem
 
QX11Info xinfo
 
- Public Variables inherited from QObjectPrivate
union {
   QObject *   currentChildBeingDeleted
 
   QAbstractDeclarativeData *   declarativeData
 
}; 
 
quint32 connectedSignals [2]
 
QObjectConnectionListVectorconnectionLists
 
SendercurrentSender
 
QList< QPointer< QObject > > eventFilters
 
ExtraDataextraData
 
QString objectName
 
Connectionsenders
 
QAtomicPointer< QtSharedPointer::ExternalRefCountData > sharedRefcount
 
QThreadDatathreadData
 
void * unused
 
- Public Variables inherited from QObjectData
uint blockSig: 1
 
QObjectList children
 
uint hasGuards: 1
 
uint inEventHandler: 1
 
uint inThreadChangeEvent: 1
 
uint isWidget: 1
 
QMetaObjectmetaObject
 
uint ownObjectName: 1
 
QObjectparent
 
uint pendTimer: 1
 
int postedEvents
 
QObjectq_ptr
 
uint receiveChildEvents: 1
 
uint sendChildEvents: 1
 
uint unused: 22
 
uint wasDeleted: 1
 

Properties

QBasicTimer delayedLayout
 
QBasicTimer fetchMoreTimer
 

Additional Inherited Members

- Public Types inherited from QWidgetPrivate
enum  CloseMode { CloseNoEvent, CloseWithEvent, CloseWithSpontaneousEvent }
 
enum  Direction { DirectionNorth = 0x01, DirectionEast = 0x10, DirectionSouth = 0x02, DirectionWest = 0x20 }
 
enum  DrawWidgetFlags {
  DrawAsRoot = 0x01, DrawPaintOnScreen = 0x02, DrawRecursive = 0x04, DrawInvisible = 0x08,
  DontSubtractOpaqueChildren = 0x10, DontSetCompositionMode = 0x20, DontDrawOpaqueChildren = 0x40, DontDrawNativeChildren = 0x80
}
 
- Public Types inherited from QObjectPrivate
typedef void(* StaticMetaCallFunction) (QObject *, QMetaObject::Call, int, void **)
 
- Static Public Functions inherited from QWidgetPrivate
static void adjustFlags (Qt::WindowFlags &flags, QWidget *w=0)
 
static QGraphicsProxyWidgetnearestGraphicsProxyWidget (const QWidget *origin)
 Finds the nearest widget embedded in a graphics proxy widget along the chain formed by this widget and its ancestors. More...
 
static int pointToRect (const QPoint &p, const QRect &r)
 
static QRect screenGeometry (const QWidget *widget)
 
- Static Public Functions inherited from QObjectPrivate
static void clearGuards (QObject *)
 
static QObjectPrivateget (QObject *o)
 
static void resetCurrentSender (QObject *receiver, Sender *currentSender, Sender *previousSender)
 
static SendersetCurrentSender (QObject *receiver, Sender *sender)
 
static void signalSignature (const QMetaMethod &signal, QVarLengthArray< char > *result)
 
- Static Public Variables inherited from QWidgetPrivate
static QWidgetSetallWidgets = 0
 
static int instanceCounter = 0
 
static QWidgetkeyboardGrabber = 0
 
static QWidgetMappermapper = 0
 
static int maxInstances = 0
 
static QWidgetmouseGrabber = 0
 

Detailed Description

Definition at line 100 of file qabstractitemview_p.h.

Constructors and Destructors

◆ QAbstractItemViewPrivate()

QAbstractItemViewPrivate::QAbstractItemViewPrivate ( )

Definition at line 69 of file qabstractitemview.cpp.

71  itemDelegate(0),
72  selectionModel(0),
79  pressedPosition(QPoint(-1, -1)),
81  viewportEnteredNeeded(false),
86  tabKeyNavigation(false),
87 #ifndef QT_NO_DRAGANDDROP
88  showDropIndicator(true),
89  dragEnabled(false),
91  overwrite(false),
94 #endif
95 #ifdef QT_SOFTKEYS_ENABLED
96  doneSoftKey(0),
97 #endif
98  autoScroll(true),
99  autoScrollMargin(16),
100  autoScrollCount(0),
102  shouldClearStatusTip(false),
103  alternatingColors(false),
107  currentIndexSet(false),
108  wrapItemText(false),
109  delayedPendingLayout(true),
110  moveCursorUpdatedView(false)
111 {
113 }
QAbstractItemView::DropIndicatorPosition dropIndicatorPosition
static QAbstractItemModel * staticEmptyModel()
QAbstractItemView::EditTrigger lastTrigger
QAbstractItemView::State state
QAbstractItemView::SelectionBehavior selectionBehavior
QAbstractItemView::SelectionMode selectionMode
QPointer< QItemSelectionModel > selectionModel
QAbstractItemView::ScrollMode horizontalScrollMode
QAbstractItemView::ScrollMode verticalScrollMode
QAbstractItemView::State stateBeforeAnimation
QAbstractItemView::DragDropMode dragDropMode
void invalidate()
Marks this QElapsedTimer object as invalid.
QItemSelectionModel::SelectionFlag ctrlDragSelectionFlag
Qt::TextElideMode textElideMode
QPointer< QAbstractItemDelegate > itemDelegate
QAbstractItemView::EditTriggers editTriggers
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
Qt::KeyboardModifiers pressedModifiers
QAbstractItemModel * model

◆ ~QAbstractItemViewPrivate()

QAbstractItemViewPrivate::~QAbstractItemViewPrivate ( )
virtual

Definition at line 115 of file qabstractitemview.cpp.

116 {
117 }

Functions

◆ _q_columnsAboutToBeRemoved()

void QAbstractItemViewPrivate::_q_columnsAboutToBeRemoved ( const QModelIndex parent,
int  start,
int  end 
)
virtual

This slot is called when columns are about to be removed.

Warning
This function is not part of the public interface.

The deleted columns are those under the given parent from start to end inclusive.

Reimplemented in QTreeViewPrivate.

Definition at line 3487 of file qabstractitemview.cpp.

Referenced by QTreeViewPrivate::_q_columnsAboutToBeRemoved().

3488 {
3490 
3492 
3493  // Ensure one selected item in single selection mode.
3494  QModelIndex current = q->currentIndex();
3495  if (current.isValid()
3497  && current.column() >= start
3498  && current.column() <= end) {
3499  int totalToRemove = end - start + 1;
3500  if (model->columnCount(parent) < totalToRemove) { // no more columns
3502  while (index.isValid() && !isIndexEnabled(index))
3503  index = index.parent();
3504  if (index.isValid())
3505  q->setCurrentIndex(index);
3506  } else {
3507  int column = end;
3508  QModelIndex next;
3509  do { // find the next visible and enabled item
3510  next = model->index(current.row(), column++, current.parent());
3511  } while (next.isValid() && (q->isIndexHidden(next) || !isIndexEnabled(next)));
3512  q->setCurrentIndex(next);
3513  }
3514  }
3515 
3516  // Remove all affected editors; this is more efficient than waiting for updateGeometries() to clean out editors for invalid indexes
3518  while (it != editorIndexHash.end()) {
3519  QModelIndex index = it.value();
3520  if (index.column() <= start && index.column() >= end && model->parent(index) == parent) {
3521  QWidget *editor = it.key();
3522  QEditorInfo info = indexEditorHash.take(it.value());
3523  it = editorIndexHash.erase(it);
3524  if (info.widget)
3525  releaseEditor(editor);
3526  } else {
3527  ++it;
3528  }
3529  }
3530 
3531 }
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const =0
Returns the number of columns for the children of the given parent.
static mach_timebase_info_data_t info
#define it(className, varName)
QWeakPointer< QWidget > widget
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QAbstractItemView::SelectionMode selectionMode
T take(const Key &key)
Removes the item with the key from the hash and returns the value associated with it...
Definition: qhash.h:807
QModelIndex parent() const
Returns the parent of the model index, or QModelIndex() if it has no parent.
#define Q_Q(Class)
Definition: qglobal.h:2483
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const =0
Returns the index of the item in the model specified by the given row, column and parent index...
void releaseEditor(QWidget *editor) const
bool isIndexEnabled(const QModelIndex &index) const
QEditorIndexHash editorIndexHash
int row() const
Returns the row this model index refers to.
bool isValid() const
Returns true if this model index is valid; otherwise returns false.
virtual QModelIndex parent(const QModelIndex &child) const =0
Returns the parent of the model item with the given index.
The QAbstractItemView class provides the basic functionality for item view classes.
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the hash...
Definition: qhash.h:467
The QModelIndex class is used to locate data in a data model.
QWidget * editor(const QModelIndex &index, const QStyleOptionViewItem &options)
iterator begin()
Returns an STL-style iterator pointing to the first item in the hash.
Definition: qhash.h:464
quint16 index
QObject * parent
Definition: qobject.h:92
static const KeyPair *const end
QAbstractItemModel * model
iterator erase(iterator it)
Removes the (key, value) pair associated with the iterator pos from the hash, and returns an iterator...
Definition: qhash.h:827
QIndexEditorHash indexEditorHash
int column() const
Returns the column this model index refers to.

◆ _q_columnsInserted()

void QAbstractItemViewPrivate::_q_columnsInserted ( const QModelIndex index,
int  start,
int  end 
)
virtual

This slot is called when columns have been inserted.

Warning
This function is not part of the public interface.

Reimplemented in QColumnViewPrivate.

Definition at line 3597 of file qabstractitemview.cpp.

Referenced by QColumnViewPrivate::_q_columnsInserted().

3598 {
3599  Q_UNUSED(index)
3600  Q_UNUSED(start)
3601  Q_UNUSED(end)
3602 
3604  if (q->isVisible())
3605  q->updateEditorGeometries();
3606 #ifndef QT_NO_ACCESSIBILITY
3607 #ifdef Q_WS_X11
3608  if (QAccessible::isActive()) {
3611  }
3612 #endif
3613 #endif
3614 }
static void updateAccessibility(QObject *, int who, Event reason)
Notifies accessibility clients about a change in object&#39;s accessibility information.
#define Q_Q(Class)
Definition: qglobal.h:2483
virtual void columnsInserted(const QModelIndex &parent, int first, int last)=0
static bool isActive()
Returns true if an accessibility implementation has been requested during the runtime of the applicat...
static QAccessibleInterface * queryAccessibleInterface(QObject *)
If a QAccessibleInterface implementation exists for the given object, this function returns a pointer...
The QAbstractItemView class provides the basic functionality for item view classes.
QAccessibleTable2Interface * table2Interface()
Definition: qaccessible.h:432
static const KeyPair *const end
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ _q_columnsRemoved()

void QAbstractItemViewPrivate::_q_columnsRemoved ( const QModelIndex index,
int  start,
int  end 
)
virtual

This slot is called when columns have been removed.

Warning
This function is not part of the public interface.

The deleted rows are those under the given parent from start to end inclusive.

Reimplemented in QTreeViewPrivate.

Definition at line 3543 of file qabstractitemview.cpp.

Referenced by QTreeViewPrivate::_q_columnsRemoved().

3544 {
3545  Q_UNUSED(index)
3546  Q_UNUSED(start)
3547  Q_UNUSED(end)
3548 
3550  if (q->isVisible())
3551  q->updateEditorGeometries();
3552  q->setState(QAbstractItemView::NoState);
3553 #ifndef QT_NO_ACCESSIBILITY
3554 #ifdef Q_WS_X11
3555  if (QAccessible::isActive()) {
3558  }
3559 #endif
3560 #endif
3561 }
static void updateAccessibility(QObject *, int who, Event reason)
Notifies accessibility clients about a change in object&#39;s accessibility information.
#define Q_Q(Class)
Definition: qglobal.h:2483
static bool isActive()
Returns true if an accessibility implementation has been requested during the runtime of the applicat...
static QAccessibleInterface * queryAccessibleInterface(QObject *)
If a QAccessibleInterface implementation exists for the given object, this function returns a pointer...
The QAbstractItemView class provides the basic functionality for item view classes.
virtual void columnsRemoved(const QModelIndex &parent, int first, int last)=0
QAccessibleTable2Interface * table2Interface()
Definition: qaccessible.h:432
static const KeyPair *const end
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ _q_headerDataChanged()

void QAbstractItemViewPrivate::_q_headerDataChanged ( )
inline

Definition at line 117 of file qabstractitemview_p.h.

void doDelayedItemsLayout(int delay=0)

◆ _q_layoutChanged()

void QAbstractItemViewPrivate::_q_layoutChanged ( )
virtual

This slot is called when the layout is changed.

Warning
This function is not part of the public interface.

Reimplemented in QHeaderViewPrivate.

Definition at line 3633 of file qabstractitemview.cpp.

3634 {
3636 #ifndef QT_NO_ACCESSIBILITY
3637 #ifdef Q_WS_X11
3639  if (QAccessible::isActive()) {
3642  }
3643 #endif
3644 #endif
3645 }
static void updateAccessibility(QObject *, int who, Event reason)
Notifies accessibility clients about a change in object&#39;s accessibility information.
#define Q_Q(Class)
Definition: qglobal.h:2483
void doDelayedItemsLayout(int delay=0)
static bool isActive()
Returns true if an accessibility implementation has been requested during the runtime of the applicat...
static QAccessibleInterface * queryAccessibleInterface(QObject *)
If a QAccessibleInterface implementation exists for the given object, this function returns a pointer...
virtual void modelReset()=0
The QAbstractItemView class provides the basic functionality for item view classes.
QAccessibleTable2Interface * table2Interface()
Definition: qaccessible.h:432

◆ _q_modelDestroyed()

void QAbstractItemViewPrivate::_q_modelDestroyed ( )
virtual
Warning
This function is not part of the public interface.

Reimplemented in QTreeViewPrivate.

Definition at line 3619 of file qabstractitemview.cpp.

Referenced by QTreeViewPrivate::_q_modelDestroyed().

3620 {
3622  doDelayedReset();
3623 }
static QAbstractItemModel * staticEmptyModel()
QAbstractItemModel * model

◆ _q_rowsInserted()

void QAbstractItemViewPrivate::_q_rowsInserted ( const QModelIndex index,
int  start,
int  end 
)
virtual

This slot is called when rows have been inserted.

Warning
This function is not part of the public interface.

Definition at line 3572 of file qabstractitemview.cpp.

3573 {
3574  Q_UNUSED(index)
3575  Q_UNUSED(start)
3576  Q_UNUSED(end)
3577 
3578 #ifndef QT_NO_ACCESSIBILITY
3579 #ifdef Q_WS_X11
3581  if (QAccessible::isActive()) {
3584  }
3585 #endif
3586 #endif
3587 }
static void updateAccessibility(QObject *, int who, Event reason)
Notifies accessibility clients about a change in object&#39;s accessibility information.
#define Q_Q(Class)
Definition: qglobal.h:2483
static bool isActive()
Returns true if an accessibility implementation has been requested during the runtime of the applicat...
static QAccessibleInterface * queryAccessibleInterface(QObject *)
If a QAccessibleInterface implementation exists for the given object, this function returns a pointer...
The QAbstractItemView class provides the basic functionality for item view classes.
QAccessibleTable2Interface * table2Interface()
Definition: qaccessible.h:432
virtual void rowsInserted(const QModelIndex &parent, int first, int last)=0
static const KeyPair *const end
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ _q_rowsRemoved()

void QAbstractItemViewPrivate::_q_rowsRemoved ( const QModelIndex index,
int  start,
int  end 
)
virtual

This slot is called when rows have been removed.

Warning
This function is not part of the public interface.

The deleted rows are those under the given parent from start to end inclusive.

Definition at line 3457 of file qabstractitemview.cpp.

3458 {
3459  Q_UNUSED(index)
3460  Q_UNUSED(start)
3461  Q_UNUSED(end)
3462 
3464  if (q->isVisible())
3465  q->updateEditorGeometries();
3466  q->setState(QAbstractItemView::NoState);
3467 #ifndef QT_NO_ACCESSIBILITY
3468 #ifdef Q_WS_X11
3469  if (QAccessible::isActive()) {
3472  }
3473 #endif
3474 #endif
3475 }
static void updateAccessibility(QObject *, int who, Event reason)
Notifies accessibility clients about a change in object&#39;s accessibility information.
#define Q_Q(Class)
Definition: qglobal.h:2483
virtual void rowsRemoved(const QModelIndex &parent, int first, int last)=0
static bool isActive()
Returns true if an accessibility implementation has been requested during the runtime of the applicat...
static QAccessibleInterface * queryAccessibleInterface(QObject *)
If a QAccessibleInterface implementation exists for the given object, this function returns a pointer...
The QAbstractItemView class provides the basic functionality for item view classes.
QAccessibleTable2Interface * table2Interface()
Definition: qaccessible.h:432
static const KeyPair *const end
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ addEditor()

void QAbstractItemViewPrivate::addEditor ( const QModelIndex index,
QWidget editor,
bool  isStatic 
)

Definition at line 4368 of file qabstractitemview.cpp.

4369 {
4370  editorIndexHash.insert(editor, index);
4371  indexEditorHash.insert(index, QEditorInfo(editor, isStatic));
4372 }
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
Definition: qhash.h:753
QEditorIndexHash editorIndexHash
QIndexEditorHash indexEditorHash

◆ adjustViewOptionsForIndex()

virtual void QAbstractItemViewPrivate::adjustViewOptionsForIndex ( QStyleOptionViewItemV4 ,
const QModelIndex  
) const
inlinevirtual

Reimplemented in QTreeViewPrivate.

Definition at line 197 of file qabstractitemview_p.h.

197 {}

◆ canDecode()

bool QAbstractItemViewPrivate::canDecode ( QDropEvent e) const
inline

Definition at line 170 of file qabstractitemview_p.h.

170  {
171  QStringList modelTypes = model->mimeTypes();
172  const QMimeData *mime = e->mimeData();
173  for (int i = 0; i < modelTypes.count(); ++i)
174  if (mime->hasFormat(modelTypes.at(i))
175  && (e->dropAction() & model->supportedDropActions()))
176  return true;
177  return false;
178  }
Qt::DropAction dropAction() const
Returns the action to be performed on the data by the target.
Definition: qevent.h:494
const char * mime
virtual QStringList mimeTypes() const
Returns a list of MIME types that can be used to describe a list of model indexes.
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
virtual Qt::DropActions supportedDropActions() const
Returns the drop actions supported by this model.
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
The QMimeData class provides a container for data that records information about its MIME type...
Definition: qmimedata.h:57
virtual bool hasFormat(const QString &mimetype) const
Returns true if the object can return data for the MIME type specified by mimeType; otherwise returns...
Definition: qmimedata.cpp:563
const QMimeData * mimeData() const
Returns the data that was dropped on the widget and its associated MIME type information.
Definition: qevent.h:498
QAbstractItemModel * model

◆ checkMouseMove() [1/2]

void QAbstractItemViewPrivate::checkMouseMove ( const QPersistentModelIndex index)

Definition at line 163 of file qabstractitemview.cpp.

164 {
165  //we take a persistent model index because the model might change by emitting signals
167  setHoverIndex(index);
168  if (viewportEnteredNeeded || enteredIndex != index) {
169  viewportEnteredNeeded = false;
170 
171  if (index.isValid()) {
172  emit q->entered(index);
173 #ifndef QT_NO_STATUSTIP
174  QString statustip = model->data(index, Qt::StatusTipRole).toString();
175  if (parent && (shouldClearStatusTip || !statustip.isEmpty())) {
176  QStatusTipEvent tip(statustip);
178  shouldClearStatusTip = !statustip.isEmpty();
179  }
180 #endif
181  } else {
182 #ifndef QT_NO_STATUSTIP
183  if (parent && shouldClearStatusTip) {
184  QString emptyString;
185  QStatusTipEvent tip( emptyString );
187  }
188 #endif
189  emit q->viewportEntered();
190  }
192  }
193 }
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
Definition: qvariant.cpp:2270
The QString class provides a Unicode character string.
Definition: qstring.h:83
void setHoverIndex(const QPersistentModelIndex &index)
#define Q_Q(Class)
Definition: qglobal.h:2483
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
#define emit
Definition: qobjectdefs.h:76
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const =0
Returns the data stored under the given role for the item referred to by the index.
The QAbstractItemView class provides the basic functionality for item view classes.
The QStatusTipEvent class provides an event that is used to show messages in a status bar...
Definition: qevent.h:606
QPersistentModelIndex enteredIndex
quint16 index
QObject * parent
Definition: qobject.h:92
QAbstractItemModel * model
bool isValid() const
Returns true if this persistent model index is valid; otherwise returns false.

◆ checkMouseMove() [2/2]

void QAbstractItemViewPrivate::checkMouseMove ( const QPoint pos)
inline

Definition at line 156 of file qabstractitemview_p.h.

Referenced by checkMouseMove().

156 { checkMouseMove(q_func()->indexAt(pos)); }
void checkMouseMove(const QPersistentModelIndex &index)

◆ checkPersistentEditorFocus()

void QAbstractItemViewPrivate::checkPersistentEditorFocus ( )

When persistent aeditor gets/loses focus, we need to check and setcorrectly the current index.

Warning
This function is not part of the public interface.

Definition at line 4316 of file qabstractitemview.cpp.

4317 {
4320  if (persistent.contains(widget)) {
4321  //a persistent editor has gained the focus
4323  if (selectionModel->currentIndex() != index)
4324  q->setCurrentIndex(index);
4325  }
4326  }
4327 }
QPointer< QWidget > widget
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QPointer< QItemSelectionModel > selectionModel
#define Q_Q(Class)
Definition: qglobal.h:2483
bool contains(const T &value) const
Definition: qset.h:91
QModelIndex currentIndex() const
Returns the model item index for the current item, or an invalid index if there is no current item...
The QAbstractItemView class provides the basic functionality for item view classes.
QModelIndex indexForEditor(QWidget *editor) const
The QModelIndex class is used to locate data in a data model.
quint16 index
static QWidget * focusWidget()
Returns the application widget that has the keyboard input focus, or 0 if no widget in this applicati...

◆ clearOrRemove()

void QAbstractItemViewPrivate::clearOrRemove ( )

In DND if something has been moved then this is called.

Warning
This function is not part of the public interface.

Typically this means you should "remove" the selected item or row, but the behavior is view dependant (table just clears the selected indexes for example).

Either remove the selected rows or clear them

Definition at line 4277 of file qabstractitemview.cpp.

4278 {
4279 #ifndef QT_NO_DRAGANDDROP
4280  const QItemSelection selection = selectionModel->selection();
4282 
4283  if (!overwrite) {
4284  for (; it != selection.constEnd(); ++it) {
4285  QModelIndex parent = (*it).parent();
4286  if ((*it).left() != 0)
4287  continue;
4288  if ((*it).right() != (model->columnCount(parent) - 1))
4289  continue;
4290  int count = (*it).bottom() - (*it).top() + 1;
4291  model->removeRows((*it).top(), count, parent);
4292  }
4293  } else {
4294  // we can't remove the rows so reset the items (i.e. the view is like a table)
4295  QModelIndexList list = selection.indexes();
4296  for (int i=0; i < list.size(); ++i) {
4297  QModelIndex index = list.at(i);
4298  QMap<int, QVariant> roles = model->itemData(index);
4299  for (QMap<int, QVariant>::Iterator it = roles.begin(); it != roles.end(); ++it)
4300  it.value() = QVariant();
4301  model->setItemData(index, roles);
4302  }
4303  }
4304 #endif
4305 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const =0
Returns the number of columns for the children of the given parent.
virtual QMap< int, QVariant > itemData(const QModelIndex &index) const
Returns a map with values for all predefined roles in the model for the item at the given index...
#define it(className, varName)
virtual bool setItemData(const QModelIndex &index, const QMap< int, QVariant > &roles)
Sets the role data for the item at index to the associated value in roles, for every Qt::ItemDataRole...
const QItemSelection selection() const
Returns the selection ranges stored in the selection model.
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the list.
Definition: qlist.h:269
QPointer< QItemSelectionModel > selectionModel
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
virtual bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex())
On models that support this, removes count rows starting with the given row under parent parent from ...
T value(int i) const
Returns the value at index position i in the list.
Definition: qlist.h:661
iterator begin()
Returns an STL-style iterator pointing to the first item in the map.
Definition: qmap.h:372
The QItemSelection class manages information about selected items in a model.
The QMap::iterator class provides an STL-style non-const iterator for QMap and QMultiMap.
Definition: qmap.h:233
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the map...
Definition: qmap.h:375
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
The QModelIndex class is used to locate data in a data model.
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
quint16 index
QObject * parent
Definition: qobject.h:92
QModelIndexList indexes() const
Returns a list of model indexes that correspond to the selected items.
QAbstractItemModel * model
The QMap class is a template class that provides a skip-list-based dictionary.
Definition: qdatastream.h:67
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list...
Definition: qlist.h:272

◆ contentsOffset()

virtual QPoint QAbstractItemViewPrivate::contentsOffset ( ) const
inlinevirtual

Reimplemented from QAbstractScrollAreaPrivate.

Definition at line 299 of file qabstractitemview_p.h.

299  {
300  Q_Q(const QAbstractItemView);
301  return QPoint(q->horizontalOffset(), q->verticalOffset());
302  }
#define Q_Q(Class)
Definition: qglobal.h:2483
The QAbstractItemView class provides the basic functionality for item view classes.
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53

◆ contiguousSelectionCommand()

QItemSelectionModel::SelectionFlags QAbstractItemViewPrivate::contiguousSelectionCommand ( const QModelIndex index,
const QEvent event 
) const

Definition at line 4095 of file qabstractitemview.cpp.

4097 {
4098  QItemSelectionModel::SelectionFlags flags = extendedSelectionCommand(index, event);
4102 
4103  switch (flags & Mask) {
4107  return flags;
4109  if (event &&
4110  (event->type() == QEvent::MouseButtonPress
4111  || event->type() == QEvent::MouseButtonRelease))
4112  return flags;
4114  default:
4116  }
4117 }
QItemSelectionModel::SelectionFlags selectionBehaviorFlags() const
QItemSelectionModel::SelectionFlags extendedSelectionCommand(const QModelIndex &index, const QEvent *event) const
Type type() const
Returns the event type.
Definition: qcoreevent.h:303

◆ delegateForIndex()

QAbstractItemDelegate* QAbstractItemViewPrivate::delegateForIndex ( const QModelIndex index) const
inline

Definition at line 263 of file qabstractitemview_p.h.

Referenced by QListViewPrivate::itemSize().

263  {
265 
266  it = rowDelegates.find(index.row());
267  if (it != rowDelegates.end())
268  return it.value();
269 
270  it = columnDelegates.find(index.column());
271  if (it != columnDelegates.end())
272  return it.value();
273 
274  return itemDelegate;
275  }
#define it(className, varName)
QMap< int, QPointer< QAbstractItemDelegate > > columnDelegates
iterator find(const Key &key)
Returns an iterator pointing to the item with key key in the map.
Definition: qmap.h:618
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.
Definition: qmap.h:499
QPointer< QAbstractItemDelegate > itemDelegate
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the map...
Definition: qmap.h:375
QMap< int, QPointer< QAbstractItemDelegate > > rowDelegates
The QMap class is a template class that provides a skip-list-based dictionary.
Definition: qdatastream.h:67
int column() const
Returns the column this model index refers to.

◆ delegateRefCount()

int QAbstractItemViewPrivate::delegateRefCount ( const QAbstractItemDelegate delegate) const
inline

For now, assume that we have few editors, if we need a more efficient implementation we should add a QMap<QAbstractItemDelegate*, int> member.

Definition at line 308 of file qabstractitemview_p.h.

309  {
310  int ref = 0;
311  if (itemDelegate == delegate)
312  ++ref;
313 
314  for (int maps = 0; maps < 2; ++maps) {
316  for (QMap<int, QPointer<QAbstractItemDelegate> >::const_iterator it = delegates->begin();
317  it != delegates->end(); ++it) {
318  if (it.value() == delegate) {
319  ++ref;
320  // optimization, we are only interested in the ref count values 0, 1 or >=2
321  if (ref >= 2) {
322  return ref;
323  }
324  }
325  }
326  }
327  return ref;
328  }
#define it(className, varName)
QMap< int, QPointer< QAbstractItemDelegate > > columnDelegates
iterator begin()
Returns an STL-style iterator pointing to the first item in the map.
Definition: qmap.h:372
QPointer< QAbstractItemDelegate > itemDelegate
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the map...
Definition: qmap.h:375
QMap< int, QPointer< QAbstractItemDelegate > > rowDelegates
The QMap class is a template class that provides a skip-list-based dictionary.
Definition: qdatastream.h:67

◆ doDelayedItemsLayout()

void QAbstractItemViewPrivate::doDelayedItemsLayout ( int  delay = 0)

Definition at line 4187 of file qabstractitemview.cpp.

4188 {
4189  if (!delayedPendingLayout) {
4190  delayedPendingLayout = true;
4191  delayedLayout.start(delay, q_func());
4192  }
4193 }
void start(int msec, QObject *obj)
Starts (or restarts) the timer with a msec milliseconds timeout.

◆ doDelayedReset()

void QAbstractItemViewPrivate::doDelayedReset ( )
inline

Definition at line 342 of file qabstractitemview_p.h.

343  {
344  //we delay the reset of the timer because some views (QTableView)
345  //with headers can't handle the fact that the model has been destroyed
346  //all _q_modelDestroyed slots must have been called
347  if (!delayedReset.isActive())
348  delayedReset.start(0, q_func());
349  }
bool isActive() const
Returns true if the timer is running and has not been stopped; otherwise returns false.
Definition: qbasictimer.h:62
void start(int msec, QObject *obj)
Starts (or restarts) the timer with a msec milliseconds timeout.

◆ draggablePaintPairs()

QItemViewPaintPairs QAbstractItemViewPrivate::draggablePaintPairs ( const QModelIndexList indexes,
QRect r 
) const
virtual

Reimplemented in QListViewPrivate, and QTreeViewPrivate.

Definition at line 4414 of file qabstractitemview.cpp.

Referenced by QTreeViewPrivate::draggablePaintPairs().

4415 {
4416  Q_ASSERT(r);
4417  Q_Q(const QAbstractItemView);
4418  QRect &rect = *r;
4419  const QRect viewportRect = viewport->rect();
4420  QItemViewPaintPairs ret;
4421  for (int i = 0; i < indexes.count(); ++i) {
4422  const QModelIndex &index = indexes.at(i);
4423  const QRect current = q->visualRect(index);
4424  if (current.intersects(viewportRect)) {
4425  ret += qMakePair(current, index);
4426  rect |= current;
4427  }
4428  }
4429  rect &= viewportRect;
4430  return ret;
4431 }
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define Q_Q(Class)
Definition: qglobal.h:2483
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
The QAbstractItemView class provides the basic functionality for item view classes.
QRect rect
the internal geometry of the widget excluding any window frame
Definition: qwidget.h:168
Q_OUTOFLINE_TEMPLATE QPair< T1, T2 > qMakePair(const T1 &x, const T2 &y)
Definition: qpair.h:102
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
quint16 index
bool intersects(const QRect &r) const
Returns true if this rectangle intersects with the given rectangle (i.
Definition: qrect.cpp:1429
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ dropOn()

bool QAbstractItemViewPrivate::dropOn ( QDropEvent event,
int *  dropRow,
int *  dropCol,
QModelIndex dropIndex 
)
virtual

If the event hasn't already been accepted, determines the index to drop on.

if (row == -1 && col == -1) append to this drop index else place at row, col in drop index

If it returns true a drop can be done, and dropRow, dropCol and dropIndex reflects the position of the drop.
\warning This function is not part of the public interface.

Reimplemented in QListViewPrivate.

Definition at line 2158 of file qabstractitemview.cpp.

Referenced by QListViewPrivate::dropOn().

2159 {
2161  if (event->isAccepted())
2162  return false;
2163 
2165  // rootIndex() (i.e. the viewport) might be a valid index
2166  if (viewport->rect().contains(event->pos())) {
2167  index = q->indexAt(event->pos());
2168  if (!index.isValid() || !q->visualRect(index).contains(event->pos()))
2169  index = root;
2170  }
2171 
2172  // If we are allowed to do the drop
2173  if (model->supportedDropActions() & event->dropAction()) {
2174  int row = -1;
2175  int col = -1;
2176  if (index != root) {
2177  dropIndicatorPosition = position(event->pos(), q->visualRect(index), index);
2178  switch (dropIndicatorPosition) {
2180  row = index.row();
2181  col = index.column();
2182  index = index.parent();
2183  break;
2185  row = index.row() + 1;
2186  col = index.column();
2187  index = index.parent();
2188  break;
2191  break;
2192  }
2193  } else {
2195  }
2196  *dropIndex = index;
2197  *dropRow = row;
2198  *dropCol = col;
2199  if (!droppingOnItself(event, index))
2200  return true;
2201  }
2202  return false;
2203 }
QAbstractItemView::DropIndicatorPosition dropIndicatorPosition
virtual QAbstractItemView::DropIndicatorPosition position(const QPoint &pos, const QRect &rect, const QModelIndex &idx) const
virtual Qt::DropActions supportedDropActions() const
Returns the drop actions supported by this model.
QModelIndex parent() const
Returns the parent of the model index, or QModelIndex() if it has no parent.
#define Q_Q(Class)
Definition: qglobal.h:2483
bool isAccepted() const
Definition: qcoreevent.h:307
int row() const
Returns the row this model index refers to.
bool isValid() const
Returns true if this model index is valid; otherwise returns false.
bool contains(const QPoint &p, bool proper=false) const
Returns true if the given point is inside or on the edge of the rectangle, otherwise returns false...
Definition: qrect.cpp:1101
QPersistentModelIndex root
The QAbstractItemView class provides the basic functionality for item view classes.
QRect rect
the internal geometry of the widget excluding any window frame
Definition: qwidget.h:168
The QModelIndex class is used to locate data in a data model.
quint16 index
QAbstractItemModel * model
bool droppingOnItself(QDropEvent *event, const QModelIndex &index)
Return true if this is a move from ourself and index is a child of the selection that is being moved...
const QPoint & pos() const
Returns the position where the drop was made.
Definition: qevent.h:486
int column() const
Returns the column this model index refers to.

◆ droppingOnItself()

bool QAbstractItemViewPrivate::droppingOnItself ( QDropEvent event,
const QModelIndex index 
)

Return true if this is a move from ourself and index is a child of the selection that is being moved.

Warning
This function is not part of the public interface.

Definition at line 2081 of file qabstractitemview.cpp.

2082 {
2084  Qt::DropAction dropAction = event->dropAction();
2085  if (q->dragDropMode() == QAbstractItemView::InternalMove)
2086  dropAction = Qt::MoveAction;
2087  if (event->source() == q
2088  && event->possibleActions() & Qt::MoveAction
2089  && dropAction == Qt::MoveAction) {
2090  QModelIndexList selectedIndexes = q->selectedIndexes();
2091  QModelIndex child = index;
2092  while (child.isValid() && child != root) {
2093  if (selectedIndexes.contains(child))
2094  return true;
2095  child = child.parent();
2096  }
2097  }
2098  return false;
2099 }
QModelIndex parent() const
Returns the parent of the model index, or QModelIndex() if it has no parent.
#define Q_Q(Class)
Definition: qglobal.h:2483
QBool contains(const T &t) const
Returns true if the list contains an occurrence of value; otherwise returns false.
Definition: qlist.h:880
DropAction
Definition: qnamespace.h:1597
bool isValid() const
Returns true if this model index is valid; otherwise returns false.
QPersistentModelIndex root
The QAbstractItemView class provides the basic functionality for item view classes.
QWidget * source() const
If the source of the drag operation is a widget in this application, this function returns that sourc...
Definition: qevent.cpp:2739
The QModelIndex class is used to locate data in a data model.
quint16 index

◆ editor()

QWidget * QAbstractItemViewPrivate::editor ( const QModelIndex index,
const QStyleOptionViewItem options 
)

Definition at line 4203 of file qabstractitemview.cpp.

4205 {
4207  QWidget *w = editorForIndex(index).widget.data();
4208  if (!w) {
4209  QAbstractItemDelegate *delegate = delegateForIndex(index);
4210  if (!delegate)
4211  return 0;
4212  w = delegate->createEditor(viewport, options, index);
4213  if (w) {
4214  w->installEventFilter(delegate);
4215  QObject::connect(w, SIGNAL(destroyed(QObject*)), q, SLOT(editorDestroyed(QObject*)));
4216  delegate->updateEditorGeometry(w, options, index);
4217  delegate->setEditorData(w, index);
4218  addEditor(index, w, false);
4219  if (w->parent() == viewport)
4220  QWidget::setTabOrder(q, w);
4221 
4222  // Special cases for some editors containing QLineEdit
4223  QWidget *focusWidget = w;
4224  while (QWidget *fp = focusWidget->focusProxy())
4225  focusWidget = fp;
4226 #ifndef QT_NO_LINEEDIT
4227  if (QLineEdit *le = qobject_cast<QLineEdit*>(focusWidget))
4228  le->selectAll();
4229 #endif
4230 #ifndef QT_NO_SPINBOX
4231  if (QSpinBox *sb = qobject_cast<QSpinBox*>(focusWidget))
4232  sb->selectAll();
4233  else if (QDoubleSpinBox *dsb = qobject_cast<QDoubleSpinBox*>(focusWidget))
4234  dsb->selectAll();
4235 #endif
4236  }
4237  }
4238 
4239  return w;
4240 }
The QAbstractItemDelegate class is used to display and edit data items from a model.
virtual void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const
Updates the geometry of the editor for the item with the given index, according to the rectangle spec...
QWeakPointer< QWidget > widget
#define SLOT(a)
Definition: qobjectdefs.h:226
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
const QEditorInfo & editorForIndex(const QModelIndex &index) const
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
T * data() const
QWidget * focusProxy() const
Returns the focus proxy, or 0 if there is no focus proxy.
Definition: qwidget.cpp:6561
#define Q_Q(Class)
Definition: qglobal.h:2483
virtual QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
Returns the editor to be used for editing the data item with the given index.
#define SIGNAL(a)
Definition: qobjectdefs.h:227
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
The QAbstractItemView class provides the basic functionality for item view classes.
The QDoubleSpinBox class provides a spin box widget that takes doubles.
Definition: qspinbox.h:126
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
void installEventFilter(QObject *)
Installs an event filter filterObj on this object.
Definition: qobject.cpp:2070
QAbstractItemDelegate * delegateForIndex(const QModelIndex &index) const
The QSpinBox class provides a spin box widget.
Definition: qspinbox.h:56
The QLineEdit widget is a one-line text editor.
Definition: qlineedit.h:66
virtual void setEditorData(QWidget *editor, const QModelIndex &index) const
Sets the contents of the given editor to the data for the item at the given index.
static void setTabOrder(QWidget *, QWidget *)
Puts the second widget after the first widget in the focus order.
Definition: qwidget.cpp:6975
void addEditor(const QModelIndex &index, QWidget *editor, bool isStatic)

◆ editorForIndex()

const QEditorInfo & QAbstractItemViewPrivate::editorForIndex ( const QModelIndex index) const

Definition at line 4330 of file qabstractitemview.cpp.

4331 {
4332  static QEditorInfo nullInfo;
4333 
4334  // do not try to search to avoid slow implicit cast from QModelIndex to QPersistentModelIndex
4335  if (indexEditorHash.isEmpty())
4336  return nullInfo;
4337 
4339  if (it == indexEditorHash.end())
4340  return nullInfo;
4341 
4342  return it.value();
4343 }
#define it(className, varName)
bool isEmpty() const
Returns true if the hash contains no items; otherwise returns false.
Definition: qhash.h:297
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the hash...
Definition: qhash.h:467
iterator find(const Key &key)
Returns an iterator pointing to the item with the key in the hash.
Definition: qhash.h:865
QIndexEditorHash indexEditorHash

◆ executePostedLayout()

void QAbstractItemViewPrivate::executePostedLayout ( ) const
inline

Definition at line 209 of file qabstractitemview_p.h.

209  {
212  const_cast<QAbstractItemView*>(q_func())->doItemsLayout();
213  }
214  }
QAbstractItemView::State state
The QAbstractItemView class provides the basic functionality for item view classes.

◆ extendedSelectionCommand()

QItemSelectionModel::SelectionFlags QAbstractItemViewPrivate::extendedSelectionCommand ( const QModelIndex index,
const QEvent event 
) const

Definition at line 4001 of file qabstractitemview.cpp.

4003 {
4004  Qt::KeyboardModifiers modifiers = QApplication::keyboardModifiers();
4005  if (event) {
4006  switch (event->type()) {
4007  case QEvent::MouseMove: {
4008  // Toggle on MouseMove
4009  modifiers = static_cast<const QMouseEvent*>(event)->modifiers();
4010  if (modifiers & Qt::ControlModifier)
4012  break;
4013  }
4014  case QEvent::MouseButtonPress: {
4015  modifiers = static_cast<const QMouseEvent*>(event)->modifiers();
4016  const Qt::MouseButton button = static_cast<const QMouseEvent*>(event)->button();
4017  const bool rightButtonPressed = button & Qt::RightButton;
4018  const bool shiftKeyPressed = modifiers & Qt::ShiftModifier;
4019  const bool controlKeyPressed = modifiers & Qt::ControlModifier;
4020  const bool indexIsSelected = selectionModel->isSelected(index);
4021  if ((shiftKeyPressed || controlKeyPressed) && rightButtonPressed)
4023  if (!shiftKeyPressed && !controlKeyPressed && indexIsSelected)
4025  if (!index.isValid() && !rightButtonPressed && !shiftKeyPressed && !controlKeyPressed)
4027  if (!index.isValid())
4029  break;
4030  }
4032  // ClearAndSelect on MouseButtonRelease if MouseButtonPress on selected item or empty area
4033  modifiers = static_cast<const QMouseEvent*>(event)->modifiers();
4034  const Qt::MouseButton button = static_cast<const QMouseEvent*>(event)->button();
4035  const bool rightButtonPressed = button & Qt::RightButton;
4036  const bool shiftKeyPressed = modifiers & Qt::ShiftModifier;
4037  const bool controlKeyPressed = modifiers & Qt::ControlModifier;
4038  if (((index == pressedIndex && selectionModel->isSelected(index))
4040  && !shiftKeyPressed && !controlKeyPressed && (!rightButtonPressed || !index.isValid()))
4043  }
4044  case QEvent::KeyPress: {
4045  // NoUpdate on Key movement and Ctrl
4046  modifiers = static_cast<const QKeyEvent*>(event)->modifiers();
4047  switch (static_cast<const QKeyEvent*>(event)->key()) {
4048  case Qt::Key_Backtab:
4049  modifiers = modifiers & ~Qt::ShiftModifier; // special case for backtab
4050  case Qt::Key_Down:
4051  case Qt::Key_Up:
4052  case Qt::Key_Left:
4053  case Qt::Key_Right:
4054  case Qt::Key_Home:
4055  case Qt::Key_End:
4056  case Qt::Key_PageUp:
4057  case Qt::Key_PageDown:
4058  case Qt::Key_Tab:
4059  if (modifiers & Qt::ControlModifier
4060 #ifdef QT_KEYPAD_NAVIGATION
4061  // Preserve historical tab order navigation behavior
4062  || QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder
4063 #endif
4064  )
4066  break;
4067  case Qt::Key_Select:
4069  case Qt::Key_Space:// Toggle on Ctrl-Qt::Key_Space, Select on Space
4070  if (modifiers & Qt::ControlModifier)
4073  default:
4074  break;
4075  }
4076  }
4077  default:
4078  break;
4079  }
4080  }
4081 
4082  if (modifiers & Qt::ShiftModifier)
4084  if (modifiers & Qt::ControlModifier)
4087  //when drag-selecting we need to clear any previous selection and select the current one
4089  }
4090 
4092 }
The QKeyEvent class describes a key event.
Definition: qevent.h:224
EventRef event
QAbstractItemView::State state
QItemSelectionModel::SelectionFlags selectionBehaviorFlags() const
QPointer< QItemSelectionModel > selectionModel
QPersistentModelIndex pressedIndex
bool isSelected(const QModelIndex &index) const
Returns true if the given model item index is selected.
bool isValid() const
Returns true if this model index is valid; otherwise returns false.
The QMouseEvent class contains parameters that describe a mouse event.
Definition: qevent.h:85
static Qt::KeyboardModifiers keyboardModifiers()
Returns the current state of the modifier keys on the keyboard.
Definition: qnamespace.h:54
Type type() const
Returns the event type.
Definition: qcoreevent.h:303
MouseButton
Definition: qnamespace.h:150

◆ fetchMore()

void QAbstractItemViewPrivate::fetchMore ( )

Definition at line 4119 of file qabstractitemview.cpp.

4120 {
4121  fetchMoreTimer.stop();
4122  if (!model->canFetchMore(root))
4123  return;
4124  int last = model->rowCount(root) - 1;
4125  if (last < 0) {
4126  model->fetchMore(root);
4127  return;
4128  }
4129 
4130  QModelIndex index = model->index(last, 0, root);
4131  QRect rect = q_func()->visualRect(index);
4132  if (viewport->rect().intersects(rect))
4133  model->fetchMore(root);
4134 }
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const =0
Returns the number of rows under the given parent.
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const =0
Returns the index of the item in the model specified by the given row, column and parent index...
virtual bool canFetchMore(const QModelIndex &parent) const
Returns true if there is more data available for parent; otherwise returns false. ...
void stop()
Stops the timer.
QPersistentModelIndex root
virtual void fetchMore(const QModelIndex &parent)
Fetches any available data for the items with the parent specified by the parent index.
QRect rect
the internal geometry of the widget excluding any window frame
Definition: qwidget.h:168
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
quint16 index
bool intersects(const QRect &r) const
Returns true if this rectangle intersects with the given rectangle (i.
Definition: qrect.cpp:1429
QAbstractItemModel * model

◆ hasEditor()

bool QAbstractItemViewPrivate::hasEditor ( const QModelIndex index) const
inline

Definition at line 251 of file qabstractitemview_p.h.

251  {
252  return indexEditorHash.find(index) != indexEditorHash.constEnd();
253  }
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the hash...
Definition: qhash.h:469
iterator find(const Key &key)
Returns an iterator pointing to the item with the key in the hash.
Definition: qhash.h:865
QIndexEditorHash indexEditorHash

◆ indexForEditor()

QModelIndex QAbstractItemViewPrivate::indexForEditor ( QWidget editor) const

Definition at line 4345 of file qabstractitemview.cpp.

4346 {
4347  // do not try to search to avoid slow implicit cast from QModelIndex to QPersistentModelIndex
4348  if (indexEditorHash.isEmpty())
4349  return QModelIndex();
4350 
4352  if (it == editorIndexHash.end())
4353  return QModelIndex();
4354 
4355  return it.value();
4356 }
#define it(className, varName)
QEditorIndexHash editorIndexHash
bool isEmpty() const
Returns true if the hash contains no items; otherwise returns false.
Definition: qhash.h:297
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the hash...
Definition: qhash.h:467
The QModelIndex class is used to locate data in a data model.
iterator find(const Key &key)
Returns an iterator pointing to the item with the key in the hash.
Definition: qhash.h:865
QIndexEditorHash indexEditorHash

◆ init()

void QAbstractItemViewPrivate::init ( )

Definition at line 119 of file qabstractitemview.cpp.

120 {
122  q->setItemDelegate(new QStyledItemDelegate(q));
123 
124  vbar->setRange(0, 0);
125  hbar->setRange(0, 0);
126 
127  QObject::connect(vbar, SIGNAL(actionTriggered(int)),
128  q, SLOT(verticalScrollbarAction(int)));
129  QObject::connect(hbar, SIGNAL(actionTriggered(int)),
130  q, SLOT(horizontalScrollbarAction(int)));
131  QObject::connect(vbar, SIGNAL(valueChanged(int)),
132  q, SLOT(verticalScrollbarValueChanged(int)));
133  QObject::connect(hbar, SIGNAL(valueChanged(int)),
134  q, SLOT(horizontalScrollbarValueChanged(int)));
135 
137 
138  q->setAttribute(Qt::WA_InputMethodEnabled);
139 
140 #ifdef QT_SOFTKEYS_ENABLED
142 #endif
143 }
#define SLOT(a)
Definition: qobjectdefs.h:226
The QStyledItemDelegate class provides display and editing facilities for data items from a model...
void setRange(int min, int max)
Sets the slider&#39;s minimum to min and its maximum to max.
#define Q_Q(Class)
Definition: qglobal.h:2483
#define SIGNAL(a)
Definition: qobjectdefs.h:227
static QAction * createKeyedAction(StandardSoftKey standardKey, Qt::Key key, QWidget *actionWidget)
Creates a QAction and registers the &#39;triggered&#39; signal to send the given key event to actionWidget as...
void setBackgroundRole(QPalette::ColorRole)
Sets the background role of the widget to role.
Definition: qwidget.cpp:4708
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
The QAbstractItemView class provides the basic functionality for item view classes.

◆ interruptDelayedItemsLayout()

void QAbstractItemViewPrivate::interruptDelayedItemsLayout ( ) const

Definition at line 4195 of file qabstractitemview.cpp.

4196 {
4197  delayedLayout.stop();
4198  delayedPendingLayout = false;
4199 }
void stop()
Stops the timer.

◆ isAnimating()

bool QAbstractItemViewPrivate::isAnimating ( ) const
inline

Definition at line 259 of file qabstractitemview_p.h.

◆ isIndexDragEnabled()

bool QAbstractItemViewPrivate::isIndexDragEnabled ( const QModelIndex index) const
inline

Definition at line 289 of file qabstractitemview_p.h.

289  {
290  return (model->flags(index) & Qt::ItemIsDragEnabled);
291  }
virtual Qt::ItemFlags flags(const QModelIndex &index) const
Returns the item flags for the given index.
QAbstractItemModel * model

◆ isIndexDropEnabled()

bool QAbstractItemViewPrivate::isIndexDropEnabled ( const QModelIndex index) const
inline

Definition at line 286 of file qabstractitemview_p.h.

286  {
287  return (model->flags(index) & Qt::ItemIsDropEnabled);
288  }
virtual Qt::ItemFlags flags(const QModelIndex &index) const
Returns the item flags for the given index.
QAbstractItemModel * model

◆ isIndexEnabled()

bool QAbstractItemViewPrivate::isIndexEnabled ( const QModelIndex index) const
inline

Definition at line 283 of file qabstractitemview_p.h.

283  {
284  return (model->flags(index) & Qt::ItemIsEnabled);
285  }
virtual Qt::ItemFlags flags(const QModelIndex &index) const
Returns the item flags for the given index.
QAbstractItemModel * model

◆ isIndexSelectable()

bool QAbstractItemViewPrivate::isIndexSelectable ( const QModelIndex index) const
inline

Definition at line 280 of file qabstractitemview_p.h.

280  {
281  return (model->flags(index) & Qt::ItemIsSelectable);
282  }
virtual Qt::ItemFlags flags(const QModelIndex &index) const
Returns the item flags for the given index.
QAbstractItemModel * model

◆ isIndexValid()

bool QAbstractItemViewPrivate::isIndexValid ( const QModelIndex index) const
inline

Definition at line 277 of file qabstractitemview_p.h.

277  {
278  return (index.row() >= 0) && (index.column() >= 0) && (index.model() == model);
279  }
int row() const
Returns the row this model index refers to.
const QAbstractItemModel * model() const
Returns a pointer to the model containing the item that this index refers to.
QAbstractItemModel * model
int column() const
Returns the column this model index refers to.

◆ isPersistent()

bool QAbstractItemViewPrivate::isPersistent ( const QModelIndex index) const
inline

return true if the index is registered as a QPersistentModelIndex

Definition at line 333 of file qabstractitemview_p.h.

334  {
335  return static_cast<QAbstractItemModelPrivate *>(model->d_ptr.data())->persistent.indexes.contains(index);
336  }
T * data() const
Returns the value of the pointer referenced by this object.
bool contains(const T &value) const
Definition: qset.h:91
QScopedPointer< QObjectData > d_ptr
Definition: qobject.h:320
QAbstractItemModel * model

◆ multiSelectionCommand()

QItemSelectionModel::SelectionFlags QAbstractItemViewPrivate::multiSelectionCommand ( const QModelIndex index,
const QEvent event 
) const

Definition at line 3969 of file qabstractitemview.cpp.

3971 {
3972  Q_UNUSED(index)
3973 
3974  if (event) {
3975  switch (event->type()) {
3976  case QEvent::KeyPress:
3977  if (static_cast<const QKeyEvent*>(event)->key() == Qt::Key_Space
3978  || static_cast<const QKeyEvent*>(event)->key() == Qt::Key_Select)
3980  break;
3982  if (static_cast<const QMouseEvent*>(event)->button() == Qt::LeftButton)
3984  break;
3986  if (static_cast<const QMouseEvent*>(event)->button() == Qt::LeftButton)
3988  break;
3989  case QEvent::MouseMove:
3990  if (static_cast<const QMouseEvent*>(event)->buttons() & Qt::LeftButton)
3991  return QItemSelectionModel::ToggleCurrent|selectionBehaviorFlags(); // toggle drag select
3992  default:
3993  break;
3994  }
3996  }
3997 
3999 }
The QKeyEvent class describes a key event.
Definition: qevent.h:224
EventRef event
QItemSelectionModel::SelectionFlags selectionBehaviorFlags() const
int key
Type type() const
Returns the event type.
Definition: qcoreevent.h:303
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ offset()

QPoint QAbstractItemViewPrivate::offset ( ) const
inline

Definition at line 244 of file qabstractitemview_p.h.

Referenced by QIconModeViewBase::draggedItemsDelta(), QIconModeViewBase::filterDragMoveEvent(), and QIconModeViewBase::filterDropEvent().

244  {
245  const Q_Q(QAbstractItemView);
246  return QPoint(q->isRightToLeft() ? -q->horizontalOffset()
247  : q->horizontalOffset(), q->verticalOffset());
248  }
#define Q_Q(Class)
Definition: qglobal.h:2483
The QAbstractItemView class provides the basic functionality for item view classes.
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53

◆ openEditor()

bool QAbstractItemViewPrivate::openEditor ( const QModelIndex index,
QEvent event 
)

Definition at line 4385 of file qabstractitemview.cpp.

4386 {
4388 
4389  QModelIndex buddy = model->buddy(index);
4391  options.rect = q->visualRect(buddy);
4392  options.state |= (buddy == q->currentIndex() ? QStyle::State_HasFocus : QStyle::State_None);
4393 
4394  QWidget *w = editor(buddy, options);
4395  if (!w)
4396  return false;
4397 
4398  q->setState(QAbstractItemView::EditingState);
4399  w->show();
4400  w->setFocus();
4401 
4402  if (event)
4404 
4405  return true;
4406 }
EventRef event
QStyle::State state
the style flags that are used when drawing the control
Definition: qstyleoption.h:88
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
The QStyleOptionViewItemV4 class is used to describe the parameters necessary for drawing a frame in ...
Definition: qstyleoption.h:609
QWidget * focusProxy() const
Returns the focus proxy, or 0 if there is no focus proxy.
Definition: qwidget.cpp:6561
#define Q_Q(Class)
Definition: qglobal.h:2483
virtual QModelIndex buddy(const QModelIndex &index) const
Returns a model index for the buddy of the item represented by index.
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
void show()
Shows the widget and its child widgets.
void setFocus()
Gives the keyboard input focus to this widget (or its focus proxy) if this widget or one of its paren...
Definition: qwidget.h:432
The QAbstractItemView class provides the basic functionality for item view classes.
The QModelIndex class is used to locate data in a data model.
QWidget * editor(const QModelIndex &index, const QStyleOptionViewItem &options)
QStyleOptionViewItemV4 viewOptionsV4() const
QAbstractItemModel * model
QRect rect
the area that should be used for various calculations and painting
Definition: qstyleoption.h:90

◆ paintDropIndicator()

void QAbstractItemViewPrivate::paintDropIndicator ( QPainter painter)
inline

Definition at line 180 of file qabstractitemview_p.h.

181  {
183 #ifndef QT_NO_CURSOR
185 #endif
186  ) {
187  QStyleOption opt;
188  opt.init(q_func());
189  opt.rect = dropIndicatorRect;
190  q_func()->style()->drawPrimitive(QStyle::PE_IndicatorItemViewItemDrop, &opt, painter, q_func());
191  }
192  }
QAbstractItemView::State state
void init(const QWidget *w)
Use initFrom(widget) instead.
The QStyleOption class stores the parameters used by QStyle functions.
Definition: qstyleoption.h:67
#define QT_NO_CURSOR
QCursor cursor
the cursor shape for this widget
Definition: qwidget.h:183
QRect rect
the area that should be used for various calculations and painting
Definition: qstyleoption.h:90
Qt::CursorShape shape() const
Returns the cursor shape identifier.
Definition: qcursor.cpp:469

◆ position()

QAbstractItemView::DropIndicatorPosition QAbstractItemViewPrivate::position ( const QPoint pos,
const QRect rect,
const QModelIndex idx 
) const
virtual

Reimplemented in QListViewPrivate.

Definition at line 2206 of file qabstractitemview.cpp.

Referenced by QListViewPrivate::position(), and QHeaderViewPrivate::QHeaderViewPrivate().

2207 {
2209  if (!overwrite) {
2210  const int margin = 2;
2211  if (pos.y() - rect.top() < margin) {
2213  } else if (rect.bottom() - pos.y() < margin) {
2215  } else if (rect.contains(pos, true)) {
2217  }
2218  } else {
2219  QRect touchingRect = rect;
2220  touchingRect.adjust(-1, -1, 1, 1);
2221  if (touchingRect.contains(pos, false)) {
2223  }
2224  }
2225 
2228 
2229  return r;
2230 }
DropIndicatorPosition
This enum indicates the position of the drop indicator in relation to the index at the current mouse ...
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
virtual Qt::ItemFlags flags(const QModelIndex &index) const
Returns the item flags for the given index.
void adjust(int x1, int y1, int x2, int y2)
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
Definition: qrect.h:434
bool contains(const QPoint &p, bool proper=false) const
Returns true if the given point is inside or on the edge of the rectangle, otherwise returns false...
Definition: qrect.cpp:1101
QPoint center() const
Returns the center point of the rectangle.
Definition: qrect.h:300
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
quint16 index
QAbstractItemModel * model

◆ releaseEditor()

void QAbstractItemViewPrivate::releaseEditor ( QWidget editor) const
inline

Definition at line 199 of file qabstractitemview_p.h.

199  {
200  if (editor) {
201  QObject::disconnect(editor, SIGNAL(destroyed(QObject*)),
202  q_func(), SLOT(editorDestroyed(QObject*)));
204  editor->hide();
205  editor->deleteLater();
206  }
207  }
#define SLOT(a)
Definition: qobjectdefs.h:226
void removeEventFilter(QObject *)
Removes an event filter object obj from this object.
Definition: qobject.cpp:2099
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
#define SIGNAL(a)
Definition: qobjectdefs.h:227
void hide()
Hides the widget.
Definition: qwidget.h:501
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.
Definition: qobject.cpp:2895
QPointer< QAbstractItemDelegate > itemDelegate
void deleteLater()
Schedules this object for deletion.
Definition: qobject.cpp:2145

◆ removeEditor()

void QAbstractItemViewPrivate::removeEditor ( QWidget editor)

Definition at line 4358 of file qabstractitemview.cpp.

4359 {
4361  if (it != editorIndexHash.end())
4362  {
4363  indexEditorHash.remove(it.value());
4364  editorIndexHash.erase(it);
4365  }
4366 }
int remove(const Key &key)
Removes all the items that have the key from the hash.
Definition: qhash.h:784
#define it(className, varName)
QEditorIndexHash editorIndexHash
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the hash...
Definition: qhash.h:467
iterator find(const Key &key)
Returns an iterator pointing to the item with the key in the hash.
Definition: qhash.h:865
iterator erase(iterator it)
Removes the (key, value) pair associated with the iterator pos from the hash, and returns an iterator...
Definition: qhash.h:827
QIndexEditorHash indexEditorHash

◆ renderToPixmap()

QPixmap QAbstractItemViewPrivate::renderToPixmap ( const QModelIndexList indexes,
QRect r 
) const

Definition at line 4433 of file qabstractitemview.cpp.

4434 {
4435  Q_ASSERT(r);
4436  QItemViewPaintPairs paintPairs = draggablePaintPairs(indexes, r);
4437  if (paintPairs.isEmpty())
4438  return QPixmap();
4439  QPixmap pixmap(r->size());
4440  pixmap.fill(Qt::transparent);
4441  QPainter painter(&pixmap);
4443  option.state |= QStyle::State_Selected;
4444  for (int j = 0; j < paintPairs.count(); ++j) {
4445  option.rect = paintPairs.at(j).first.translated(-r->topLeft());
4446  const QModelIndex &current = paintPairs.at(j).second;
4447  adjustViewOptionsForIndex(&option, current);
4448  delegateForIndex(current)->paint(&painter, option, current);
4449  }
4450  return pixmap;
4451 }
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const =0
This pure abstract function must be reimplemented if you want to provide custom rendering.
QStyle::State state
the style flags that are used when drawing the control
Definition: qstyleoption.h:88
The QStyleOptionViewItemV4 class is used to describe the parameters necessary for drawing a frame in ...
Definition: qstyleoption.h:609
virtual QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
QSize size() const
Returns the size of the rectangle.
Definition: qrect.h:309
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
void fill(const QColor &fillColor=Qt::white)
Fills the pixmap with the given color.
Definition: qpixmap.cpp:1080
The QModelIndex class is used to locate data in a data model.
QAbstractItemDelegate * delegateForIndex(const QModelIndex &index) const
QStyleOptionViewItemV4 viewOptionsV4() const
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
virtual void adjustViewOptionsForIndex(QStyleOptionViewItemV4 *, const QModelIndex &) const
QRect rect
the area that should be used for various calculations and painting
Definition: qstyleoption.h:90
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

◆ scrollContentsBy()

void QAbstractItemViewPrivate::scrollContentsBy ( int  dx,
int  dy 
)
inline

Definition at line 228 of file qabstractitemview_p.h.

228  {
229  scrollDirtyRegion(dx, dy);
230  viewport->scroll(dx, dy);
231  }
void scroll(int dx, int dy)
Scrolls the widget including its children dx pixels to the right and dy downward. ...
Definition: qwidget.cpp:10684
void scrollDirtyRegion(int dx, int dy)

◆ scrollDirtyRegion()

void QAbstractItemViewPrivate::scrollDirtyRegion ( int  dx,
int  dy 
)
inline

Definition at line 222 of file qabstractitemview_p.h.

222  {
223  scrollDelayOffset = QPoint(-dx, -dy);
225  scrollDelayOffset = QPoint(0, 0);
226  }
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53

◆ selectAll()

void QAbstractItemViewPrivate::selectAll ( QItemSelectionModel::SelectionFlags  command)
virtual

Reimplemented in QListViewPrivate.

Definition at line 4453 of file qabstractitemview.cpp.

4454 {
4455  if (!selectionModel)
4456  return;
4457 
4458  QItemSelection selection;
4459  QModelIndex tl = model->index(0, 0, root);
4460  QModelIndex br = model->index(model->rowCount(root) - 1,
4461  model->columnCount(root) - 1,
4462  root);
4463  selection.append(QItemSelectionRange(tl, br));
4464  selectionModel->select(selection, command);
4465 }
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const =0
Returns the number of columns for the children of the given parent.
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const =0
Returns the number of rows under the given parent.
The QItemSelectionRange class manages information about a range of selected items in a model...
QPointer< QItemSelectionModel > selectionModel
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const =0
Returns the index of the item in the model specified by the given row, column and parent index...
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
QPersistentModelIndex root
The QItemSelection class manages information about selected items in a model.
virtual void select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)
Selects the model item index using the specified command, and emits selectionChanged().
The QModelIndex class is used to locate data in a data model.
QAbstractItemModel * model

◆ selectedDraggableIndexes()

QModelIndexList QAbstractItemViewPrivate::selectedDraggableIndexes ( ) const

Definition at line 4467 of file qabstractitemview.cpp.

4468 {
4469  Q_Q(const QAbstractItemView);
4470  QModelIndexList indexes = q->selectedIndexes();
4471  for(int i = indexes.count() - 1 ; i >= 0; --i) {
4472  if (!isIndexDragEnabled(indexes.at(i)))
4473  indexes.removeAt(i);
4474  }
4475  return indexes;
4476 }
bool isIndexDragEnabled(const QModelIndex &index) const
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
#define Q_Q(Class)
Definition: qglobal.h:2483
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
The QAbstractItemView class provides the basic functionality for item view classes.
void removeAt(int i)
Removes the item at index position i.
Definition: qlist.h:480

◆ selectionAllowed()

virtual bool QAbstractItemViewPrivate::selectionAllowed ( const QModelIndex index) const
inlinevirtual

Reimplemented in QListViewPrivate.

Definition at line 293 of file qabstractitemview_p.h.

293  {
294  // in some views we want to go ahead with selections, even if the index is invalid
295  return isIndexValid(index) && isIndexSelectable(index);
296  }
bool isIndexSelectable(const QModelIndex &index) const
bool isIndexValid(const QModelIndex &index) const

◆ selectionBehaviorFlags()

QItemSelectionModel::SelectionFlags QAbstractItemViewPrivate::selectionBehaviorFlags ( ) const
inline

◆ sendDelegateEvent()

bool QAbstractItemViewPrivate::sendDelegateEvent ( const QModelIndex index,
QEvent event 
) const

Definition at line 4374 of file qabstractitemview.cpp.

4375 {
4376  Q_Q(const QAbstractItemView);
4377  QModelIndex buddy = model->buddy(index);
4379  options.rect = q->visualRect(buddy);
4380  options.state |= (buddy == q->currentIndex() ? QStyle::State_HasFocus : QStyle::State_None);
4381  QAbstractItemDelegate *delegate = delegateForIndex(index);
4382  return (event && delegate && delegate->editorEvent(event, model, options, buddy));
4383 }
The QAbstractItemDelegate class is used to display and edit data items from a model.
QStyle::State state
the style flags that are used when drawing the control
Definition: qstyleoption.h:88
The QStyleOptionViewItemV4 class is used to describe the parameters necessary for drawing a frame in ...
Definition: qstyleoption.h:609
virtual bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index)
When editing of an item starts, this function is called with the event that triggered the editing...
#define Q_Q(Class)
Definition: qglobal.h:2483
virtual QModelIndex buddy(const QModelIndex &index) const
Returns a model index for the buddy of the item represented by index.
The QAbstractItemView class provides the basic functionality for item view classes.
The QModelIndex class is used to locate data in a data model.
QAbstractItemDelegate * delegateForIndex(const QModelIndex &index) const
QStyleOptionViewItemV4 viewOptionsV4() const
QAbstractItemModel * model
QRect rect
the area that should be used for various calculations and painting
Definition: qstyleoption.h:90

◆ setDirtyRegion()

void QAbstractItemViewPrivate::setDirtyRegion ( const QRegion visualRegion)
inline

Definition at line 216 of file qabstractitemview_p.h.

216  {
217  updateRegion += visualRegion;
218  if (!updateTimer.isActive())
219  updateTimer.start(0, q_func());
220  }
bool isActive() const
Returns true if the timer is running and has not been stopped; otherwise returns false.
Definition: qbasictimer.h:62
void start(int msec, QObject *obj)
Starts (or restarts) the timer with a msec milliseconds timeout.

◆ setHoverIndex()

void QAbstractItemViewPrivate::setHoverIndex ( const QPersistentModelIndex index)

Definition at line 145 of file qabstractitemview.cpp.

Referenced by checkMouseMove().

146 {
148  if (hover == index)
149  return;
150 
152  q->update(hover); //update the old one
153  q->update(index); //update the new one
154  } else {
155  QRect oldHoverRect = q->visualRect(hover);
156  QRect newHoverRect = q->visualRect(index);
157  viewport->update(QRect(0, newHoverRect.y(), viewport->width(), newHoverRect.height()));
158  viewport->update(QRect(0, oldHoverRect.y(), viewport->width(), oldHoverRect.height()));
159  }
160  hover = index;
161 }
QPersistentModelIndex hover
int width
the width of the widget excluding any window frame
Definition: qwidget.h:166
QAbstractItemView::SelectionBehavior selectionBehavior
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
#define Q_Q(Class)
Definition: qglobal.h:2483
void update()
Updates the widget unless updates are disabled or the widget is hidden.
Definition: qwidget.cpp:10883
The QAbstractItemView class provides the basic functionality for item view classes.
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
quint16 index

◆ shouldAutoScroll()

bool QAbstractItemViewPrivate::shouldAutoScroll ( const QPoint pos) const

Definition at line 4176 of file qabstractitemview.cpp.

4177 {
4178  if (!autoScroll)
4179  return false;
4180  QRect area = static_cast<QAbstractItemView*>(viewport)->d_func()->clipRect(); // access QWidget private by bending C++ rules
4181  return (pos.y() - area.top() < autoScrollMargin)
4182  || (area.bottom() - pos.y() < autoScrollMargin)
4183  || (pos.x() - area.left() < autoScrollMargin)
4184  || (area.right() - pos.x() < autoScrollMargin);
4185 }
int left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:240
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
The QAbstractItemView class provides the basic functionality for item view classes.
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
int right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:246
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
static int area(const QSize &s)
Definition: qicon.cpp:155

◆ shouldEdit()

bool QAbstractItemViewPrivate::shouldEdit ( QAbstractItemView::EditTrigger  trigger,
const QModelIndex index 
) const

Definition at line 4136 of file qabstractitemview.cpp.

4138 {
4139  if (!index.isValid())
4140  return false;
4141  Qt::ItemFlags flags = model->flags(index);
4142  if (((flags & Qt::ItemIsEditable) == 0) || ((flags & Qt::ItemIsEnabled) == 0))
4143  return false;
4145  return false;
4146  if (hasEditor(index))
4147  return false;
4148  if (trigger == QAbstractItemView::AllEditTriggers) // force editing
4149  return true;
4151  && !selectionModel->isSelected(index))
4152  return false;
4153  return (trigger & editTriggers);
4154 }
bool hasEditor(const QModelIndex &index) const
QAbstractItemView::State state
QPointer< QItemSelectionModel > selectionModel
virtual Qt::ItemFlags flags(const QModelIndex &index) const
Returns the item flags for the given index.
bool isSelected(const QModelIndex &index) const
Returns true if the given model item index is selected.
bool isValid() const
Returns true if this model index is valid; otherwise returns false.
QAbstractItemView::EditTriggers editTriggers
QAbstractItemModel * model

◆ shouldForwardEvent()

bool QAbstractItemViewPrivate::shouldForwardEvent ( QAbstractItemView::EditTrigger  trigger,
const QEvent event 
) const

Definition at line 4156 of file qabstractitemview.cpp.

4158 {
4159  if (!event || (trigger & editTriggers) != QAbstractItemView::AnyKeyPressed)
4160  return false;
4161 
4162  switch (event->type()) {
4163  case QEvent::KeyPress:
4167  case QEvent::MouseMove:
4168  return true;
4169  default:
4170  break;
4171  };
4172 
4173  return false;
4174 }
QAbstractItemView::EditTriggers editTriggers
Type type() const
Returns the event type.
Definition: qcoreevent.h:303

◆ startAutoScroll()

void QAbstractItemViewPrivate::startAutoScroll ( )
inline

Definition at line 127 of file qabstractitemview_p.h.

128  { // ### it would be nice to make this into a style hint one day
129  int scrollInterval = (verticalScrollMode == QAbstractItemView::ScrollPerItem) ? 150 : 50;
130  autoScrollTimer.start(scrollInterval, q_func());
131  autoScrollCount = 0;
132  }
QAbstractItemView::ScrollMode verticalScrollMode
void start(int msec, QObject *obj)
Starts (or restarts) the timer with a msec milliseconds timeout.

◆ stopAutoScroll()

void QAbstractItemViewPrivate::stopAutoScroll ( )
inline

Definition at line 133 of file qabstractitemview_p.h.

◆ updateDirtyRegion()

void QAbstractItemViewPrivate::updateDirtyRegion ( )
inline

Definition at line 233 of file qabstractitemview_p.h.

233  {
234  updateTimer.stop();
236  updateRegion = QRegion();
237  }
void update()
Updates the widget unless updates are disabled or the widget is hidden.
Definition: qwidget.cpp:10883
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
void stop()
Stops the timer.

◆ updateEditorData()

void QAbstractItemViewPrivate::updateEditorData ( const QModelIndex topLeft,
const QModelIndex bottomRight 
)

Definition at line 4242 of file qabstractitemview.cpp.

4243 {
4244  // we are counting on having relatively few editors
4245  const bool checkIndexes = tl.isValid() && br.isValid();
4246  const QModelIndex parent = tl.parent();
4248  for (; it != indexEditorHash.constEnd(); ++it) {
4249  QWidget *editor = it.value().widget.data();
4250  const QModelIndex index = it.key();
4251  if (it.value().isStatic || !editor || !index.isValid() ||
4252  (checkIndexes
4253  && (index.row() < tl.row() || index.row() > br.row()
4254  || index.column() < tl.column() || index.column() > br.column()
4255  || index.parent() != parent)))
4256  continue;
4257 
4258  QAbstractItemDelegate *delegate = delegateForIndex(index);
4259  if (delegate) {
4260  delegate->setEditorData(editor, index);
4261  }
4262  }
4263 }
The QAbstractItemDelegate class is used to display and edit data items from a model.
#define it(className, varName)
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QModelIndex parent() const
Returns the parent of the model index, or QModelIndex() if it has no parent.
int row() const
Returns the row this model index refers to.
QWidgetData * data
Definition: qwidget.h:815
bool isValid() const
Returns true if this model index is valid; otherwise returns false.
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the hash.
Definition: qhash.h:466
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the hash...
Definition: qhash.h:469
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
The QModelIndex class is used to locate data in a data model.
QAbstractItemDelegate * delegateForIndex(const QModelIndex &index) const
QWidget * editor(const QModelIndex &index, const QStyleOptionViewItem &options)
quint16 index
QObject * parent
Definition: qobject.h:92
virtual void setEditorData(QWidget *editor, const QModelIndex &index) const
Sets the contents of the given editor to the data for the item at the given index.
QIndexEditorHash indexEditorHash
int column() const
Returns the column this model index refers to.

◆ viewOptionsV4()

QStyleOptionViewItemV4 QAbstractItemViewPrivate::viewOptionsV4 ( ) const

Definition at line 3770 of file qabstractitemview.cpp.

3771 {
3772  Q_Q(const QAbstractItemView);
3773  QStyleOptionViewItemV4 option = q->viewOptions();
3774  if (wrapItemText)
3776  option.locale = q->locale();
3778  option.widget = q;
3779  return option;
3780 }
The QStyleOptionViewItemV4 class is used to describe the parameters necessary for drawing a frame in ...
Definition: qstyleoption.h:609
void setNumberOptions(NumberOptions options)
Sets the options related to number conversions for this QLocale instance.
Definition: qlocale.cpp:786
#define Q_Q(Class)
Definition: qglobal.h:2483
ViewItemFeatures features
a bitwise OR of the features that describe this view item
Definition: qstyleoption.h:577
The QAbstractItemView class provides the basic functionality for item view classes.
const QWidget * widget
Definition: qstyleoption.h:596

Properties

◆ alternatingColors

bool QAbstractItemViewPrivate::alternatingColors

Definition at line 411 of file qabstractitemview_p.h.

◆ autoScroll

bool QAbstractItemViewPrivate::autoScroll

Definition at line 404 of file qabstractitemview_p.h.

◆ autoScrollCount

int QAbstractItemViewPrivate::autoScrollCount

Definition at line 407 of file qabstractitemview_p.h.

◆ autoScrollMargin

int QAbstractItemViewPrivate::autoScrollMargin

Definition at line 406 of file qabstractitemview_p.h.

◆ autoScrollTimer

QBasicTimer QAbstractItemViewPrivate::autoScrollTimer

Definition at line 405 of file qabstractitemview_p.h.

◆ columnDelegates

QMap<int, QPointer<QAbstractItemDelegate> > QAbstractItemViewPrivate::columnDelegates

Definition at line 354 of file qabstractitemview_p.h.

◆ ctrlDragSelectionFlag

QItemSelectionModel::SelectionFlag QAbstractItemViewPrivate::ctrlDragSelectionFlag

Definition at line 356 of file qabstractitemview_p.h.

◆ currentIndexSet

bool QAbstractItemViewPrivate::currentIndexSet

Definition at line 427 of file qabstractitemview_p.h.

◆ currentlyCommittingEditor

QWidget* QAbstractItemViewPrivate::currentlyCommittingEditor

Definition at line 365 of file qabstractitemview_p.h.

◆ defaultDropAction

Qt::DropAction QAbstractItemViewPrivate::defaultDropAction

Definition at line 394 of file qabstractitemview_p.h.

◆ delayedAutoScroll

QBasicTimer QAbstractItemViewPrivate::delayedAutoScroll

Definition at line 421 of file qabstractitemview_p.h.

◆ delayedEditing

QBasicTimer QAbstractItemViewPrivate::delayedEditing

Definition at line 420 of file qabstractitemview_p.h.

◆ delayedLayout

QBasicTimer QAbstractItemViewPrivate::delayedLayout
mutableprivate

Definition at line 434 of file qabstractitemview_p.h.

◆ delayedPendingLayout

bool QAbstractItemViewPrivate::delayedPendingLayout
mutable

Definition at line 430 of file qabstractitemview_p.h.

◆ delayedReset

QBasicTimer QAbstractItemViewPrivate::delayedReset

Definition at line 422 of file qabstractitemview_p.h.

◆ dragDropMode

QAbstractItemView::DragDropMode QAbstractItemViewPrivate::dragDropMode

Definition at line 391 of file qabstractitemview_p.h.

◆ dragEnabled

bool QAbstractItemViewPrivate::dragEnabled

Definition at line 390 of file qabstractitemview_p.h.

◆ dropIndicatorPosition

QAbstractItemView::DropIndicatorPosition QAbstractItemViewPrivate::dropIndicatorPosition

Definition at line 393 of file qabstractitemview_p.h.

◆ dropIndicatorRect

QRect QAbstractItemViewPrivate::dropIndicatorRect

Definition at line 389 of file qabstractitemview_p.h.

◆ editorIndexHash

QEditorIndexHash QAbstractItemViewPrivate::editorIndexHash

Definition at line 362 of file qabstractitemview_p.h.

◆ editTriggers

QAbstractItemView::EditTriggers QAbstractItemViewPrivate::editTriggers

Definition at line 379 of file qabstractitemview_p.h.

◆ enteredIndex

QPersistentModelIndex QAbstractItemViewPrivate::enteredIndex

Definition at line 367 of file qabstractitemview_p.h.

Referenced by checkMouseMove().

◆ fetchMoreTimer

QBasicTimer QAbstractItemViewPrivate::fetchMoreTimer
mutableprivate

Definition at line 435 of file qabstractitemview_p.h.

◆ horizontalScrollMode

QAbstractItemView::ScrollMode QAbstractItemViewPrivate::horizontalScrollMode

◆ hover

QPersistentModelIndex QAbstractItemViewPrivate::hover

Definition at line 383 of file qabstractitemview_p.h.

Referenced by setHoverIndex().

◆ iconSize

QSize QAbstractItemViewPrivate::iconSize

Definition at line 413 of file qabstractitemview_p.h.

◆ indexEditorHash

QIndexEditorHash QAbstractItemViewPrivate::indexEditorHash

Definition at line 363 of file qabstractitemview_p.h.

◆ itemDelegate

QPointer<QAbstractItemDelegate> QAbstractItemViewPrivate::itemDelegate

Definition at line 352 of file qabstractitemview_p.h.

◆ keyboardInput

QString QAbstractItemViewPrivate::keyboardInput

Definition at line 401 of file qabstractitemview_p.h.

◆ keyboardInputTime

QElapsedTimer QAbstractItemViewPrivate::keyboardInputTime

Definition at line 402 of file qabstractitemview_p.h.

Referenced by QAbstractItemViewPrivate().

◆ lastTrigger

QAbstractItemView::EditTrigger QAbstractItemViewPrivate::lastTrigger

Definition at line 380 of file qabstractitemview_p.h.

◆ model

QAbstractItemModel* QAbstractItemViewPrivate::model

◆ moveCursorUpdatedView

bool QAbstractItemViewPrivate::moveCursorUpdatedView

Definition at line 431 of file qabstractitemview_p.h.

◆ noSelectionOnMousePress

bool QAbstractItemViewPrivate::noSelectionOnMousePress

Definition at line 357 of file qabstractitemview_p.h.

◆ overwrite

bool QAbstractItemViewPrivate::overwrite

Definition at line 392 of file qabstractitemview_p.h.

◆ persistent

QSet<QWidget*> QAbstractItemViewPrivate::persistent

Definition at line 364 of file qabstractitemview_p.h.

◆ pressedAlreadySelected

bool QAbstractItemViewPrivate::pressedAlreadySelected

Definition at line 371 of file qabstractitemview_p.h.

◆ pressedIndex

QPersistentModelIndex QAbstractItemViewPrivate::pressedIndex

Definition at line 368 of file qabstractitemview_p.h.

◆ pressedModifiers

Qt::KeyboardModifiers QAbstractItemViewPrivate::pressedModifiers

Definition at line 369 of file qabstractitemview_p.h.

◆ pressedPosition

QPoint QAbstractItemViewPrivate::pressedPosition

Definition at line 370 of file qabstractitemview_p.h.

Referenced by QIconModeViewBase::draggedItemsDelta().

◆ root

QPersistentModelIndex QAbstractItemViewPrivate::root

◆ rowDelegates

QMap<int, QPointer<QAbstractItemDelegate> > QAbstractItemViewPrivate::rowDelegates

Definition at line 353 of file qabstractitemview_p.h.

◆ scrollDelayOffset

QPoint QAbstractItemViewPrivate::scrollDelayOffset

Definition at line 417 of file qabstractitemview_p.h.

◆ selectionBehavior

QAbstractItemView::SelectionBehavior QAbstractItemViewPrivate::selectionBehavior

Definition at line 360 of file qabstractitemview_p.h.

Referenced by setHoverIndex().

◆ selectionMode

QAbstractItemView::SelectionMode QAbstractItemViewPrivate::selectionMode

Definition at line 359 of file qabstractitemview_p.h.

◆ selectionModel

QPointer<QItemSelectionModel> QAbstractItemViewPrivate::selectionModel

◆ shouldClearStatusTip

bool QAbstractItemViewPrivate::shouldClearStatusTip

Definition at line 409 of file qabstractitemview_p.h.

Referenced by checkMouseMove().

◆ shouldScrollToCurrentOnShow

bool QAbstractItemViewPrivate::shouldScrollToCurrentOnShow

Definition at line 408 of file qabstractitemview_p.h.

◆ showDropIndicator

bool QAbstractItemViewPrivate::showDropIndicator

Definition at line 388 of file qabstractitemview_p.h.

◆ state

QAbstractItemView::State QAbstractItemViewPrivate::state

Definition at line 377 of file qabstractitemview_p.h.

◆ stateBeforeAnimation

QAbstractItemView::State QAbstractItemViewPrivate::stateBeforeAnimation

Definition at line 378 of file qabstractitemview_p.h.

◆ tabKeyNavigation

bool QAbstractItemViewPrivate::tabKeyNavigation

Definition at line 385 of file qabstractitemview_p.h.

◆ textElideMode

Qt::TextElideMode QAbstractItemViewPrivate::textElideMode

Definition at line 414 of file qabstractitemview_p.h.

◆ updateRegion

QRegion QAbstractItemViewPrivate::updateRegion

Definition at line 416 of file qabstractitemview_p.h.

◆ updateTimer

QBasicTimer QAbstractItemViewPrivate::updateTimer

Definition at line 419 of file qabstractitemview_p.h.

◆ verticalScrollMode

QAbstractItemView::ScrollMode QAbstractItemViewPrivate::verticalScrollMode

◆ viewportEnteredNeeded

bool QAbstractItemViewPrivate::viewportEnteredNeeded

Definition at line 375 of file qabstractitemview_p.h.

Referenced by checkMouseMove().

◆ wrapItemText

bool QAbstractItemViewPrivate::wrapItemText

Definition at line 429 of file qabstractitemview_p.h.


The documentation for this class was generated from the following files: