8#if QT_CONFIG(accessibility)
15#if QT_CONFIG(draganddrop)
20#if QT_CONFIG(rubberband)
25#include <private/qapplication_p.h>
26#include <private/qlistview_p.h>
27#include <private/qscrollbar_p.h>
152 d->updateStyledFrameWidths();
165 d->updateStyledFrameWidths();
200#if QT_CONFIG(draganddrop)
202 setDragEnabled(movable);
203 d->viewport->setAcceptDrops(movable);
205 d->doDelayedItemsLayout();
236 d->doDelayedItemsLayout();
265 d->doDelayedItemsLayout();
271 return d->isWrapping();
290 d->resizeMode =
mode;
296 return d->resizeMode;
315 d->layoutMode =
mode;
321 return d->layoutMode;
342 d->setSpacing(space);
343 d->doDelayedItemsLayout();
397 d->setGridSize(
size);
398 d->doDelayedItemsLayout();
404 return d->gridSize();
425 if (
d->commonListView &&
d->viewMode ==
mode)
429 delete d->commonListView;
433 d->setWrapping(
false);
445 d->showElasticBand =
false;
449 d->setWrapping(
true);
461 d->showElasticBand =
true;
464#if QT_CONFIG(draganddrop)
465 bool movable = (
d->movement !=
Static);
466 setDragEnabled(movable);
467 setAcceptDrops(movable);
470 d->doDelayedItemsLayout();
491 d->modeProperties = 0;
500 return d->isHidden(
row);
510 const bool hidden =
d->isHidden(
row);
512 d->commonListView->appendHiddenRow(
row);
513 else if (!
hide && hidden)
514 d->commonListView->removeHiddenRow(
row);
515 d->doDelayedItemsLayout();
516 d->viewport->update();
535 if (
index.parent() !=
d->root ||
index.column() !=
d->column)
542 d->viewport->update(
rect);
547 verticalScrollBar()->setValue(
d->verticalScrollToValue(
index,
rect,
hint));
550 horizontalScrollBar()->setValue(
d->horizontalScrollToValue(
index,
rect,
hint));
558 const bool leftOf =
q->isRightToLeft()
561 const bool rightOf =
q->isRightToLeft()
624 QList<QModelIndex> visibleIndexes =
626 std::sort(visibleIndexes.begin(), visibleIndexes.end());
627 for (
const auto &
index : indexes) {
628 if (std::binary_search(visibleIndexes.cbegin(), visibleIndexes.cend(),
index)) {
636 rect.setRight(clipped.right());
647 d->hiddenRows.clear();
661 d->hiddenRows.clear();
673 d->delayedAutoScroll.stop();
695 return d->contentsSize();
702 const QList<int> &roles)
704 d_func()->commonListView->dataChanged(topLeft, bottomRight);
716 d->doDelayedItemsLayout();
728 if (parent ==
d->root) {
730 while (
it !=
d->hiddenRows.
end()) {
731 int hiddenRow =
it->row();
732 if (hiddenRow >=
start && hiddenRow <=
end) {
740 d->doDelayedItemsLayout();
753 &&
d->showElasticBand
760 .
adjusted(-margin, -margin, margin, margin);
761 d->viewport->update(
d->mapToViewport(viewPortRect));
762 d->elasticBand =
rect;
774 if (
d->showElasticBand &&
d->elasticBand.isValid()) {
776 const QRect viewPortRect =
d->elasticBand.
adjusted(-margin, -margin, margin, margin);
777 d->viewport->update(
d->mapToViewport(viewPortRect));
782#if QT_CONFIG(wheelevent)
786void QListView::wheelEvent(QWheelEvent *e)
789 if (
qAbs(e->angleDelta().y()) >
qAbs(e->angleDelta().x())) {
790 if (e->angleDelta().x() == 0
792 &&
d->vbar->minimum() == 0 &&
d->vbar->maximum() == 0) {
793 QPoint pixelDelta(e->pixelDelta().y(), e->pixelDelta().x());
794 QPoint angleDelta(e->angleDelta().y(), e->angleDelta().x());
795 QWheelEvent hwe(e->position(), e->globalPosition(), pixelDelta, angleDelta,
796 e->buttons(), e->modifiers(), e->phase(), e->inverted(), e->source());
797 if (e->spontaneous())
801 e->setAccepted(hwe.isAccepted());
817 if (e->
timerId() ==
d->batchLayoutTimer.timerId()) {
818 if (
d->doItemsLayout(
d->batchSize)) {
819 d->batchLayoutTimer.stop();
821 d->viewport->update();
833 if (
d->delayedPendingLayout)
841 bool listWrap = (
d->viewMode ==
ListMode) &&
d->wrapItemText;
850 d->doDelayedItemsLayout(100);
856#if QT_CONFIG(draganddrop)
861void QListView::dragMoveEvent(QDragMoveEvent *e)
864 if (!
d->commonListView->filterDragMoveEvent(e)) {
868 QAbstractItemView::dragMoveEvent(e);
876void QListView::dragLeaveEvent(QDragLeaveEvent *e)
878 if (!d_func()->commonListView->filterDragLeaveEvent(e))
879 QAbstractItemView::dragLeaveEvent(e);
885void QListView::dropEvent(QDropEvent *
event)
890 dragDropMode() == QAbstractItemView::InternalMove)) {
892 bool topIndexDropped =
false;
896 if (!
event->isAccepted() &&
d->dropOn(
event, &
row, &col, &topIndex)) {
898 QList<QPersistentModelIndex> persIndexes;
899 persIndexes.reserve(selIndexes.size());
901 for (
const auto &
index : selIndexes) {
902 persIndexes.append(
index);
903 if (
index == topIndex) {
904 topIndexDropped =
true;
909 if (!topIndexDropped && !topIndex.isValid()) {
910 std::sort(persIndexes.begin(), persIndexes.end());
915 bool dataMoved =
false;
916 for (
int i = 0;
i < persIndexes.size(); ++
i) {
919 if (
r != pIndex.row() &&
r != pIndex.row() + 1) {
928 r = pIndex.row() + 1;
937 if (
event->isAccepted())
938 d->dropEventMoved =
true;
941 if (!
d->commonListView->filterDropEvent(
event) || !
d->dropEventMoved) {
943 if (!
d->dropEventMoved)
945 QAbstractItemView::dropEvent(
event);
952void QListView::startDrag(Qt::DropActions supportedActions)
954 if (!d_func()->commonListView->filterStartDrag(supportedActions))
955 QAbstractItemView::startDrag(supportedActions);
967 if (!
d->iconSize.isValid()) {
974 option->showDecorationSelected =
false;
975 option->decorationPosition = QStyleOptionViewItem::Top;
978 option->decorationPosition = QStyleOptionViewItem::Left;
981 if (
d->gridSize().isValid()) {
982 option->rect.setSize(
d->gridSize());
993 if (!
d->itemDelegate)
995 QStyleOptionViewItem
option;
999 const QList<QModelIndex> toBeRendered =
1006 const bool focus = (hasFocus() ||
d->viewport->hasFocus()) && current.
isValid();
1007 const bool alternate =
d->alternatingColors;
1012 bool alternateBase =
false;
1013 int previousRow = -2;
1016 ?
qMax(
viewport()->size().width(),
d->contentsSize().width()) - 2 *
d->spacing()
1040 option.palette.setCurrentColorGroup(cg);
1042 if (
focus && current == *
it) {
1050 int row = (*it).row();
1051 if (
row != previousRow + 1) {
1053 if (!
d->hiddenRows.isEmpty()) {
1054 for (
int r =
qMax(previousRow + 1, 0);
r <
row; ++
r) {
1055 if (!
d->isHidden(
r))
1056 alternateBase = !alternateBase;
1059 alternateBase = (
row & 1) != 0;
1062 option.features.setFlag(QStyleOptionViewItem::Alternate, alternateBase);
1066 QStyle::State oldState =
option.state;
1071 alternateBase = !alternateBase;
1078#if QT_CONFIG(draganddrop)
1079 d->commonListView->paintDragDrop(&
painter);
1082#if QT_CONFIG(rubberband)
1084 if (
d->showElasticBand &&
d->elasticBand.isValid()) {
1085 QStyleOptionRubberBand
opt;
1090 d->viewport->rect().adjusted(-16, -16, 16, 16));
1105 const QList<QModelIndex> intersectVector =
d->intersectingSet(
rect);
1118 return d_func()->commonListView->horizontalOffset();
1126 return d_func()->commonListView->verticalOffset();
1137 auto findAvailableRowBackward = [
d](
int row) {
1138 while (
row >= 0 &&
d->isHiddenOrDisabled(
row))
1143 auto findAvailableRowForward = [
d](
int row) {
1144 int rowCount =
d->model->rowCount(
d->root);
1147 while (row < rowCount && d->isHiddenOrDisabled(
row))
1149 if (
row >= rowCount)
1156 int row = findAvailableRowForward(0);
1159 return d->model->index(
row,
d->column,
d->root);
1164 const int row = findAvailableRowBackward(current.
row() - 1);
1170 const int row = findAvailableRowForward(current.
row() + 1);
1178 if (
rect.isEmpty()) {
1179 return d->model->index(0,
d->column,
d->root);
1184 QList<QModelIndex> intersectVector;
1186 switch (cursorAction) {
1188 while (intersectVector.isEmpty()) {
1190 if (
rect.right() <= 0)
1192 if (
rect.left() < 0)
1194 intersectVector =
d->intersectingSet(
rect);
1195 d->removeCurrentAndDisabled(&intersectVector, current);
1197 return d->closestIndex(initialRect, intersectVector);
1199 while (intersectVector.isEmpty()) {
1205 intersectVector =
d->intersectingSet(
rect);
1206 d->removeCurrentAndDisabled(&intersectVector, current);
1208 return d->closestIndex(initialRect, intersectVector);
1210 if (
rect.height() >=
d->viewport->height())
1213 rect.moveTop(
rect.top() -
d->viewport->height() + 1);
1219 while (intersectVector.isEmpty()
1222 rect.translate(0, 1);
1223 if (
rect.bottom() <= 0) {
1226 intersectVector =
d->intersectingSet(
rect);
1227 findindex =
d->closestIndex(initialRect, intersectVector);
1233 while (intersectVector.isEmpty()) {
1235 if (
rect.bottom() <= 0) {
1236#ifdef QT_KEYPAD_NAVIGATION
1237 if (QApplicationPrivate::keypadNavigationEnabled()) {
1238 int row =
d->batchStartRow() - 1;
1239 while (
row >= 0 &&
d->isHiddenOrDisabled(
row))
1249 intersectVector =
d->intersectingSet(
rect);
1250 d->removeCurrentAndDisabled(&intersectVector, current);
1252 return d->closestIndex(initialRect, intersectVector);
1254 if (
rect.height() >=
d->viewport->height())
1257 rect.moveTop(
rect.top() +
d->viewport->height() - 1);
1264 while (intersectVector.isEmpty()
1267 rect.translate(0, -1);
1271 intersectVector =
d->intersectingSet(
rect);
1272 index =
d->closestIndex(initialRect, intersectVector);
1278 while (intersectVector.isEmpty()) {
1281#ifdef QT_KEYPAD_NAVIGATION
1282 if (QApplicationPrivate::keypadNavigationEnabled()) {
1283 int rowCount =
d->
model->rowCount(
d->root);
1285 while (row < rowCount && d->isHiddenOrDisabled(
row))
1288 return d->model->index(
row,
d->column,
d->root);
1295 intersectVector =
d->intersectingSet(
rect);
1296 d->removeCurrentAndDisabled(&intersectVector, current);
1298 return d->closestIndex(initialRect, intersectVector);
1300 return d->
model->index(0,
d->column,
d->root);
1302 return d->model->index(
d->batchStartRow() - 1,
d->column,
d->root);}
1315 return d_func()->rectForIndex(
index);
1330 || !
d->isIndexValid(
index)
1331 ||
index.parent() !=
d->root
1332 ||
index.column() !=
d->column)
1335 d->executePostedLayout();
1345 if (!
d->selectionModel)
1349 int w =
qMax(
d->contentsSize().width(),
d->viewport->width());
1350 int h =
qMax(
d->contentsSize().height(),
d->viewport->height());
1356 if (
rect.width() == 1 &&
rect.height() == 1) {
1357 const QList<QModelIndex> intersectVector =
1360 if (!intersectVector.isEmpty())
1361 tl = intersectVector.last();
1362 if (tl.
isValid() &&
d->isIndexEnabled(tl))
1371 QList<QModelIndex> intersectVector =
d->intersectingSet(topLeft);
1372 if (!intersectVector.isEmpty())
1373 tl = intersectVector.last();
1376 intersectVector =
d->intersectingSet(bottomRight);
1377 if (!intersectVector.isEmpty())
1378 br = intersectVector.last();
1382 &&
d->isIndexEnabled(tl)
1383 &&
d->isIndexEnabled(br)) {
1385 QRect last =
d->cellRectForIndex(br);
1391 if (
top.center().y() >
bottom.center().y()) {
1399 if (isRightToLeft())
1404 if (isRightToLeft())
1408 }
else if (
top.left() >
bottom.right()) {
1409 if (isRightToLeft())
1414 if (isRightToLeft())
1432 if (
left.center().x() >
right.center().x())
1438 if (isRightToLeft())
1444 if (isRightToLeft())
1456 }
else if (
left.bottom() <
right.top()) {
1475 d->selectionModel->select(
selection, command);
1490 const QRect &viewportRect =
d->viewport->rect();
1492 if (!elem.isValid())
1497 if (parent !=
d->root)
1499 int t = elem.topLeft().
row();
1500 int b = elem.bottomRight().row();
1501 if (
d->viewMode ==
IconMode ||
d->isWrapping()) {
1502 for (
int r =
t;
r <=
b; ++
r) {
1505 selectionRegion +=
rect;
1508 while (t <= b && d->isHidden(
t)) ++
t;
1509 while (
b >=
t &&
d->isHidden(
b)) --
b;
1515 selectionRegion +=
rect;
1519 return selectionRegion;
1528 if (!
d->selectionModel)
1535 viewSelected.removeIf(ignorable);
1536 return viewSelected;
1552 if (
d->model->columnCount(
d->root) > 0) {
1553 d->resetBatchStartRow();
1555 d->doItemsLayout(
d->model->rowCount(
d->root));
1556 }
else if (!
d->batchLayoutTimer.isActive()) {
1557 if (!
d->doItemsLayout(
d->batchSize))
1558 d->batchLayoutTimer.start(0,
this);
1573 if (geometry().isEmpty() ||
d->model->rowCount(
d->root) <= 0 ||
d->model->columnCount(
d->root) <= 0) {
1574 horizontalScrollBar()->setRange(0, 0);
1575 verticalScrollBar()->setRange(0, 0);
1578 QStyleOptionViewItem
option;
1581 d->commonListView->updateHorizontalScrollBar(step);
1582 d->commonListView->updateVerticalScrollBar(step);
1588 if (
d->movement ==
Static && !
d->isWrapping()) {
1589 d->layoutChildren();
1593 horizontalScrollBar()->setRange(0, 0);
1598 verticalScrollBar()->setRange(0, 0);
1611 return (
d->isHidden(
index.row())
1612 && (
index.parent() ==
d->root)
1613 &&
index.column() ==
d->column);
1626 if (column < 0 || column >=
d->model->columnCount(
d->root))
1629 d->doDelayedItemsLayout();
1630#if QT_CONFIG(accessibility)
1631 if (QAccessible::isActive()) {
1632 QAccessibleTableModelChangeEvent
event(
this, QAccessibleTableModelChangeEvent::ModelReset);
1633 QAccessible::updateAccessibility(&
event);
1664 return d->uniformItemSizes;
1684 if (
d->wrapItemText == on)
1686 d->wrapItemText = on;
1687 d->doDelayedItemsLayout();
1693 return d->wrapItemText;
1715 d->setSelectionRectVisible(
show);
1721 return d->isSelectionRectVisible();
1741 d->doDelayedItemsLayout();
1747 return d->itemAlignment;
1774 uniformItemSizes(
false),
1776 showElasticBand(
false),
1777 itemAlignment(
Qt::Alignment())
1801 int frameAroundContents = 0;
1832 int last =
qMin(
first + delta - 1, max);
1839 if (max < 0 || last <
first) {
1867 if (!
rect.isValid())
1871 int dx = -
q->horizontalOffset();
1872 int dy = -
q->verticalOffset();
1873 return result.adjusted(dx, dy, dx, dy);
1877 const QList<QModelIndex> &candidates)
const
1880 int shortest = INT_MAX;
1884 for (;
it != candidates.
end(); ++
it) {
1885 if (!(*it).isValid())
1893 if ((
target.center().x() >= indexRect.x() &&
target.center().x() < indexRect.right())
1894 || (indexRect.center().x() >=
target.x() && indexRect.center().x() <
target.right())) {
1897 }
else if ((
target.center().y() >= indexRect.y() &&
target.center().y() < indexRect.bottom())
1898 || (indexRect.center().y() >=
target.y() && indexRect.center().y() <
target.bottom())) {
1902 distance = (indexRect.center() -
target.center()).manhattanLength();
1934 for (;
it != intersectVector.
end(); ++
it) {
1937 }
else if ((*it).row() == (tl.
row() - 1)) {
1939 }
else if ((*it).row() == (br.
row() + 1)) {
1957#if QT_CONFIG(draganddrop)
1963 return QAbstractItemViewPrivate::position(
pos,
rect, idx);
1966bool QListViewPrivate::dropOn(QDropEvent *
event,
int *dropRow,
int *dropCol,
QModelIndex *dropIndex)
1971 return QAbstractItemViewPrivate::dropOn(
event, dropRow, dropCol, dropIndex);
1981 indexes->removeIf(isCurrentOrDisabled);
1998#if QT_CONFIG(draganddrop)
2009 return v->contentsRect().marginsRemoved(
v->viewportMargins()).size();
2027 bool horizontalWantsToShow;
2028 if (verticalWantsToShow)
2033 if (bothScrollBarsAuto && !horizontalWantsToShow) {
2057 bool verticalWantsToShow;
2058 if (horizontalWantsToShow)
2063 if (bothScrollBarsAuto && !verticalWantsToShow) {
2083 verticalValue += adjusted.
top();
2087 verticalValue += adjusted.
top() - ((
area.height() - adjusted.
height()) / 2);
2088 return verticalValue;
2102 horizontalValue += ((
area.width() -
rect.width()) / 2) -
rect.left();
2105 horizontalValue -=
rect.left();
2111 horizontalValue +=
rect.left() - ((
area.width()-
rect.width()) / 2);
2114 horizontalValue +=
rect.left();
2119 return horizontalValue;
2128#if QT_CONFIG(draganddrop)
2133#if QT_CONFIG(draganddrop)
2136 QAbstractItemView::DropIndicatorPosition
r = QAbstractItemView::OnViewport;
2137 if (!
dd->overwrite) {
2138 const int margin = 2;
2139 if (
pos.x() -
rect.left() < margin) {
2140 r = QAbstractItemView::AboveItem;
2141 }
else if (
rect.right() -
pos.x() < margin) {
2142 r = QAbstractItemView::BelowItem;
2143 }
else if (
rect.contains(
pos,
true)) {
2144 r = QAbstractItemView::OnItem;
2148 touchingRect.
adjust(-1, -1, 1, 1);
2149 if (touchingRect.contains(
pos,
false)) {
2150 r = QAbstractItemView::OnItem;
2155 r =
pos.x() <
rect.center().x() ? QAbstractItemView::AboveItem : QAbstractItemView::BelowItem;
2160void QListModeViewBase::dragMoveEvent(QDragMoveEvent *
event)
2162 if (
qq->dragDropMode() == QAbstractItemView::InternalMove
2170 QPoint p =
event->position().toPoint();
2180 if (
index.isValid() &&
dd->showDropIndicator) {
2184 switch (
dd->dropIndicatorPosition) {
2185 case QAbstractItemView::AboveItem:
2186 if (
dd->isIndexDropEnabled(
index.parent())) {
2190 dd->dropIndicatorRect =
QRect();
2193 case QAbstractItemView::BelowItem:
2194 if (
dd->isIndexDropEnabled(
index.parent())) {
2198 dd->dropIndicatorRect =
QRect();
2201 case QAbstractItemView::OnItem:
2202 if (
dd->isIndexDropEnabled(
index)) {
2203 dd->dropIndicatorRect =
rect;
2206 dd->dropIndicatorRect =
QRect();
2209 case QAbstractItemView::OnViewport:
2210 dd->dropIndicatorRect =
QRect();
2217 dd->dropIndicatorRect =
QRect();
2218 dd->dropIndicatorPosition = QAbstractItemView::OnViewport;
2223 dd->viewport->update();
2241bool QListModeViewBase::dropOn(QDropEvent *
event,
int *dropRow,
int *dropCol,
QModelIndex *dropIndex)
2243 if (
event->isAccepted())
2247 if (
dd->viewport->rect().contains(
event->position().toPoint())) {
2249 QPoint p =
event->position().toPoint();
2255 if (!
index.isValid())
2265 switch (
dd->dropIndicatorPosition) {
2266 case QAbstractItemView::AboveItem:
2268 col =
index.column();
2271 case QAbstractItemView::BelowItem:
2273 col =
index.column();
2276 case QAbstractItemView::OnItem:
2277 case QAbstractItemView::OnViewport:
2281 dd->dropIndicatorPosition = QAbstractItemView::OnViewport;
2345 if (idx.
row() <= scrollBarValue)
2441 dx = previousCoordinate - currentCoordinate;
2447 dy = previousCoordinate - currentCoordinate;
2458 dy = previousCoordinate - currentCoordinate;
2464 dx = previousCoordinate - currentCoordinate;
2472 doStaticLayout(
info);
2487 QStyleOptionViewItem options;
2505 cellSize.setWidth(
right -
pos.x());
2514 pos.setX(
pos.x() + cellSize.width() -
size.width());
2516 pos.setX(
pos.x() + (cellSize.width() -
size.width()) / 2);
2518 size.setWidth(cellSize.width());
2527 if (
info.first == 0) {
2537 }
else if (
info.wrap) {
2562 const bool useItemSize = !
info.grid.isValid();
2563 const QPoint topLeft = initStaticLayout(
info);
2564 QStyleOptionViewItem
option;
2575 int segStartPosition;
2577 int deltaFlowPosition;
2578 int deltaSegPosition;
2584 segStartPosition =
info.bounds.left();
2585 segEndPosition =
info.bounds.width();
2587 segPosition = topLeft.
y();
2588 deltaFlowPosition =
info.grid.width();
2590 deltaSegHint =
info.grid.height();
2592 segStartPosition =
info.bounds.top();
2593 segEndPosition =
info.bounds.height();
2595 segPosition = topLeft.
x();
2596 deltaFlowPosition =
info.grid.height();
2598 deltaSegHint =
info.grid.width();
2609 deltaFlowPosition =
hint.width() +
info.spacing;
2610 deltaSegHint =
hint.height() +
info.spacing;
2612 deltaFlowPosition =
hint.height() +
info.spacing;
2613 deltaSegHint =
hint.width() +
info.spacing;
2620 segPosition +=
info.spacing + deltaSegPosition;
2623 deltaSegPosition = 0;
2629 deltaSegPosition =
qMax(deltaSegHint, deltaSegPosition);
2643 rect.setBottom(segPosition + deltaSegPosition);
2645 rect.setRight(segPosition + deltaSegPosition);
2657 QRect changedRect(topLeft,
rect.bottomRight());
2658 if (
clipRect().intersects(changedRect))
2669 QList<QModelIndex>
ret;
2670 int segStartPosition;
2672 int flowStartPosition;
2673 int flowEndPosition;
2675 segStartPosition =
area.top();
2676 segEndPosition =
area.bottom();
2677 flowStartPosition =
area.left();
2678 flowEndPosition =
area.right();
2680 segStartPosition =
area.left();
2681 segEndPosition =
area.right();
2682 flowStartPosition =
area.top();
2683 flowEndPosition =
area.bottom();
2689 int seg = qBinarySearch<int>(
segmentPositions, segStartPosition, 0, segLast + 1);
2700 if (
index.isValid()) {
2705 const int iw = viewItem.width();
2708 if (endPos >= viewItem.x && startPos < viewItem.x + iw)
2714 qWarning(
"intersectingSet: row %d was invalid",
row);
2744int QListModeViewBase::perItemScrollingPageSteps(
int length,
int bounds,
bool wrap)
const
2768 while (
pos >= 0 && steps > 0) {
2776 return qMax(pageSteps, 1);
2779int QListModeViewBase::perItemScrollToValue(
int index,
int scrollValue,
int viewportSize,
2788 std::sort(hiddenRows.begin(), hiddenRows.end());
2789 int hiddenRowsBefore = 0;
2790 for (
int i = 0;
i < hiddenRows.size() - 1; ++
i)
2791 if (hiddenRows.at(
i) >
index + hiddenRowsBefore)
2796 int topIndex =
index;
2797 const int bottomIndex = topIndex;
2799 while (topIndex > 0 &&
2803 while (hiddenRowsBefore > 0 && hiddenRows.at(hiddenRowsBefore - 1) >= topIndex + hiddenRowsBefore - 1)
2807 const int itemCount = bottomIndex - topIndex + 1;
2812 return index - itemCount + 1;
2814 return index - (itemCount / 2);
2821 if (flowOrientation == orientation) {
2827 const int rightSegment = leftSegment;
2830 while (leftSegment > scrollValue &&
2835 const int segmentCount = rightSegment - leftSegment + 1;
2893#if QT_CONFIG(draganddrop)
2894bool QIconModeViewBase::filterStartDrag(Qt::DropActions supportedActions)
2900 if (indexes.
size() > 0 ) {
2916 dd->dropEventMoved =
false;
2921 if (
dd->dragDropMode != QAbstractItemView::InternalMove || drag->
target() ==
qq->viewport())
2924 dd->dropEventMoved =
false;
2929bool QIconModeViewBase::filterDropEvent(QDropEvent *e)
2931 if (e->source() !=
qq)
2937 if (
qq->acceptDrops()) {
2947 for (
const auto &
index : indexes) {
2951 if (
qq->isRightToLeft())
2953 moveItem(
index.row(), dest);
2960 dd->dropEventMoved =
true;
2966 updateContentsSize();
2973bool QIconModeViewBase::filterDragLeaveEvent(QDragLeaveEvent *e)
2977 return QCommonListViewBase::filterDragLeaveEvent(e);
2980bool QIconModeViewBase::filterDragMoveEvent(QDragMoveEvent *e)
2982 const bool wasAccepted = e->isAccepted();
2987 if (e->source() !=
qq || !
dd->canDrop(e)) {
2989 e->setAccepted(wasAccepted);
3005 index = intersectVector.size() > 0 ? intersectVector.last() :
QModelIndex();
3014 else if (!
index.isValid())
3031 if (scrollElasticBand)
3042 QStyleOptionViewItem
option;
3063 QStyleOptionViewItem
option;
3070 doDynamicLayout(
info);
3086 for (
int l = 0; l < leafCount; ++l)
3102 if (
info.first == 0) {
3107 int idx =
info.first - 1;
3126 const bool useItemSize = !
info.grid.isValid();
3127 const QPoint topLeft = initDynamicLayout(
info);
3129 int segStartPosition;
3131 int deltaFlowPosition;
3132 int deltaSegPosition;
3138 segStartPosition =
info.bounds.left() +
info.spacing;
3139 segEndPosition =
info.bounds.right();
3140 deltaFlowPosition =
info.grid.width();
3142 deltaSegHint =
info.grid.height();
3144 segPosition = topLeft.
y();
3146 segStartPosition =
info.bounds.top() +
info.spacing;
3147 segEndPosition =
info.bounds.bottom();
3148 deltaFlowPosition =
info.grid.height();
3150 deltaSegHint =
info.grid.width();
3152 segPosition = topLeft.
x();
3169 deltaFlowPosition =
item->w +
info.spacing;
3171 deltaFlowPosition =
item->h +
info.spacing;
3182 segPosition += deltaSegPosition;
3184 deltaSegPosition = 0;
3190 deltaSegHint =
item->h +
info.spacing;
3192 deltaSegHint =
item->w +
info.spacing;
3193 deltaSegPosition =
qMax(deltaSegPosition, deltaSegHint);
3203 item->
y = segPosition;
3206 item->
y = segPosition;
3211 item->
x = segPosition;
3214 item->
x = segPosition;
3243 if (
rect.size().isEmpty())
3246 int insertFrom =
info.first;
3248 initBspTree(
rect.size());
3255 QRect changedRect(topLeft,
rect.bottomRight());
3256 if (
clipRect().intersects(changedRect))
3264 QList<QModelIndex>
res;
3265 that->interSectingVector = &
res;
3266 that->tree.climbTree(
area, &QIconModeViewBase::addLeaf,
data);
3267 that->interSectingVector =
nullptr;
3271QRect QIconModeViewBase::itemsRect(
const QList<QModelIndex> &indexes)
const
3274 for (
const auto &
index : indexes)
3281 if (!
item.isValid())
3283 int i =
item.indexHint;
3315void QIconModeViewBase::addLeaf(QList<int> &leaf,
const QRect &
area,
uint visited,
3320 for (
int i = 0;
i < leaf.size(); ++
i) {
3321 int idx = leaf.at(
i);
3322 if (idx < 0 || idx >= _this->items.size())
3324 vi = &_this->items[idx];
3326 if (vi->
isValid() && vi->rect().intersects(
area) && vi->visited != visited) {
3329 _this->interSectingVector->append(
index);
3330 vi->visited = visited;
3335void QIconModeViewBase::moveItem(
int index,
const QPoint &dest)
3362QPoint QIconModeViewBase::draggedItemsDelta()
const
3372QRect QIconModeViewBase::draggedItemsRect()
const
3375 rect.translate(draggedItemsDelta());
3400void QIconModeViewBase::updateContentsSize()
3414#if QT_CONFIG(accessibility)
3415 if (QAccessible::isActive()) {
3416 if (current.
isValid() && hasFocus()) {
3417 int entry = visualIndex(current);
3418 QAccessibleEvent
event(
this, QAccessible::Focus);
3419 event.setChild(
entry);
3420 QAccessible::updateAccessibility(&
event);
3432#if QT_CONFIG(accessibility)
3433 if (QAccessible::isActive()) {
3436 if (sel.isValid()) {
3437 int entry = visualIndex(sel);
3438 QAccessibleEvent
event(
this, QAccessible::SelectionAdd);
3439 event.setChild(
entry);
3440 QAccessible::updateAccessibility(&
event);
3442 QModelIndex desel = deselected.indexes().value(0);
3443 if (desel.isValid()) {
3444 int entry = visualIndex(desel);
3445 QAccessibleEvent
event(
this, QAccessible::SelectionRemove);
3446 event.setChild(
entry);
3447 QAccessible::updateAccessibility(&
event);
3457 d->executePostedLayout();
3459 int visualIndex =
d->commonListView->itemIndex(itm);
3460 for (
const auto &idx :
std::as_const(
d->hiddenRows)) {
3461 if (idx.row() <=
index.row())
3478 const int rc =
d->model->rowCount();
3482 QStyleOptionViewItem
option;
3486 QSize sz =
d->cachedItemSize;
3489 sz =
d->itemSize(
option, idx);
3498 int maximumRows = 1000;
3500 if (userOverrideValue.isValid() && userOverrideValue.toInt() > 0) {
3501 maximumRows = userOverrideValue.toInt();
3503 const int rowCount =
qMin(rc, maximumRows);
3508 for (
int row = 0;
row < rowCount; ++
row) {
3519#include "moc_qlistview.cpp"
The QAbstractItemDelegate class is used to display and edit data items from a model.
virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const =0
This pure abstract function must be reimplemented if you want to provide custom rendering.
virtual Qt::DropActions supportedDropActions() const
virtual Q_INVOKABLE Qt::ItemFlags flags(const QModelIndex &index) const
Returns the item flags for the given index.
virtual Q_INVOKABLE int rowCount(const QModelIndex &parent=QModelIndex()) const =0
Returns the number of rows under the given parent.
virtual QMimeData * mimeData(const QModelIndexList &indexes) const
Returns an object that contains serialized items of data corresponding to the list of indexes specifi...
virtual Q_INVOKABLE int columnCount(const QModelIndex &parent=QModelIndex()) const =0
Returns the number of columns for the children of the given parent.
virtual Q_INVOKABLE 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 doDelayedItemsLayout(int delay=0)
void scrollContentsBy(int dx, int dy)
QPointer< QItemSelectionModel > selectionModel
bool shouldAutoScroll(const QPoint &pos) const
QPersistentModelIndex root
bool droppingOnItself(QDropEvent *event, const QModelIndex &index)
QPixmap renderToPixmap(const QModelIndexList &indexes, QRect *r) const
QAbstractItemModel * model
QPersistentModelIndex hover
bool isIndexEnabled(const QModelIndex &index) const
The QAbstractItemView class provides the basic functionality for item view classes.
friend class QListModeViewBase
QAbstractItemModel * model() const
Returns the model that this view is presenting.
bool event(QEvent *event) override
\reimp
void timerEvent(QTimerEvent *event) override
This function is called with the given event when a timer event is sent to the widget.
virtual void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
This slot is called when the selection is changed.
State state() const
Returns the item view's state.
virtual void reset()
Reset the internal state of the view.
void mouseReleaseEvent(QMouseEvent *event) override
This function is called with the given event when a mouse button is released, after a mouse press eve...
virtual QAbstractItemDelegate * itemDelegateForIndex(const QModelIndex &index) const
virtual void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList< int > &roles=QList< int >())
This slot is called when items with the given roles are changed in the model.
QModelIndex currentIndex() const
Returns the model index of the current item.
virtual void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
This slot is called when rows are about to be removed.
State
Describes the different states the view can be in.
virtual void setRootIndex(const QModelIndex &index)
Sets the root item to the item at the given index.
virtual void initViewItemOption(QStyleOptionViewItem *option) const
virtual void doItemsLayout()
void update(const QModelIndex &index)
QModelIndex rootIndex() const
Returns the model index of the model's root item.
CursorAction
This enum describes the different ways to navigate between items,.
virtual void currentChanged(const QModelIndex ¤t, const QModelIndex &previous)
This slot is called when a new item becomes the current item.
void resizeEvent(QResizeEvent *event) override
This function is called with the given event when a resize event is sent to the widget.
ScrollHint
\value EnsureVisible Scroll to ensure that the item is visible.
virtual void rowsInserted(const QModelIndex &parent, int start, int end)
This slot is called when rows are inserted.
void setState(State state)
Sets the item view's state to the given state.
void mouseMoveEvent(QMouseEvent *event) override
This function is called with the given event when a mouse move event is sent to the widget.
void setSelectionMode(QAbstractItemView::SelectionMode mode)
virtual void updateGeometries()
QSize viewportSizeHint() const override
int value
the slider's current value
void setRange(int min, int max)
Sets the slider's minimum to min and its maximum to max.
void clear()
Clears the contents of the bit array and makes it empty.
bool testBit(qsizetype i) const
Returns true if the bit at index position i is 1; otherwise returns false.
void setBit(qsizetype i)
Sets the bit at index position i to 1.
void resize(qsizetype size)
Resizes the bit array to size bits.
qsizetype size() const
Returns the number of bits stored in the bit array.
void insertLeaf(const QRect &r, int i)
void create(int n, int d=-1)
void init(const QRect &area, NodeType type)
void removeLeaf(const QRect &r, int i)
QList< int > & leaf(int i)
virtual int horizontalScrollToValue(int index, QListView::ScrollHint hint, bool leftOf, bool rightOf, const QRect &area, const QRect &rect) const
QListView::Movement movement() const
QRect viewItemRect(const QListViewItem &item) const
QListView::ScrollMode horizontalScrollMode() const
QListView::ScrollMode verticalScrollMode() const
virtual void updateHorizontalScrollBar(const QSize &step)
virtual int horizontalOffset() const
QWidget * viewport() const
void initViewItemOption(QStyleOptionViewItem *option) const
virtual bool doBatchedItemLayout(const QListViewLayoutInfo &info, int max)=0
virtual void appendHiddenRow(int row)
virtual void updateVerticalScrollBar(const QSize &step)
virtual QListViewItem indexToListViewItem(const QModelIndex &index) const =0
virtual void removeHiddenRow(int row)
bool uniformItemSizes() const
QSize cachedItemSize() const
virtual void scrollContentsBy(int dx, int dy, bool scrollElasticBand)
virtual int verticalOffset() const
bool isHidden(int row) const
QScrollBar * verticalScrollBar() const
QSize itemSize(const QStyleOptionViewItem &opt, const QModelIndex &idx) const
QListView::Flow flow() const
virtual void setRowCount(int)=0
virtual QRect mapToViewport(const QRect &rect) const
QScrollBar * horizontalScrollBar() const
bool isRightToLeft() const
QModelIndex modelIndex(int row) const
virtual int verticalScrollToValue(int index, QListView::ScrollHint hint, bool above, bool below, const QRect &area, const QRect &rect) const
QPoint pressedPosition() const
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
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...
Qt::DropAction exec(Qt::DropActions supportedActions=Qt::MoveAction)
void setMimeData(QMimeData *data)
Sets the data to be sent to the given MIME data.
void setPixmap(const QPixmap &)
Sets pixmap as the pixmap used to represent the data in a drag and drop operation.
QObject * target() const
Returns the target of the drag and drop operation.
qreal y() const
This convenience function is equivalent to calling pos().y().
qreal x() const
This convenience function is equivalent to calling pos().x().
QList< QListViewItem > items
int itemIndex(const QListViewItem &item) const override
QList< QModelIndex > draggedItems
QListViewItem indexToListViewItem(const QModelIndex &index) const override
void setPositionForIndex(const QPoint &position, const QModelIndex &index) override
void setRowCount(int rowCount) override
void scrollContentsBy(int dx, int dy, bool scrollElasticBand) override
QList< QModelIndex > intersectingSet(const QRect &area) const override
void appendHiddenRow(int row) override
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) override
void removeHiddenRow(int row) override
bool doBatchedItemLayout(const QListViewLayoutInfo &info, int max) override
Q_INVOKABLE bool isSelected(const QModelIndex &index) const
Returns true if the given model item index is selected.
QModelIndexList selectedIndexes
virtual void select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)
Selects the model item index using the specified command, and emits selectionChanged().
Q_CORE_EXPORT QModelIndexList indexes() const
Returns a list of model indexes that correspond to the selected items.
Q_CORE_EXPORT void select(const QModelIndex &topLeft, const QModelIndex &bottomRight)
Adds the items in the range that extends from the top-left model item, specified by the topLeft index...
Q_CORE_EXPORT void merge(const QItemSelection &other, QItemSelectionModel::SelectionFlags command)
Merges the other selection with this QItemSelection using the command given.
void updateHorizontalScrollBar(const QSize &step) override
bool doBatchedItemLayout(const QListViewLayoutInfo &info, int max) override
QList< int > segmentExtents
QList< int > segmentPositions
QList< int > flowPositions
void updateVerticalScrollBar(const QSize &step) override
void scrollContentsBy(int dx, int dy, bool scrollElasticBand) override
QList< QModelIndex > intersectingSet(const QRect &area) const override
int horizontalOffset() const override
QRect mapToViewport(const QRect &rect) const override
int verticalOffset() const override
QListViewItem indexToListViewItem(const QModelIndex &index) const override
int verticalScrollToValue(int index, QListView::ScrollHint hint, bool above, bool below, const QRect &area, const QRect &rect) const override
int horizontalScrollToValue(int index, QListView::ScrollHint hint, bool leftOf, bool rightOf, const QRect &area, const QRect &rect) const override
QListModeViewBase(QListView *q, QListViewPrivate *d)
static QSize viewportSize(const QAbstractItemView *v)
void dataChanged(const QModelIndex &, const QModelIndex &) override
QList< int > segmentStartRows
QList< int > scrollValueMap
constexpr bool isValid() const
QListView::ViewMode viewMode
QSet< QPersistentModelIndex > hiddenRows
int horizontalScrollToValue(const QModelIndex &index, const QRect &rect, QListView::ScrollHint hint) const
QListView::Movement movement
QModelIndex closestIndex(const QRect &target, const QList< QModelIndex > &candidates) const
int batchStartRow() const
QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const override
\reimp
int verticalScrollToValue(const QModelIndex &index, const QRect &rect, QListView::ScrollHint hint) const
void scrollElasticBandBy(int dx, int dy)
Qt::Alignment itemAlignment
QRect rectForIndex(const QModelIndex &index) const
QSize itemSize(const QStyleOptionViewItem &option, const QModelIndex &index) const
void selectAll(QItemSelectionModel::SelectionFlags command) override
bool doItemsLayout(int num)
QListViewItem indexToListViewItem(const QModelIndex &index) const
QItemSelection selection(const QRect &rect) const
QCommonListViewBase * commonListView
void prepareItemsLayout()
void emitIndexesMoved(const QModelIndexList &indexes)
QList< QModelIndex > intersectingSet(const QRect &area, bool doLayout=true) const
QRect mapToViewport(const QRect &rect, bool extend=true) const
void viewUpdateGeometries()
bool isHidden(int row) const
void removeCurrentAndDisabled(QList< QModelIndex > *indexes, const QModelIndex ¤t) const
QList< int > hiddenRowIds() const
The QListView class provides a list or icon view onto a model.
LayoutMode layoutMode
determines whether the layout of items should happen immediately or be delayed.
void resizeEvent(QResizeEvent *e) override
\reimp
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList< int > &roles=QList< int >()) override
\reimp
void setSpacing(int space)
bool isSelectionRectVisible() const
int spacing
the space around the items in the layout
bool isWrapping
whether the items layout should wrap.
void currentChanged(const QModelIndex ¤t, const QModelIndex &previous) override
\reimp
void scrollTo(const QModelIndex &index, ScrollHint hint=EnsureVisible) override
\reimp
void initViewItemOption(QStyleOptionViewItem *option) const override
\reimp
void setRowHidden(int row, bool hide)
If hide is true, the given row will be hidden; otherwise the row will be shown.
void setLayoutMode(LayoutMode mode)
int batchSize
the number of items laid out in each batch if \l layoutMode is set to \l Batched.
~QListView()
Destroys the view.
ViewMode viewMode
the view mode of the QListView.
void setWordWrap(bool on)
void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) override
\reimp
int verticalOffset() const override
\reimp
void timerEvent(QTimerEvent *e) override
\reimp
bool uniformItemSizes
whether all items in the listview have the same size
bool wordWrap
the item text word-wrapping policy
QSize gridSize
the size of the layout grid
QSize contentsSize() const
void setViewMode(ViewMode mode)
QListView(QWidget *parent=nullptr)
Creates a new QListView with the given parent to view a model.
QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override
\reimp
void setRootIndex(const QModelIndex &index) override
\reimp
int modelColumn
the column in the model that is visible
QRegion visualRegionForSelection(const QItemSelection &selection) const override
\reimp
void setGridSize(const QSize &size)
Movement movement
whether the items can be moved freely, are snapped to a grid, or cannot be moved at all.
QRect rectForIndex(const QModelIndex &index) const
Returns the rectangle of the item at position index in the model.
bool event(QEvent *e) override
\reimp
void setModelColumn(int column)
void setWrapping(bool enable)
bool isRowHidden(int row) const
Returns true if the row is hidden; otherwise returns false.
QRect visualRect(const QModelIndex &index) const override
\reimp
int horizontalOffset() const override
\reimp
void setMovement(Movement movement)
void setBatchSize(int batchSize)
ViewMode
\value ListMode The items are laid out using TopToBottom flow, with Small size and Static movement \v...
void setPositionForIndex(const QPoint &position, const QModelIndex &index)
Qt::Alignment itemAlignment
the alignment of each item in its cell
void clearPropertyFlags()
Clears the QListView-specific property flags.
void setItemAlignment(Qt::Alignment alignment)
void mouseReleaseEvent(QMouseEvent *e) override
\reimp
ResizeMode
\value Fixed The items will only be laid out the first time the view is shown.
void setSelectionRectVisible(bool show)
void updateGeometries() override
\reimp
void mouseMoveEvent(QMouseEvent *e) override
\reimp
void setUniformItemSizes(bool enable)
void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command) override
\reimp
void setResizeMode(ResizeMode mode)
QModelIndexList selectedIndexes() const override
\reimp
Movement
\value Static The items cannot be moved by the user.
void scrollContentsBy(int dx, int dy) override
\reimp
QSize viewportSizeHint() const override
bool isIndexHidden(const QModelIndex &index) const override
\reimp
void resizeContents(int width, int height)
ResizeMode resizeMode
whether the items are laid out again when the view is resized.
Flow
\value LeftToRight The items are laid out in the view from the left to the right.
QModelIndex indexAt(const QPoint &p) const override
\reimp
void paintEvent(QPaintEvent *e) override
\reimp
LayoutMode
\value SinglePass The items are laid out all at once.
Flow flow
which direction the items layout should flow.
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) override
\reimp
void rowsInserted(const QModelIndex &parent, int start, int end) override
\reimp
void doItemsLayout() override
qsizetype size() const noexcept
bool isEmpty() const noexcept
const T & constLast() const noexcept
void push_back(parameter_type t)
const_reference at(qsizetype i) const noexcept
const_iterator constBegin() const noexcept
void reserve(qsizetype size)
void resize(qsizetype size)
void append(parameter_type t)
const_iterator constEnd() const noexcept
const_iterator ConstIterator
constexpr int row() const noexcept
Returns the row this model index refers to.
QModelIndex parent() const
Returns the parent of the model index, or QModelIndex() if it has no parent.
constexpr const QAbstractItemModel * model() const noexcept
Returns a pointer to the model containing the item that this index refers to.
constexpr int column() const noexcept
Returns the column this model index refers to.
constexpr bool isValid() const noexcept
Returns {true} if this model index is valid; otherwise returns {false}.
The QPaintEvent class contains event parameters for paint events.
const QRect & rect() const
Returns the rectangle that needs to be updated.
The QPainter class performs low-level painting on widgets and other paint devices.
void restore()
Restores the current painter state (pops a saved state off the stack).
void save()
Saves the current painter state (pushes the state onto a stack).
ColorGroup
\value Disabled \value Active \value Inactive \value Normal synonym for Active
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
constexpr QPoint toPoint() const
Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rou...
\inmodule QtCore\reentrant
constexpr int x() const noexcept
Returns the x coordinate of this point.
constexpr int y() const noexcept
Returns the y coordinate of this point.
constexpr void setX(int x) noexcept
Sets the x coordinate of this point to the given x coordinate.
\inmodule QtCore\reentrant
bool intersects(const QRect &r) const noexcept
Returns true if this rectangle intersects with the given rectangle (i.e., there is at least one pixel...
constexpr void adjust(int x1, int y1, int x2, int y2) noexcept
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
constexpr void moveBottom(int pos) noexcept
Moves the rectangle vertically, leaving the rectangle's bottom edge at the given y coordinate.
constexpr void moveRight(int pos) noexcept
Moves the rectangle horizontally, leaving the rectangle's right edge at the given x coordinate.
constexpr int height() const noexcept
Returns the height of the rectangle.
QRect intersected(const QRect &other) const noexcept
constexpr int bottom() const noexcept
Returns the y-coordinate of the rectangle's bottom edge.
constexpr void setRight(int pos) noexcept
Sets the right edge of the rectangle to the given x coordinate.
constexpr void setSize(const QSize &s) noexcept
Sets the size of the rectangle to the given size.
constexpr QRect adjusted(int x1, int y1, int x2, int y2) const noexcept
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
constexpr int top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr void moveLeft(int pos) noexcept
Moves the rectangle horizontally, leaving the rectangle's left edge at the given x coordinate.
constexpr void setBottom(int pos) noexcept
Sets the bottom edge of the rectangle to the given y coordinate.
constexpr void setLeft(int pos) noexcept
Sets the left edge of the rectangle to the given x coordinate.
constexpr int left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr QRect translated(int dx, int dy) const noexcept
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis,...
QRect united(const QRect &other) const noexcept
constexpr void moveTop(int pos) noexcept
Moves the rectangle vertically, leaving the rectangle's top edge at the given y coordinate.
constexpr int right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
constexpr void setTop(int pos) noexcept
Sets the top edge of the rectangle to the given y coordinate.
The QRegion class specifies a clip region for a painter.
The QResizeEvent class contains event parameters for resize events.
const QSize & oldSize() const
Returns the old size of the widget.
const QSize & size() const
Returns the new size of the widget.
bool remove(const T &value)
const_iterator constBegin() const noexcept
iterator erase(const_iterator i)
iterator insert(const T &value)
QPointF position() const
Returns the position of the point in this event, relative to the widget or item that received the eve...
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
constexpr int & rheight() noexcept
Returns a reference to the height.
constexpr int & rwidth() noexcept
Returns a reference to the width.
constexpr bool isNull() const noexcept
Returns true if both the width and height is 0; otherwise returns false.
constexpr void setHeight(int h) noexcept
Sets the height to the given height.
constexpr bool isValid() const noexcept
Returns true if both the width and height is equal to or greater than 0; otherwise returns false.
The QStyleOption class stores the parameters used by QStyle functions.
void initFrom(const QWidget *w)
The QStylePainter class is a convenience class for drawing QStyle elements inside a widget.
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI.
@ SH_ScrollView_FrameOnlyAroundContents
@ PM_ScrollView_ScrollBarOverlap
int timerId() const
Returns the unique timer identifier, which is the same identifier as returned from QObject::startTime...
EGLImageKHR int int EGLuint64KHR * modifiers
list append(new Employee("Blackpool", "Stephen"))
QSet< QString >::iterator it
Combined button and popup list for selecting options.
constexpr const T & min(const T &a, const T &b)
QList< QModelIndex > QModelIndexList
QList< QItemViewPaintPair > QItemViewPaintPairs
static const QCssKnownValue positions[NumKnownPositionModes - 1]
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
static int area(const QSize &s)
QT_BEGIN_NAMESPACE bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qBound(const T &min, const T &val, const T &max)
constexpr const T & qMax(const T &a, const T &b)
constexpr T qAbs(const T &t)
static bool contains(const QJsonArray &haystack, unsigned needle)
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint GLenum GLsizei length
GLdouble GLdouble GLdouble GLdouble top
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLsizei GLsizei GLfloat distance
GLenum GLuint GLintptr offset
GLfloat GLfloat GLfloat GLfloat h
GLenum GLenum GLsizei void GLsizei void * column
GLdouble GLdouble GLdouble GLdouble q
GLenum GLenum GLsizei void * row
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
static int segmentCount(const QPainterPath &path, qreal pathLength)
static QT_BEGIN_NAMESPACE QAsn1Element wrap(quint8 type, const QAsn1Element &child)
static QT_BEGIN_NAMESPACE QVariant hint(QPlatformIntegration::StyleHint h)
QT_BEGIN_NAMESPACE constexpr void qSwap(T &value1, T &value2) noexcept(std::is_nothrow_swappable_v< T >)
static QFixed flowPosition(const QTextFrame::iterator &it)
if(qFloatDistance(a, b)<(1<< 7))
[0]
view viewport() -> scroll(dx, dy, deviceRect)
QItemSelection * selection
[0]
app setAttribute(Qt::AA_DontShowIconsInMenus)
bool contains(const AT &t) const noexcept