44 #ifndef QT_NO_ITEMVIEWS 59 #include <private/qabstractitemview_p.h> 60 #include <private/qabstractitemmodel_p.h> 61 #ifndef QT_NO_ACCESSIBILITY 65 #include <private/qsoftkeymanager_p.h> 74 noSelectionOnMousePress(false),
77 currentlyCommittingEditor(0),
79 pressedPosition(
QPoint(-1, -1)),
80 pressedAlreadySelected(false),
81 viewportEnteredNeeded(false),
86 tabKeyNavigation(false),
88 showDropIndicator(true),
95 #ifdef QT_SOFTKEYS_ENABLED
101 shouldScrollToCurrentOnShow(false),
102 shouldClearStatusTip(false),
103 alternatingColors(false),
107 currentIndexSet(false),
109 delayedPendingLayout(true),
110 moveCursorUpdatedView(false)
128 q,
SLOT(verticalScrollbarAction(
int)));
130 q,
SLOT(horizontalScrollbarAction(
int)));
132 q,
SLOT(verticalScrollbarValueChanged(
int)));
134 q,
SLOT(horizontalScrollbarValueChanged(
int)));
140 #ifdef QT_SOFTKEYS_ENABLED 156 QRect newHoverRect = q->visualRect(index);
172 emit q->entered(index);
173 #ifndef QT_NO_STATUSTIP 182 #ifndef QT_NO_STATUSTIP 189 emit q->viewportEntered();
662 d->delayedReset.stop();
663 d->updateTimer.stop();
664 d->delayedEditing.stop();
665 d->delayedAutoScroll.stop();
666 d->autoScrollTimer.stop();
667 d->delayedLayout.stop();
668 d->fetchMoreTimer.stop();
694 if (model ==
d->model)
698 this,
SLOT(_q_modelDestroyed()));
702 this,
SLOT(_q_headerDataChanged()));
724 Q_ASSERT_X(
d->model->index(0,0) ==
d->model->index(0,0),
725 "QAbstractItemView::setModel",
726 "A model should return the exact same index " 727 "(including its internal id/pointer) when asked for it twice in a row.");
728 Q_ASSERT_X(!
d->model->index(0,0).parent().isValid(),
729 "QAbstractItemView::setModel",
730 "The parent of a top level index should be invalid");
734 this,
SLOT(_q_modelDestroyed()));
738 this,
SLOT(_q_headerDataChanged()));
794 if (selectionModel->
model() !=
d->model) {
795 qWarning(
"QAbstractItemView::setSelectionModel() failed: " 796 "Trying to set a selection model, which works on " 797 "a different model than the view.");
801 if (
d->selectionModel) {
810 if (
d->selectionModel) {
826 return d->selectionModel;
847 if (delegate ==
d->itemDelegate)
850 if (
d->itemDelegate) {
851 if (
d->delegateRefCount(
d->itemDelegate) == 1) {
860 if (
d->delegateRefCount(delegate) == 0) {
864 qRegisterMetaType<QModelIndex>(
"QModelIndex");
868 d->itemDelegate = delegate;
880 return d_func()->itemDelegate;
922 if (
d->delegateRefCount(rowDelegate) == 1) {
927 d->rowDelegates.remove(row);
930 if (
d->delegateRefCount(delegate) == 0) {
935 d->rowDelegates.insert(row, delegate);
955 return d->rowDelegates.value(row, 0);
985 if (
d->delegateRefCount(columnDelegate) == 1) {
990 d->columnDelegates.remove(column);
993 if (
d->delegateRefCount(delegate) == 0) {
998 d->columnDelegates.insert(column, delegate);
1018 return d->columnDelegates.value(column, 0);
1028 return d->delegateForIndex(index);
1047 d->selectionMode = mode;
1053 return d->selectionMode;
1072 d->selectionBehavior = behavior;
1078 return d->selectionBehavior;
1098 if (
d->selectionModel && (!index.
isValid() ||
d->isIndexEnabled(index))) {
1100 d->selectionModel->setCurrentIndex(index, command);
1101 d->currentIndexSet =
true;
1115 return d->selectionModel ?
d->selectionModel->currentIndex() :
QModelIndex();
1131 d->delayedReset.stop();
1136 d->editorIndexHash.clear();
1137 d->indexEditorHash.clear();
1138 d->persistent.clear();
1139 d->currentIndexSet =
false;
1142 if (
d->selectionModel)
1143 d->selectionModel->reset();
1144 #ifndef QT_NO_ACCESSIBILITY 1163 qWarning(
"QAbstractItemView::setRootIndex failed : index must be from the currently set model");
1167 d->doDelayedItemsLayout();
1194 |
d->selectionBehaviorFlags());
1214 if (!
d->isIndexValid(index))
1215 qWarning(
"edit: index was invalid");
1228 if (
d->selectionModel)
1229 d->selectionModel->clearSelection();
1244 d->interruptDelayedItemsLayout();
1246 d->viewport->update();
1270 return d->editTriggers;
1288 if (mode ==
d->verticalScrollMode)
1291 d->verticalScrollMode = mode;
1299 return d->verticalScrollMode;
1317 d->horizontalScrollMode = mode;
1324 return d->horizontalScrollMode;
1327 #ifndef QT_NO_DRAGANDDROP 1355 d->overwrite = overwrite;
1361 return d->overwrite;
1385 d->autoScroll = enable;
1391 return d->autoScroll;
1408 d->autoScrollMargin = margin;
1414 return d->autoScrollMargin;
1428 d->tabKeyNavigation = enable;
1434 return d->tabKeyNavigation;
1437 #ifndef QT_NO_DRAGANDDROP 1451 d->showDropIndicator = enable;
1457 return d->showDropIndicator;
1473 d->dragEnabled = enable;
1479 return d->dragEnabled;
1518 d->dragDropMode = behavior;
1562 d->defaultDropAction = dropAction;
1568 return d->defaultDropAction;
1571 #endif // QT_NO_DRAGANDDROP 1589 d->alternatingColors = enable;
1591 d->viewport->update();
1597 return d->alternatingColors;
1613 if (size ==
d->iconSize)
1616 d->doDelayedItemsLayout();
1638 d->textElideMode = mode;
1643 return d_func()->textElideMode;
1652 if (
d->tabKeyNavigation &&
isEnabled() &&
d->viewport->isEnabled()) {
1667 switch (event->
type()) {
1671 d->executePostedLayout();
1674 d->executePostedLayout();
1675 if (
d->shouldScrollToCurrentOnShow) {
1676 d->shouldScrollToCurrentOnShow =
false;
1693 d->checkPersistentEditorFocus();
1696 d->doDelayedItemsLayout();
1698 #ifdef QT_SOFTKEYS_ENABLED 1720 switch (event->
type()) {
1723 d->setHoverIndex(
indexAt(static_cast<QHoverEvent*>(event)->
pos()));
1729 d->viewportEnteredNeeded =
true;
1732 #ifndef QT_NO_STATUSTIP 1733 if (
d->shouldClearStatusTip &&
d->parent) {
1737 d->shouldClearStatusTip =
false;
1750 bool retval =
false;
1761 d->doDelayedItemsLayout();
1765 d->viewport->update();
1781 d->delayedAutoScroll.stop();
1785 if (!
d->selectionModel
1789 d->pressedAlreadySelected =
d->selectionModel->isSelected(index);
1791 d->pressedModifiers =
event->modifiers();
1792 QItemSelectionModel::SelectionFlags command =
selectionCommand(index, event);
1796 d->pressedPosition = pos + offset;
1803 if (index.
isValid() &&
d->isIndexEnabled(index)) {
1807 d->autoScroll =
false;
1810 QRect rect(
d->pressedPosition - offset, pos);
1814 command |=
d->ctrlDragSelectionFlag;
1820 if (
d->autoScroll) {
1841 QPoint bottomRight =
event->pos();
1846 #ifndef QT_NO_DRAGANDDROP 1848 topLeft =
d->pressedPosition -
d->offset();
1857 #endif // QT_NO_DRAGANDDROP 1866 topLeft =
d->pressedPosition -
d->offset();
1868 topLeft = bottomRight;
1870 d->checkMouseMove(index);
1872 #ifndef QT_NO_DRAGANDDROP 1873 if (
d->pressedIndex.isValid()
1877 && !
d->selectedDraggableIndexes().isEmpty()) {
1885 QItemSelectionModel::SelectionFlags command =
selectionCommand(index, event);
1888 command |=
d->ctrlDragSelectionFlag;
1892 QRect selectionRect =
QRect(topLeft, bottomRight);
1897 && (index !=
d->selectionModel->currentIndex())
1898 &&
d->isIndexEnabled(index))
1918 if (
d->isIndexValid(index)
1919 &&
d->isIndexEnabled(index)
1920 &&
d->sendDelegateEvent(index, event))
1925 bool click = (index ==
d->pressedIndex && index.
isValid());
1926 bool selectedClicked = click && (
event->button() &
Qt::LeftButton) &&
d->pressedAlreadySelected;
1928 bool edited =
edit(index, trigger, event);
1932 if (
d->selectionModel &&
d->noSelectionOnMousePress) {
1933 d->noSelectionOnMousePress =
false;
1944 if (
d->pressedAlreadySelected)
1962 || !
d->isIndexEnabled(index)
1963 || (
d->pressedIndex !=
index)) {
1965 event->
pos(),
event->button(),
1966 event->buttons(),
event->modifiers());
1978 #ifndef QT_NO_DRAGANDDROP 1993 if (d_func()->canDecode(event)) {
2021 if (!
d->droppingOnItself(event, index)
2022 &&
d->canDecode(event)) {
2024 if (index.
isValid() &&
d->showDropIndicator) {
2026 d->dropIndicatorPosition =
d->position(event->
pos(),
rect,
index);
2027 switch (
d->dropIndicatorPosition) {
2029 if (
d->isIndexDropEnabled(index.
parent())) {
2033 d->dropIndicatorRect =
QRect();
2037 if (
d->isIndexDropEnabled(index.
parent())) {
2041 d->dropIndicatorRect =
QRect();
2045 if (
d->isIndexDropEnabled(index)) {
2046 d->dropIndicatorRect =
rect;
2049 d->dropIndicatorRect =
QRect();
2053 d->dropIndicatorRect =
QRect();
2060 d->dropIndicatorRect =
QRect();
2066 d->viewport->update();
2069 if (
d->shouldAutoScroll(event->
pos()))
2092 while (child.
isValid() && child != root) {
2093 if (selectedIndexes.
contains(child))
2113 d->viewport->update();
2134 if (
d->dropOn(event, &row, &col, &index)) {
2135 if (
d->model->dropMimeData(event->
mimeData(),
2144 d->viewport->update();
2167 index = q->indexAt(event->
pos());
2168 if (!index.
isValid() || !q->visualRect(index).contains(event->
pos()))
2176 if (index != root) {
2185 row = index.
row() + 1;
2199 if (!droppingOnItself(event, index))
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)) {
2220 touchingRect.
adjust(-1, -1, 1, 1);
2221 if (touchingRect.
contains(pos,
false)) {
2232 #endif // QT_NO_DRAGANDDROP 2249 && !
d->currentIndexSet
2250 && !currentIndexValid) {
2252 d->autoScroll =
false;
2259 if (model && currentIndexValid) {
2266 if (!currentIndexValid)
2269 d->viewport->update();
2282 d->viewport->update();
2284 #ifdef QT_SOFTKEYS_ENABLED 2304 d->delayedAutoScroll.stop();
2306 #ifdef QT_KEYPAD_NAVIGATION 2307 switch (event->
key()) {
2309 if (QApplication::keypadNavigationEnabled()) {
2310 if (!hasEditFocus()) {
2312 #ifdef QT_SOFTKEYS_ENABLED 2325 if (QApplication::keypadNavigationEnabled() && hasEditFocus()) {
2326 #ifdef QT_SOFTKEYS_ENABLED 2329 setEditFocus(
false);
2339 if(QApplication::keypadNavigationEnabled() && !hasEditFocus()
2348 if(QApplication::keypadNavigationEnabled() && !hasEditFocus()
2349 && (QWidgetPrivate::canKeypadNavigate(
Qt::Horizontal) || QWidgetPrivate::inTabWidget(
this))) {
2355 if (QApplication::keypadNavigationEnabled() && !hasEditFocus()) {
2362 #if !defined(QT_NO_CLIPBOARD) && !defined(QT_NO_SHORTCUT) 2374 d->moveCursorUpdatedView =
false;
2375 switch (event->
key()) {
2401 if (
d->tabKeyNavigation)
2405 if (
d->tabKeyNavigation)
2411 if (newCurrent != oldCurrent && newCurrent.
isValid() &&
d->isIndexEnabled(newCurrent)) {
2414 QItemSelectionModel::SelectionFlags command =
selectionCommand(newCurrent, event);
2420 if (!
indexAt(
d->pressedPosition -
d->offset()).isValid())
2425 d->selectionModel->setCurrentIndex(newCurrent, command);
2438 switch (event->
key()) {
2442 #ifdef QT_KEYPAD_NAVIGATION 2443 if (QApplication::keypadNavigationEnabled() && QWidgetPrivate::canKeypadNavigate(
Qt::Vertical)) {
2450 #ifdef QT_KEYPAD_NAVIGATION 2453 || (QWidgetPrivate::inTabWidget(
this) &&
d->model->columnCount(
d->root) > 1))) {
2457 #endif // QT_KEYPAD_NAVIGATION 2473 #ifdef QT_KEYPAD_NAVIGATION 2531 if (
d->moveCursorUpdatedView)
2556 if (event->
timerId() ==
d->fetchMoreTimer.timerId())
2558 else if (event->
timerId() ==
d->delayedReset.timerId())
2560 else if (event->
timerId() ==
d->autoScrollTimer.timerId())
2562 else if (event->
timerId() ==
d->updateTimer.timerId())
2563 d->updateDirtyRegion();
2564 else if (event->
timerId() ==
d->delayedEditing.timerId()) {
2565 d->delayedEditing.stop();
2567 }
else if (event->
timerId() ==
d->delayedLayout.timerId()) {
2568 d->delayedLayout.stop();
2570 d->interruptDelayedItemsLayout();
2576 }
else if (event->
timerId() ==
d->delayedAutoScroll.timerId()) {
2577 d->delayedAutoScroll.stop();
2580 if (
d->pressedIndex.isValid() &&
d->pressedIndex ==
currentIndex())
2601 #ifndef QT_NO_DRAGANDDROP 2634 return d->dropIndicatorPosition;
2649 if (
d->selectionModel) {
2650 indexes =
d->selectionModel->selectedIndexes();
2652 while (it != indexes.
end())
2654 it = indexes.
erase(it);
2678 if (!
d->isIndexValid(index))
2681 if (
QWidget *w = (
d->persistent.isEmpty() ?
static_cast<QWidget*
>(0) :
d->editorForIndex(index).widget.data())) {
2689 d->delayedEditing.stop();
2690 d->delayedAutoScroll.stop();
2692 d->delayedEditing.stop();
2695 if (
d->sendDelegateEvent(index, event)) {
2701 EditTriggers lastTrigger =
d->lastTrigger;
2702 d->lastTrigger = trigger;
2704 if (!
d->shouldEdit(trigger,
d->model->buddy(index)))
2707 if (
d->delayedEditing.isActive())
2719 d->openEditor(index,
d->shouldForwardEvent(trigger, event) ?
event : 0);
2747 if(
d->editorIndexHash.isEmpty())
2753 while (it !=
d->editorIndexHash.end()) {
2756 if (index.
isValid() && editor) {
2764 editorsToHide << editor;
2768 d->indexEditorHash.remove(it.value());
2769 it =
d->editorIndexHash.erase(it);
2770 editorsToRelease << editor;
2776 for (
int i = 0; i < editorsToHide.
count(); ++i) {
2777 editorsToHide.
at(i)->hide();
2779 for (
int i = 0; i < editorsToRelease.
count(); ++i) {
2780 d->releaseEditor(editorsToRelease.
at(i));
2795 d_func()->fetchMoreTimer.start(0,
this);
2805 d->model->fetchMore(
d->root);
2808 d->checkMouseMove(posInVp);
2818 d->model->fetchMore(
d->root);
2821 d->checkMouseMove(posInVp);
2855 bool isPersistent =
d->persistent.contains(editor);
2856 bool hadFocus = editor->
hasFocus();
2861 if (!isPersistent) {
2865 d->removeEditor(editor);
2870 d->checkPersistentEditorFocus();
2876 if (!isPersistent && editor)
2877 d->releaseEditor(editor);
2882 |
d->selectionBehaviorFlags();
2888 d->selectionModel->setCurrentIndex(persistent, flags);
2898 d->selectionModel->setCurrentIndex(persistent, flags);
2923 if (!editor || !
d->itemDelegate ||
d->currentlyCommittingEditor)
2928 d->currentlyCommittingEditor = editor;
2933 d->currentlyCommittingEditor = 0;
2946 d->persistent.remove(w);
3032 if (!
d->model->rowCount(
d->root) || !
d->model->columnCount(
d->root))
3036 :
d->model->index(0, 0,
d->root);
3037 bool skipRow =
false;
3038 bool keyboardTimeWasValid =
d->keyboardInputTime.isValid();
3039 qint64 keyboardInputTimeElapsed =
d->keyboardInputTime.restart();
3040 if (search.
isEmpty() || !keyboardTimeWasValid
3042 d->keyboardInput = search;
3045 d->keyboardInput += search;
3049 bool sameKey =
false;
3050 if (
d->keyboardInput.length() > 1) {
3051 int c =
d->keyboardInput.count(
d->keyboardInput.at(
d->keyboardInput.length() - 1));
3052 sameKey = (c ==
d->keyboardInput.length());
3060 int newRow = (start.
row() <
d->model->rowCount(parent) - 1) ? start.
row() + 1 : 0;
3065 const QString searchString = sameKey ?
QString(
d->keyboardInput.at(0)) :
d->keyboardInput;
3073 if (
match == previous)
3075 firstMatch =
match.value(0);
3077 if (firstMatch.isValid()) {
3078 if (
d->isIndexEnabled(firstMatch)) {
3082 int row = firstMatch.row() + 1;
3083 if (row >=
d->model->rowCount(firstMatch.parent()))
3085 current = firstMatch.sibling(row, firstMatch.column());
3088 if (!startMatch.isValid())
3089 startMatch = firstMatch;
3090 else if (startMatch == firstMatch)
3093 }
while (current != start && firstMatch.isValid());
3105 if (!
d->isIndexValid(index) || !
d->itemDelegate)
3107 return d->delegateForIndex(index)->sizeHint(
d->viewOptionsV4(),
index);
3130 if (row < 0 || row >=
d->model->rowCount(
d->root))
3137 int colCount =
d->model->columnCount(
d->root);
3139 for (
int c = 0;
c < colCount; ++
c) {
3140 index =
d->model->index(row,
c,
d->root);
3141 if (
QWidget *editor =
d->editorForIndex(index).widget.data())
3142 height =
qMax(height, editor->height());
3143 int hint =
d->delegateForIndex(index)->sizeHint(option, index).height();
3144 height =
qMax(height, hint);
3161 if (column < 0 || column >=
d->model->columnCount(
d->root))
3168 int rows =
d->model->rowCount(
d->root);
3170 for (
int r = 0; r < rows; ++r) {
3171 index =
d->model->index(r, column,
d->root);
3172 if (
QWidget *editor =
d->editorForIndex(index).widget.data())
3173 width =
qMax(width, editor->sizeHint().width());
3174 int hint =
d->delegateForIndex(index)->sizeHint(option, index).width();
3175 width =
qMax(width, hint);
3193 QWidget *editor =
d->editor(index, options);
3196 d->persistent.insert(editor);
3208 if (
QWidget *editor =
d->editorForIndex(index).widget.data()) {
3211 d->persistent.remove(editor);
3212 d->removeEditor(editor);
3213 d->releaseEditor(editor);
3249 if (!
d->isIndexValid(index))
3252 d->persistent.remove(oldWidget);
3253 d->removeEditor(oldWidget);
3254 oldWidget->deleteLater();
3258 d->persistent.insert(widget);
3259 d->addEditor(index, widget,
true);
3262 if (!
d->delayedPendingLayout)
3278 if (
d->isIndexValid(index))
3279 if (
QWidget *editor =
d->editorForIndex(index).widget.data())
3313 if (
d->delayedPendingLayout) {
3314 d->executePostedLayout();
3337 if (
d->viewport->rect().intersects(rect))
3338 d->viewport->update(rect);
3352 if (topLeft == bottomRight && topLeft.
isValid()) {
3353 const QEditorInfo &editorInfo =
d->editorForIndex(topLeft);
3361 if (
isVisible() && !
d->delayedPendingLayout) {
3367 d->updateEditorData(topLeft, bottomRight);
3370 d->viewport->update();
3384 d_func()->fetchMoreTimer.start(0,
this);
3405 && current.
row() >= start
3406 && current.
row() <= end
3408 int totalToRemove = end - start + 1;
3409 if (
d->model->rowCount(parent) <= totalToRemove) {
3411 while (index !=
d->root && !
d->isIndexEnabled(index))
3413 if (index !=
d->root)
3419 next =
d->model->index(row++, current.
column(), current.
parent());
3421 if (row >
d->model->rowCount(parent)) {
3424 next =
d->model->index(row--, current.
column(), current.
parent());
3433 while (i !=
d->editorIndexHash.end()) {
3435 if (index.
row() >= start && index.
row() <= end &&
d->model->parent(index) ==
parent) {
3438 i =
d->editorIndexHash.erase(i);
3440 d->releaseEditor(editor);
3465 q->updateEditorGeometries();
3467 #ifndef QT_NO_ACCESSIBILITY 3497 && current.
column() >= start
3499 int totalToRemove = end - start + 1;
3502 while (index.
isValid() && !isIndexEnabled(index))
3505 q->setCurrentIndex(index);
3511 }
while (next.
isValid() && (q->isIndexHidden(next) || !isIndexEnabled(next)));
3512 q->setCurrentIndex(next);
3518 while (it != editorIndexHash.end()) {
3523 it = editorIndexHash.erase(it);
3525 releaseEditor(editor);
3551 q->updateEditorGeometries();
3553 #ifndef QT_NO_ACCESSIBILITY 3578 #ifndef QT_NO_ACCESSIBILITY 3605 q->updateEditorGeometries();
3606 #ifndef QT_NO_ACCESSIBILITY 3635 doDelayedItemsLayout();
3636 #ifndef QT_NO_ACCESSIBILITY 3678 QWidget *editor =
d->editorForIndex(buddy).widget.data();
3679 if (editor && !
d->persistent.contains(editor)) {
3681 if (current.
row() != previous.
row())
3691 if (current.
isValid() && !
d->autoScrollTimer.isActive()) {
3697 if (current.
row() == (
d->model->rowCount(
d->root) - 1))
3700 d->shouldScrollToCurrentOnShow =
d->autoScroll;
3705 #ifndef QT_NO_DRAGANDDROP 3713 if (indexes.
count() > 0) {
3718 QPixmap pixmap =
d->renderToPixmap(indexes, &rect);
3725 if (
d->defaultDropAction !=
Qt::IgnoreAction && (supportedActions &
d->defaultDropAction))
3726 defaultDropAction =
d->defaultDropAction;
3733 #endif // QT_NO_DRAGANDDROP 3755 if (
d->iconSize.isValid()) {
3776 option.
locale = q->locale();
3816 d->doDelayedItemsLayout();
3828 d->executePostedLayout();
3847 d->setDirtyRegion(region);
3863 d->scrollDirtyRegion(dx, dy);
3878 return d->scrollDelayOffset;
3886 d_func()->startAutoScroll();
3894 d_func()->stopAutoScroll();
3906 if (
d->autoScrollCount <
qMax(verticalStep, horizontalStep))
3907 ++
d->autoScrollCount;
3909 int margin =
d->autoScrollMargin;
3917 if (pos.
y() - area.
top() < margin)
3919 else if (area.
bottom() - pos.
y() < margin)
3921 if (pos.
x() - area.
left() < margin)
3923 else if (area.
right() - pos.
x() < margin)
3928 if (verticalUnchanged && horizontalUnchanged) {
3931 #ifndef QT_NO_DRAGANDDROP 3932 d->dropIndicatorRect =
QRect();
3935 d->viewport->update();
3952 switch (
d->selectionMode) {
3960 return d->multiSelectionCommand(index, event);
3962 return d->extendedSelectionCommand(index, event);
3964 return d->contiguousSelectionCommand(index, event);
3975 switch (event->
type()) {
3977 if (static_cast<const QKeyEvent*>(event)->key() ==
Qt::Key_Space 3982 if (static_cast<const QMouseEvent*>(event)->button() ==
Qt::LeftButton)
3986 if (static_cast<const QMouseEvent*>(event)->button() ==
Qt::LeftButton)
3990 if (static_cast<const QMouseEvent*>(event)->buttons() &
Qt::LeftButton)
4006 switch (event->
type()) {
4021 if ((shiftKeyPressed || controlKeyPressed) && rightButtonPressed)
4023 if (!shiftKeyPressed && !controlKeyPressed && indexIsSelected)
4025 if (!index.
isValid() && !rightButtonPressed && !shiftKeyPressed && !controlKeyPressed)
4040 && !shiftKeyPressed && !controlKeyPressed && (!rightButtonPressed || !index.
isValid()))
4047 switch (static_cast<const QKeyEvent*>(event)->key()) {
4060 #ifdef QT_KEYPAD_NAVIGATION
4094 QItemSelectionModel::SelectionFlags
4098 QItemSelectionModel::SelectionFlags flags = extendedSelectionCommand(index, event);
4103 switch (flags & Mask) {
4121 fetchMoreTimer.stop();
4131 QRect rect = q_func()->visualRect(index);
4146 if (hasEditor(index))
4153 return (trigger & editTriggers);
4162 switch (event->
type()) {
4189 if (!delayedPendingLayout) {
4190 delayedPendingLayout =
true;
4191 delayedLayout.start(delay, q_func());
4197 delayedLayout.stop();
4198 delayedPendingLayout =
false;
4218 addEditor(index, w,
false);
4226 #ifndef QT_NO_LINEEDIT 4227 if (
QLineEdit *le = qobject_cast<QLineEdit*>(focusWidget))
4230 #ifndef QT_NO_SPINBOX 4231 if (
QSpinBox *sb = qobject_cast<QSpinBox*>(focusWidget))
4233 else if (
QDoubleSpinBox *dsb = qobject_cast<QDoubleSpinBox*>(focusWidget))
4248 for (; it != indexEditorHash.constEnd(); ++
it) {
4251 if (it.value().isStatic || !editor || !index.
isValid() ||
4279 #ifndef QT_NO_DRAGANDDROP 4286 if ((*it).left() != 0)
4290 int count = (*it).bottom() - (*it).top() + 1;
4296 for (
int i=0; i < list.
size(); ++i) {
4320 if (persistent.contains(
widget)) {
4324 q->setCurrentIndex(index);
4335 if (indexEditorHash.isEmpty())
4339 if (it == indexEditorHash.end())
4348 if (indexEditorHash.isEmpty())
4352 if (it == editorIndexHash.end())
4361 if (it != editorIndexHash.end())
4363 indexEditorHash.remove(it.value());
4364 editorIndexHash.erase(it);
4370 editorIndexHash.insert(editor, index);
4371 indexEditorHash.insert(index,
QEditorInfo(editor, isStatic));
4379 options.
rect = q->visualRect(buddy);
4382 return (event && delegate && delegate->
editorEvent(event,
model, options, buddy));
4391 options.
rect = q->visualRect(buddy);
4394 QWidget *w = editor(buddy, options);
4421 for (
int i = 0; i < indexes.
count(); ++i) {
4423 const QRect current = q->visualRect(index);
4429 rect &= viewportRect;
4444 for (
int j = 0; j < paintPairs.
count(); ++j) {
4445 option.
rect = paintPairs.
at(j).first.translated(-r->
topLeft());
4447 adjustViewOptionsForIndex(&option, current);
4448 delegateForIndex(current)->paint(&painter, option, current);
4471 for(
int i = indexes.
count() - 1 ; i >= 0; --i) {
4472 if (!isIndexDragEnabled(indexes.
at(i)))
4481 #include "moc_qabstractitemview.cpp" 4483 #endif // QT_NO_ITEMVIEWS
The QVariant class acts like a union for the most common Qt data types.
SelectionMode
This enum indicates how the view responds to user selections:
static int keyboardInputInterval()
QSize sizeHintForIndex(const QModelIndex &index) const
Returns the size hint for the item with the specified index or an invalid size for invalid indexes...
The QPainter class performs low-level painting on widgets and other paint devices.
QAbstractItemView(QWidget *parent=0)
Constructs an abstract item view with the given parent.
void setItemDelegateForRow(int row, QAbstractItemDelegate *delegate)
Sets the given item delegate used by this view and model for the given row.
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const =0
Returns the number of columns for the children of the given parent.
QPersistentModelIndex hover
virtual void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
This slot is called when rows are about to be removed.
static void updateAccessibility(QObject *, int who, Event reason)
Notifies accessibility clients about a change in object's accessibility information.
The QAbstractItemDelegate class is used to display and edit data items from a model.
void openPersistentEditor(const QModelIndex &index)
Opens a persistent editor on the item at the given index.
void setSelectionMode(QAbstractItemView::SelectionMode mode)
static QAbstractItemModel * staticEmptyModel()
The QKeyEvent class describes a key event.
The QItemSelectionModel class keeps track of a view's selected items.
virtual void _q_rowsRemoved(const QModelIndex &parent, int start, int end)
This slot is called when rows have been removed.
static QString standardSoftKeyText(StandardSoftKey standardKey)
void scrollToBottom()
Scrolls the view to the bottom.
QFont font
the font used for the item
Qt::Alignment decorationAlignment
the alignment of the decoration for the item
static mach_timebase_info_data_t info
virtual QAbstractItemView::DropIndicatorPosition position(const QPoint &pos, const QRect &rect, const QModelIndex &idx) const
#define QT_END_NAMESPACE
This macro expands to.
void setPixmap(const QPixmap &)
Sets pixmap as the pixmap used to represent the data in a drag and drop operation.
void setDragDropOverwriteMode(bool overwrite)
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...
The QDrag class provides support for MIME-based drag and drop data transfer.
void setMimeData(QMimeData *data)
Sets the data to be sent to the given MIME data.
QPointer< QWidget > widget
void setDefaultDropAction(Qt::DropAction dropAction)
virtual QStyleOptionViewItem viewOptions() const
Returns a QStyleOptionViewItem structure populated with the view's palette, font, state...
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...
virtual void setSelectionModel(QItemSelectionModel *selectionModel)
Sets the current selection model to the given selectionModel.
ScrollMode horizontalScrollMode() const
virtual void closeEditor(QWidget *editor, QAbstractItemDelegate::EndEditHint hint)
Closes the given editor, and releases it.
void setAlternatingRowColors(bool enable)
bool autoScroll
whether autoscrolling in drag move events is enabled
void mouseMoveEvent(QMouseEvent *event)
This function is called with the given event when a mouse move event is sent to the widget...
QStyle::State state
the style flags that are used when drawing the control
#define it(className, varName)
virtual bool isIndexHidden(const QModelIndex &index) const =0
Returns true if the item referred to by the given index is hidden in the view, otherwise returns fals...
virtual QRect visualRect(const QModelIndex &index) const =0
Returns the rectangle on the viewport occupied by the item at index.
void mouseDoubleClickEvent(QMouseEvent *event)
This function is called with the given event when a mouse button is double clicked inside the widget...
void setDirtyRegion(const QRegion ®ion)
Marks the given region as dirty and schedules it to be updated.
void setAutoScrollMargin(int margin)
void clicked(const QModelIndex &index)
This signal is emitted when a mouse button is clicked.
QWeakPointer< QWidget > widget
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const =0
Returns the number of rows under the given parent.
virtual void _q_modelDestroyed()
virtual void setRootIndex(const QModelIndex &index)
Sets the root item to the item at the given index.
void setIconSize(const QSize &size)
void removeEventFilter(QObject *)
Removes an event filter object obj from this object.
static qreal position(QGraphicsObject *item, QDeclarativeAnchorLine::AnchorLine anchorLine)
void setDropAction(Qt::DropAction action)
Sets the action to be performed on the data by the target.
The QStyleOptionViewItemV4 class is used to describe the parameters necessary for drawing a frame in ...
DragDropMode dragDropMode() const
Position decorationPosition
the position of the decoration for the item
void setEditTriggers(EditTriggers triggers)
iterator begin()
Returns an STL-style iterator pointing to the first item in the list.
The QItemSelectionRange class manages information about a range of selected items in a model...
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
virtual int styleHint(StyleHint stylehint, const QStyleOption *opt=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const =0
Returns an integer representing the specified style hint for the given widget described by the provid...
void setIndexWidget(const QModelIndex &index, QWidget *widget)
Sets the given widget on the item at the given index, passing the ownership of the widget to the view...
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.
static bool match(const uchar *found, const char *target, uint len)
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the list.
QAbstractItemView::SelectionBehavior selectionBehavior
virtual void verticalScrollbarValueChanged(int value)
int left() const
Returns the x-coordinate of the rectangle's left edge.
void timerEvent(QTimerEvent *event)
This function is called with the given event when a timer event is sent to the widget.
int width() const
Returns the width of the rectangle.
virtual QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const
const QEditorInfo & editorForIndex(const QModelIndex &index) const
Qt::TextElideMode textElideMode
where ellipsis should be added for text that is too long to fit into an item
void init(const QWidget *w)
Use initFrom(widget) instead.
bool shouldForwardEvent(QAbstractItemView::EditTrigger trigger, const QEvent *event) const
#define Q_ARG(type, data)
void interruptDelayedItemsLayout() const
void checkPersistentEditorFocus()
When persistent aeditor gets/loses focus, we need to check and setcorrectly the current index...
int count(const T &t) const
Returns the number of occurrences of value in the list.
virtual Qt::DropActions supportedDropActions() const
Returns the drop actions supported by this model.
virtual void verticalScrollbarAction(int action)
virtual int sizeHintForColumn(int column) const
Returns the width size hint for the specified column or -1 if there is no model.
DropIndicatorPosition
This enum indicates the position of the drop indicator in relation to the index at the current mouse ...
int height() const
Returns the height of the rectangle.
Qt::DropAction exec(Qt::DropActions supportedActions=Qt::MoveAction)
Starts the drag and drop operation and returns a value indicating the requested drop action when it i...
int bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
The QString class provides a Unicode character string.
QAbstractItemDelegate * itemDelegate() const
Returns the item delegate used by this view and model.
T * qobject_cast(QObject *object)
virtual void doItemsLayout()
This function is intended to lay out the items in the view.
void setText(const QString &, Mode mode=Clipboard)
Copies text into the clipboard as plain text.
The QDragMoveEvent class provides an event which is sent while a drag and drop action is in progress...
Qt::DropAction defaultDropAction() const
DropIndicatorPosition dropIndicatorPosition() const
Returns the position of the drop indicator in relation to the closest item.
The QObject class is the base class of all Qt objects.
virtual void selectAll(QItemSelectionModel::SelectionFlags command)
virtual QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers)=0
Returns a QModelIndex object pointing to the next object in the view, based on the given cursorAction...
bool tabKeyNavigation() const
void scheduleDelayedItemsLayout()
Schedules a layout of the items in the view to be executed when the event processing starts...
virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
Sets the data for the item at the given index in the model to the contents of the given editor...
virtual void _q_layoutChanged()
This slot is called when the layout is changed.
void setNumberOptions(NumberOptions options)
Sets the options related to number conversions for this QLocale instance.
The QStyledItemDelegate class provides display and editing facilities for data items from a model...
bool focusNextPrevChild(bool next)
Reimplemented Function
virtual void editorDestroyed(QObject *editor)
This function is called when the given editor has been destroyed.
void dragMoveEvent(QDragMoveEvent *event)
This function is called continuously with the given event during a drag and drop operation over the w...
bool showDropIndicator() const
QModelIndex parent() const
Returns the parent of the model index, or QModelIndex() if it has no parent.
virtual void commitData(QWidget *editor)
Commit the data in the editor to the model.
QWidget * indexWidget(const QModelIndex &index) const
Returns the widget for the item at the given index.
QItemSelectionModel::SelectionFlags multiSelectionCommand(const QModelIndex &index, const QEvent *event) const
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
void setHoverIndex(const QPersistentModelIndex &index)
void setRange(int min, int max)
Sets the slider's minimum to min and its maximum to max.
void setAutoScroll(bool enable)
const QPoint & pos() const
Returns the position of the mouse cursor, relative to the widget that received the event...
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
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...
virtual void _q_columnsInserted(const QModelIndex &parent, int start, int end)
This slot is called when columns have been inserted.
virtual QItemSelectionModel::SelectionFlags selectionCommand(const QModelIndex &index, const QEvent *event=0) const
Returns the SelectionFlags to be used when updating a selection with to include the index specified...
void removeEditor(QWidget *editor)
void setTabKeyNavigation(bool enable)
void setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)
Sets the model item index to be the current item, and emits currentChanged().
void dropEvent(QDropEvent *event)
This function is called with the given event when a drop event occurs over the widget.
virtual int verticalOffset() const =0
Returns the vertical offset of the view.
virtual Qt::ItemFlags flags(const QModelIndex &index) const
Returns the item flags for the given index.
virtual void setModel(QAbstractItemModel *model)
Sets the model for the view to present.
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 void columnsInserted(const QModelIndex &parent, int first, int last)=0
void checkMouseMove(const QPersistentModelIndex &index)
Qt::KeyboardModifiers modifiers() const
Returns the keyboard modifier flags that existed immediately after the event occurred.
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.
int key() const
Returns the code of the key that was pressed or released.
void clearOrRemove()
In DND if something has been moved then this is called.
void doDelayedItemsLayout(int delay=0)
bool shouldClearStatusTip
static QAction * createKeyedAction(StandardSoftKey standardKey, Qt::Key key, QWidget *actionWidget)
Creates a QAction and registers the 'triggered' signal to send the given key event to actionWidget as...
void append(const T &t)
Inserts value at the end of the list.
virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const
Reimplemented Function
virtual void _q_columnsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
This slot is called when columns are about to be removed.
#define QT_BEGIN_NAMESPACE
This macro expands to.
QPixmap renderToPixmap(const QModelIndexList &indexes, QRect *r) const
virtual void selectAll()
Selects all items in the view.
ViewItemFeatures features
a bitwise OR of the features that describe this view item
QBool contains(const T &t) const
Returns true if the list contains an occurrence of value; otherwise returns false.
void destroyed(QObject *=0)
This signal is emitted immediately before the object obj is destroyed, and can not be blocked...
ScrollMode verticalScrollMode() const
void setDropIndicatorShown(bool enable)
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.
QItemSelectionModel::SelectionFlags extendedSelectionCommand(const QModelIndex &index, const QEvent *event) const
~QAbstractItemView()
Destroys the view.
static QClipboard * clipboard()
Returns a pointer to the application global clipboard.
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...
virtual void rowsRemoved(const QModelIndex &parent, int first, int last)=0
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QItemSelectionModel * selectionModel() const
Returns the current selection model.
int verticalStepsPerItem() const
Returns the vertical scroll bar's steps per item.
virtual void scrollTo(const QModelIndex &index, ScrollHint hint=EnsureVisible)=0
Scrolls the view if necessary to ensure that the item at index is visible.
void executeDelayedItemsLayout()
Executes the scheduled layouts without waiting for the event processing to begin. ...
bool isSelected(const QModelIndex &index) const
Returns true if the given model item index is selected.
int autoScrollMargin() const
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the list...
int row() const
Returns the row this model index refers to.
QSize size() const
Returns the size of the rectangle.
const T & at(int i) const
Returns the item at index position i in the list.
virtual void currentChanged(const QModelIndex ¤t, const QModelIndex &previous)
This slot is called when a new item becomes the current item.
const QAbstractItemModel * model() const
Returns a pointer to the model containing the item that this index refers to.
void adjust(int x1, int y1, int x2, int y2)
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
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 ...
The QResizeEvent class contains event parameters for resize events.
const char * styleHint(const QFontDef &request)
void setCurrentIndex(const QModelIndex &index)
Sets the current item to be the item at index.
Q_CORE_EXPORT void qWarning(const char *,...)
void setTextElideMode(Qt::TextElideMode mode)
int timerId() const
Returns the unique timer identifier, which is the same identifier as returned from QObject::startTime...
bool showDecorationSelected
whether the decoration should be highlighted on selected items
#define Q_RETURN_ARG(type, data)
virtual QModelIndex buddy(const QModelIndex &index) const
Returns a model index for the buddy of the item represented by index.
void setDragDropMode(DragDropMode behavior)
virtual void reset()
Reset the internal state of the view.
QModelIndex currentIndex() const
Returns the model index of the current item.
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
void invalidate()
Marks this QElapsedTimer object as invalid.
static void sendPostedEvents()
void keyPressEvent(QKeyEvent *event)
This function is called with the given event when a key event is sent to the widget.
bool alternatingRowColors() const
The QDragLeaveEvent class provides an event that is sent to a widget when a drag and drop action leav...
The QRegion class specifies a clip region for a painter.
T value(int i) const
Returns the value at index position i in the list.
int horizontalStepsPerItem() const
Returns the horizontal scroll bar's steps per item.
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.
State
Describes the different states the view can be in.
virtual int horizontalOffset() const =0
Returns the horizontal offset of the view.
virtual bool canFetchMore(const QModelIndex &parent) const
Returns true if there is more data available for parent; otherwise returns false. ...
static int startDragDistance()
QModelIndex currentIndex() const
Returns the model item index for the current item, or an invalid index if there is no current item...
void activated(const QModelIndex &index)
This signal is emitted when the item specified by index is activated by the user. ...
The State element defines configurations of objects and properties.
DragDropMode
Describes the various drag and drop events the view can act upon.
void setDragEnabled(bool enable)
The QMimeData class provides a container for data that records information about its MIME type...
QAbstractItemView::SelectionBehavior selectionBehavior() const
void setVerticalStepsPerItem(int steps)
Sets the vertical scroll bar's steps per item to steps.
void focusInEvent(QFocusEvent *event)
This function is called with the given event when the widget obtains the focus.
bool shouldEdit(QAbstractItemView::EditTrigger trigger, const QModelIndex &index) const
Qt::MouseButton button() const
Returns the button that caused the event.
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...
void scrollToTop()
Scrolls the view to the top.
#define QT_NO_DRAGANDDROP
QAbstractItemView::SelectionMode selectionMode() const
The QAbstractItemModel class provides the abstract interface for item model classes.
Qt::ItemFlags flags() const
Returns the flags for the item referred to by the index.
static bool isActive()
Returns true if an accessibility implementation has been requested during the runtime of the applicat...
The QMouseEvent class contains parameters that describe a mouse event.
iterator begin()
Returns an STL-style iterator pointing to the first item in the map.
Q_CORE_EXPORT QTextStream & center(QTextStream &s)
static QAccessibleInterface * queryAccessibleInterface(QObject *)
If a QAccessibleInterface implementation exists for the given object, this function returns a pointer...
virtual QModelIndex parent(const QModelIndex &child) const =0
Returns the parent of the model item with the given index.
void fill(const QColor &fillColor=Qt::white)
Fills the pixmap with the given color.
virtual void fetchMore(const QModelIndex &parent)
Fetches any available data for the items with the parent specified by the parent index.
void updateEditorData(const QModelIndex &topLeft, const QModelIndex &bottomRight)
QPoint center() const
Returns the center point of the rectangle.
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.
bool hasAutoScroll() const
Qt::TextElideMode textElideMode() const
virtual void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
This slot is called when the selection is changed.
virtual void modelReset()=0
The QAbstractItemView class provides the basic functionality for item view classes.
virtual void updateEditorData()
Updates the data shown in the open editor widgets in the view.
#define Q_ASSERT_X(cond, where, what)
iterator erase(iterator pos)
Removes the item associated with the iterator pos from the list, and returns an iterator to the next ...
int top() const
Returns the y-coordinate of the rectangle's top edge.
QAbstractItemViewPrivate()
void inputMethodEvent(QInputMethodEvent *event)
Reimplemented Function
The QItemSelection class manages information about selected items in a model.
The QDropEvent class provides an event which is sent when a drag and drop action is completed...
static Qt::KeyboardModifiers keyboardModifiers()
Returns the current state of the modifier keys on the keyboard.
Qt::MouseButtons buttons() const
Returns the button state when the event was generated.
int right() const
Returns the x-coordinate of the rectangle's right edge.
virtual void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command)=0
Applies the selection flags to the items in or touched by the rectangle, rect.
void clearSelection()
Deselects all selected items.
The QMap::iterator class provides an STL-style non-const iterator for QMap and QMultiMap.
The QTimerEvent class contains parameters that describe a timer event.
virtual void horizontalScrollbarValueChanged(int value)
The QDoubleSpinBox class provides a spin box widget that takes doubles.
void pressed(const QModelIndex &index)
This signal is emitted when a mouse button is pressed.
The QPersistentModelIndex class is used to locate data in a data model.
int y() const
Returns the y-coordinate of the rectangle's top edge.
QString text() const
Returns the Unicode text that this key generated.
void setHorizontalScrollMode(ScrollMode mode)
virtual void columnsRemoved(const QModelIndex &parent, int first, int last)=0
void resizeEvent(QResizeEvent *event)
This function is called with the given event when a resize event is sent to the widget.
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the map...
QElapsedTimer keyboardInputTime
The QStatusTipEvent class provides an event that is used to show messages in a status bar...
QPersistentModelIndex enteredIndex
void dragEnterEvent(QDragEnterEvent *event)
This function is called with the given event when a drag and drop operation enters the widget...
virtual void select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)
Selects the model item index using the specified command, and emits selectionChanged().
Type type() const
Returns the storage type of the value stored in the variant.
QAbstractItemDelegate * itemDelegateForRow(int row) const
Returns the item delegate used by this view and model for the given row, or 0 if no delegate has been...
QWidget * source() const
If the source of the drag operation is a widget in this application, this function returns that sourc...
QObject * parent() const
Returns a pointer to the parent object.
bool dragDropOverwriteMode() const
QModelIndex indexForEditor(QWidget *editor) const
Qt::Alignment displayAlignment
the alignment of the display value for the item
Q_OUTOFLINE_TEMPLATE QPair< T1, T2 > qMakePair(const T1 &x, const T2 &y)
The QDragEnterEvent class provides an event which is sent to a widget when a drag and drop action ent...
virtual QModelIndexList selectedIndexes() const
This convenience function returns a list of all selected and non-hidden item indexes in the view...
void setVerticalScrollMode(ScrollMode mode)
The QPoint class defines a point in the plane using integer precision.
bool sendDelegateEvent(const QModelIndex &index, QEvent *event) const
void installEventFilter(QObject *)
Installs an event filter filterObj on this object.
The QModelIndex class is used to locate data in a data model.
QSize decorationSize
the size of the decoration for the item
int size() const
Returns the number of items in the list.
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI...
QAccessibleTable2Interface * table2Interface()
QPoint dirtyRegionOffset() const
Returns the offset of the dirty regions in the view.
void setSelectionBehavior(QAbstractItemView::SelectionBehavior behavior)
if(void) toggleToolbarShown
virtual void rowsInserted(const QModelIndex &parent, int first, int last)=0
The QRect class defines a rectangle in the plane using integer precision.
const QAbstractItemModel * model() const
Returns the item model operated on by the selection model.
QWidget * editor(const QModelIndex &index, const QStyleOptionViewItem &options)
QStyleOptionViewItemV4 viewOptionsV4() const
The QSpinBox class provides a spin box widget.
void edit(const QModelIndex &index)
Starts editing the item corresponding to the given index if it is editable.
virtual void _q_columnsRemoved(const QModelIndex &parent, int start, int end)
This slot is called when columns have been removed.
bool openEditor(const QModelIndex &index, QEvent *event)
virtual void _q_rowsInserted(const QModelIndex &parent, int start, int end)
This slot is called when rows have been inserted.
State state() const
Returns the item view's state.
void focusOutEvent(QFocusEvent *event)
This function is called with the given event when the widget looses the focus.
int y() const
Returns the y coordinate of this point.
The QLineEdit widget is a one-line text editor.
void mouseReleaseEvent(QMouseEvent *event)
This function is called with the given event when a mouse button is released, after a mouse press eve...
QModelIndexList selectedDraggableIndexes() const
virtual void rowsInserted(const QModelIndex &parent, int start, int end)
This slot is called when rows are inserted.
EndEditHint
This enum describes the different hints that the delegate can give to the model and view components t...
virtual void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
This slot is called when items are changed in the model.
The QPixmap class is an off-screen image representation that can be used as a paint device...
virtual QRegion visualRegionForSelection(const QItemSelection &selection) const =0
Returns the region from the viewport of the items in the given selection.
EditTrigger
This enum describes actions which will initiate item editing.
virtual void updateGeometries()
Updates the geometry of the child widgets of the view.
virtual ~QAbstractItemViewPrivate()
void ignore()
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).
const QMimeData * mimeData() const
Returns the data that was dropped on the widget and its associated MIME type information.
The QSize class defines the size of a two-dimensional object using integer point precision.
void setHotSpot(const QPoint &hotspot)
Sets the position of the hot spot relative to the top-left corner of the pixmap used to the point spe...
void setHorizontalStepsPerItem(int steps)
Sets the horizontal scroll bar's steps per item to steps.
void setItemDelegate(QAbstractItemDelegate *delegate)
Sets the item delegate for this view and its model to delegate.
bool intersects(const QRect &r) const
Returns true if this rectangle intersects with the given rectangle (i.
int x() const
Returns the x coordinate of this point.
QModelIndexList indexes() const
Returns a list of model indexes that correspond to the selected items.
void doubleClicked(const QModelIndex &index)
This signal is emitted when a mouse button is double-clicked.
void closePersistentEditor(const QModelIndex &index)
Closes the persistent editor for the item at the given index.
The QStyleOptionViewItem class is used to describe the parameters used to draw an item in a view widg...
void scrollDirtyRegion(int dx, int dy)
Prepares the view for scrolling by ({dx},{dy}) pixels by moving the dirty regions in the opposite dir...
virtual void horizontalScrollbarAction(int action)
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.
bool isValid() const
Returns true if the rectangle is valid, otherwise returns false.
QItemSelectionModel::SelectionFlags contiguousSelectionCommand(const QModelIndex &index, const QEvent *event) const
QModelIndex rootIndex() const
Returns the model index of the model's root item.
Q_TESTLIB_EXPORT QTestData & newRow(const char *dataTag)
Appends a new row to the current test data.
QAbstractItemModel * model() const
Returns the model that this view is presenting.
EditTriggers editTriggers() const
static const KeyPair *const end
void dragLeaveEvent(QDragLeaveEvent *event)
This function is called when the item being dragged leaves the view.
bool event(QEvent *event)
Reimplemented Function
The QEvent class is the base class of all event classes.
Type type() const
Returns the event type.
static int doubleClickInterval()
static QWidget * focusWidget()
Returns the application widget that has the keyboard input focus, or 0 if no widget in this applicati...
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
QAbstractItemModel * model
void setState(State state)
Sets the item view's state to the given state.
void deleteLater()
Schedules this object for deletion.
void setItemDelegateForColumn(int column, QAbstractItemDelegate *delegate)
Sets the given item delegate used by this view and model for the given column.
void mousePressEvent(QMouseEvent *event)
This function is called with the given event when a mouse button is pressed while the cursor is insid...
QRect rect
the area that should be used for various calculations and painting
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...
virtual int sizeHintForRow(int row) const
Returns the height size hint for the specified row or -1 if there is no model.
The QFocusEvent class contains event parameters for widget focus events.
virtual void updateEditorGeometries()
Updates the geometry of the open editor widgets in the view.
friend class const_iterator
The QMap class is a template class that provides a skip-list-based dictionary.
bool viewportEvent(QEvent *event)
This function is used to handle tool tips, and What's This? mode, if the given event is a QEvent::Too...
const QPoint & pos() const
Returns the position where the drop was made.
bool viewportEnteredNeeded
static QPoint pos()
Returns the position of the cursor (hot spot) in global screen coordinates.
bool shouldAutoScroll(const QPoint &pos) const
void addEditor(const QModelIndex &index, QWidget *editor, bool isStatic)
int column() const
Returns the column this model index refers to.
virtual void startDrag(Qt::DropActions supportedActions)
Starts a drag by calling drag->exec() using the given supportedActions.
static int area(const QSize &s)
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list...
bool isValid() const
Returns true if this persistent model index is valid; otherwise returns false.
virtual QModelIndex indexAt(const QPoint &point) const =0
Returns the model index of the item at the viewport coordinates point.
QPoint topLeft() const
Returns the position of the rectangle's top-left corner.
virtual void keyboardSearch(const QString &search)
Moves to and selects the item best matching the string search.
The QHelpEvent class provides an event that is used to request helpful information about a particular...
QAbstractItemDelegate * itemDelegateForColumn(int column) const
Returns the item delegate used by this view and model for the given column.
void removeAt(int i)
Removes the item at index position i.
const QPoint & pos() const
Returns the mouse cursor position when the event was generated, relative to the widget to which the e...