44 #ifndef QT_NO_LISTVIEW 54 #include <private/qlistview_p.h> 56 #ifndef QT_NO_ACCESSIBILITY 192 d->updateStyledFrameWidths();
205 d->updateStyledFrameWidths();
242 #ifndef QT_NO_DRAGANDDROP 243 bool movable = (movement !=
Static);
245 d->viewport->setAcceptDrops(movable);
247 d->doDelayedItemsLayout();
281 d->doDelayedItemsLayout();
312 d->setWrapping(enable);
313 d->doDelayedItemsLayout();
319 return d->isWrapping();
341 d->resizeMode = mode;
347 return d->resizeMode;
369 d->layoutMode = mode;
375 return d->layoutMode;
401 d->setSpacing(space);
402 d->doDelayedItemsLayout();
427 if (batchSize <= 0) {
428 qWarning(
"Invalid batchSize (%d)", batchSize);
462 d->setGridSize(size);
463 d->doDelayedItemsLayout();
469 return d->gridSize();
493 if (
d->commonListView &&
d->viewMode == mode)
497 delete d->commonListView;
501 d->setWrapping(
false);
513 d->showElasticBand =
false;
517 d->setWrapping(
true);
529 d->showElasticBand =
true;
532 #ifndef QT_NO_DRAGANDDROP 533 bool movable = (
d->movement !=
Static);
538 d->doDelayedItemsLayout();
557 d->modeProperties = 0;
566 return d->isHidden(row);
576 const bool hidden =
d->isHidden(row);
578 d->commonListView->appendHiddenRow(row);
579 else if (!hide && hidden)
580 d->commonListView->removeHiddenRow(row);
581 d->doDelayedItemsLayout();
582 d->viewport->update();
605 if (hint ==
EnsureVisible &&
d->viewport->rect().contains(rect)) {
606 d->viewport->update(rect);
622 const bool leftOf = q->isRightToLeft()
625 const bool rightOf = q->isRightToLeft()
628 return commonListView->horizontalScrollToValue(q->visualIndex(index), hint, leftOf, rightOf,
area,
rect);
638 return commonListView->verticalScrollToValue(q->visualIndex(index), hint, above, below,
area,
rect);
689 for (
int i = 0; i < indexes.
count(); ++i) {
691 if (visibleIndexes.
contains(index)) {
692 const QRect current = q->visualRect(index);
697 rect &= viewportRect;
708 d->hiddenRows.clear();
718 d->column =
qBound(0,
d->column,
d->model->columnCount(index) - 1);
722 d->hiddenRows.clear();
737 d->delayedAutoScroll.stop();
753 d->setContentsSize(width, height);
762 return d->contentsSize();
770 d_func()->commonListView->dataChanged(topLeft, bottomRight);
782 d->doDelayedItemsLayout();
794 if (parent ==
d->root) {
796 while (it !=
d->hiddenRows.end()) {
797 int hiddenRow = it->row();
798 if (hiddenRow >= start && hiddenRow <= end) {
799 it =
d->hiddenRows.erase(it);
806 d->doDelayedItemsLayout();
819 &&
d->showElasticBand
824 d->viewport->update(
d->mapToViewport(rect.united(
d->elasticBand)));
825 d->elasticBand =
rect;
837 if (
d->showElasticBand &&
d->elasticBand.isValid()) {
838 d->viewport->update(
d->mapToViewport(
d->elasticBand));
849 if (e->
timerId() ==
d->batchLayoutTimer.timerId()) {
850 if (
d->doItemsLayout(
d->batchSize)) {
851 d->batchLayoutTimer.stop();
853 d->viewport->update();
865 if (
d->delayedPendingLayout)
873 bool listWrap = (
d->viewMode ==
ListMode) &&
d->wrapItemText;
882 d->doDelayedItemsLayout(100);
888 #ifndef QT_NO_DRAGANDDROP 896 if (!
d->commonListView->filterDragMoveEvent(e)) {
898 static_cast<QListModeViewBase *>(
d->commonListView)->dragMoveEvent(e);
910 if (!d_func()->commonListView->filterDragLeaveEvent(e))
919 if (!d_func()->commonListView->filterDropEvent(e))
928 if (!d_func()->commonListView->filterStartDrag(supportedActions))
962 #endif // QT_NO_DRAGANDDROP 971 if (!
d->iconSize.isValid()) {
985 if (
d->gridSize().isValid()) {
999 if (!
d->itemDelegate)
1011 const bool alternate =
d->alternatingColors;
1016 bool alternateBase =
false;
1017 int previousRow = -2;
1046 if (focus && current == *
it) {
1057 int row = (*it).row();
1058 if (row != previousRow + 1) {
1060 if (!
d->hiddenRows.isEmpty()) {
1061 for (
int r =
qMax(previousRow + 1, 0); r < row; ++r) {
1062 if (!
d->isHidden(r))
1063 alternateBase = !alternateBase;
1066 alternateBase = (row & 1) != 0;
1069 if (alternateBase) {
1080 option.
state = oldState;
1082 alternateBase = !alternateBase;
1086 d->delegateForIndex(*it)->paint(&painter, option, *
it);
1089 #ifndef QT_NO_DRAGANDDROP 1090 d->commonListView->paintDragDrop(&painter);
1093 #ifndef QT_NO_RUBBERBAND 1095 if (
d->showElasticBand &&
d->elasticBand.isValid()) {
1100 opt.
rect =
d->mapToViewport(
d->elasticBand,
false).intersected(
1101 d->viewport->rect().adjusted(-16, -16, 16, 16));
1129 return d_func()->commonListView->horizontalOffset();
1137 return d_func()->commonListView->verticalOffset();
1150 int rowCount =
d->model->rowCount(
d->root);
1154 while (row < rowCount && d->isHiddenOrDisabled(row))
1156 if (row >= rowCount)
1158 return d->model->index(row,
d->column,
d->root);
1164 return d->model->index(0,
d->column,
d->root);
1166 if (
d->gridSize().isValid()) rect.
setSize(
d->gridSize());
1168 QSize contents =
d->contentsSize();
1171 switch (cursorAction) {
1173 while (intersectVector.
isEmpty()) {
1175 if (rect.
right() <= 0)
1177 if (rect.
left() < 0)
1179 intersectVector =
d->intersectingSet(rect);
1180 d->removeCurrentAndDisabled(&intersectVector, current);
1182 return d->closestIndex(initialRect, intersectVector);
1184 while (intersectVector.
isEmpty()) {
1190 intersectVector =
d->intersectingSet(rect);
1191 d->removeCurrentAndDisabled(&intersectVector, current);
1193 return d->closestIndex(initialRect, intersectVector);
1202 while (intersectVector.
isEmpty()) {
1204 if (rect.
bottom() <= 0) {
1205 #ifdef QT_KEYPAD_NAVIGATION 1206 if (QApplication::keypadNavigationEnabled()) {
1207 int row =
d->batchStartRow() - 1;
1208 while (row >= 0 &&
d->isHiddenOrDisabled(row))
1211 return d->model->index(row,
d->column,
d->root);
1218 intersectVector =
d->intersectingSet(rect);
1219 d->removeCurrentAndDisabled(&intersectVector, current);
1221 return d->closestIndex(initialRect, intersectVector);
1230 while (intersectVector.
isEmpty()) {
1233 #ifdef QT_KEYPAD_NAVIGATION 1234 if (QApplication::keypadNavigationEnabled()) {
1235 int rowCount =
d->model->rowCount(
d->root);
1237 while (row < rowCount && d->isHiddenOrDisabled(row))
1240 return d->model->index(row,
d->column,
d->root);
1247 intersectVector =
d->intersectingSet(rect);
1248 d->removeCurrentAndDisabled(&intersectVector, current);
1250 return d->closestIndex(initialRect, intersectVector);
1252 return d->model->index(0,
d->column,
d->root);
1254 return d->model->index(
d->batchStartRow() - 1,
d->column,
d->root);}
1267 return d_func()->rectForIndex(index);
1285 || !
d->isIndexValid(index)
1287 || index.
column() !=
d->column)
1290 d->executePostedLayout();
1291 d->commonListView->setPositionForIndex(position, index);
1300 if (!
d->selectionModel)
1304 int w =
qMax(
d->contentsSize().width(),
d->viewport->width());
1305 int h =
qMax(
d->contentsSize().height(),
d->viewport->height());
1314 if (!intersectVector.
isEmpty())
1315 tl = intersectVector.
last();
1316 if (tl.
isValid() &&
d->isIndexEnabled(tl))
1317 selection.
select(tl, tl);
1326 if (!intersectVector.isEmpty())
1327 tl = intersectVector.last();
1330 intersectVector =
d->intersectingSet(bottomRight);
1331 if (!intersectVector.isEmpty())
1332 br = intersectVector.last();
1336 &&
d->isIndexEnabled(tl)
1337 &&
d->isIndexEnabled(br)) {
1343 QRect &bottom = last;
1351 if (top.
top() != bottom.
top()) {
1362 }
else if (top.
left() > bottom.
right()) {
1410 }
else if (left.
bottom() < right.
top()) {
1429 d->selectionModel->select(selection, command);
1447 const QRect &viewportRect =
d->viewport->rect();
1448 for (
int i = 0; i < selection.
count(); ++i) {
1454 if (parent !=
d->root)
1458 if (
d->viewMode ==
IconMode ||
d->isWrapping()) {
1459 for (
int r = t; r <= b; ++r) {
1462 selectionRegion += rect;
1465 while (t <= b && d->
isHidden(t)) ++t;
1466 while (b >= t &&
d->isHidden(b)) --b;
1468 const QModelIndex bottom =
d->model->index(b, c, parent);
1472 selectionRegion += rect;
1476 return selectionRegion;
1485 if (!
d->selectionModel)
1489 for (
int i = 0; i < viewSelected.
count(); ++i) {
1496 return viewSelected;
1515 if (
d->model->columnCount(
d->root) > 0) {
1516 d->resetBatchStartRow();
1518 d->doItemsLayout(
d->model->rowCount(
d->root));
1519 else if (!
d->batchLayoutTimer.isActive()) {
1520 if (!
d->doItemsLayout(
d->batchSize))
1521 d->batchLayoutTimer.start(0,
this);
1534 if (
geometry().
isEmpty() ||
d->model->rowCount(
d->root) <= 0 ||
d->model->columnCount(
d->root) <= 0) {
1540 QSize step =
d->itemSize(option, index);
1541 d->commonListView->updateHorizontalScrollBar(step);
1542 d->commonListView->updateVerticalScrollBar(step);
1548 if (
d->movement ==
Static && !
d->isWrapping()) {
1549 d->layoutChildren();
1571 return (
d->isHidden(index.
row())
1572 && (index.
parent() ==
d->root)
1573 && index.
column() ==
d->column);
1589 if (column < 0 || column >=
d->model->columnCount(
d->root))
1592 d->doDelayedItemsLayout();
1618 d->uniformItemSizes = enable;
1624 return d->uniformItemSizes;
1647 if (
d->wrapItemText == on)
1649 d->wrapItemText = on;
1650 d->doDelayedItemsLayout();
1656 return d->wrapItemText;
1681 d->setSelectionRectVisible(show);
1687 return d->isSelectionRectVisible();
1716 showElasticBand(false)
1740 int frameAroundContents = 0;
1767 int last =
qMin(first + delta - 1, max);
1774 if (max < 0 || last < first) {
1806 int dx = -q->horizontalOffset();
1807 int dy = -q->verticalOffset();
1808 return result.
adjusted(dx, dy, dx, dy);
1819 for (; it != candidates.
end(); ++
it) {
1820 if (!(*it).isValid())
1837 distance = (indexRect.
center() - target.
center()).manhattanLength();
1839 if (distance < shortest) {
1851 return delegate ? delegate->
sizeHint(option, index) :
QSize();
1868 for (; it != intersectVector.
end(); ++
it) {
1871 }
else if ((*it).row() == (tl.
row() - 1)) {
1873 }
else if ((*it).row() == (br.
row() + 1)) {
1876 selection.
select(tl, br);
1882 selection.
select(tl, br);
1884 selection.
select(tl, tl);
1886 selection.
select(br, br);
1891 #ifndef QT_NO_DRAGANDDROP 1915 dd->hiddenRows.insert(dd->model->index(row, 0, qq->rootIndex()));
1920 dd->hiddenRows.remove(dd->model->index(row, 0, qq->rootIndex()));
1923 #ifndef QT_NO_DRAGANDDROP 1928 dd->paintDropIndicator(painter);
1934 horizontalScrollBar()->setSingleStep(step.
width() +
spacing());
1935 horizontalScrollBar()->setPageStep(
viewport()->width());
1941 verticalScrollBar()->setSingleStep(step.
height() +
spacing());
1942 verticalScrollBar()->setPageStep(
viewport()->height());
1948 dd->scrollContentsBy(isRightToLeft() ? -dx : dx, dy);
1952 bool above,
bool below,
const QRect &
area,
const QRect &rect)
const 1954 int verticalValue = verticalScrollBar()->value();
1957 verticalValue += adjusted.
top();
1961 verticalValue += adjusted.
top() - ((area.
height() - adjusted.
height()) / 2);
1962 return verticalValue;
1967 return (isRightToLeft() ? horizontalScrollBar()->maximum() - horizontalScrollBar()->value() : horizontalScrollBar()->value());
1971 bool leftOf,
bool rightOf,
const QRect &
area,
const QRect &rect)
const 1973 int horizontalValue = horizontalScrollBar()->value();
1974 if (isRightToLeft()) {
1976 horizontalValue += ((area.
width() - rect.
width()) / 2) - rect.
left();
1979 horizontalValue -= rect.
left();
1985 horizontalValue += rect.
left() - ((area.
width()- rect.
width()) / 2);
1988 horizontalValue += rect.
left();
1993 return horizontalValue;
2000 #ifndef QT_NO_DRAGANDDROP 2004 if (!dd->overwrite) {
2005 const int margin = 2;
2006 if (pos.
x() - rect.
left() < margin) {
2008 }
else if (rect.
right() - pos.
x() < margin) {
2010 }
else if (rect.
contains(pos,
true)) {
2014 QRect touchingRect = rect;
2015 touchingRect.
adjust(-1, -1, 1, 1);
2016 if (touchingRect.
contains(pos,
false)) {
2030 && (
event->source() != qq || !(
event->possibleActions() &
Qt::MoveAction)))
2038 QRect rect(p.
x() + horizontalOffset(), p.
y() + verticalOffset(), 1, 1);
2039 rect.
adjust(-dd->spacing(), -dd->spacing(), dd->spacing(), dd->spacing());
2044 if (!dd->droppingOnItself(event, index)
2045 && dd->canDecode(event)) {
2047 if (index.
isValid() && dd->showDropIndicator) {
2048 QRect rect = qq->visualRect(index);
2051 switch (dd->dropIndicatorPosition) {
2053 if (dd->isIndexDropEnabled(index.
parent())) {
2054 dd->dropIndicatorRect =
QRect(rect.
left()-dd->spacing(), rect.
top(), 0, rect.
height());
2057 dd->dropIndicatorRect =
QRect();
2061 if (dd->isIndexDropEnabled(index.
parent())) {
2065 dd->dropIndicatorRect =
QRect();
2069 if (dd->isIndexDropEnabled(index)) {
2070 dd->dropIndicatorRect = rect;
2073 dd->dropIndicatorRect =
QRect();
2077 dd->dropIndicatorRect =
QRect();
2078 if (dd->isIndexDropEnabled(qq->rootIndex())) {
2084 dd->dropIndicatorRect =
QRect();
2086 if (dd->isIndexDropEnabled(qq->rootIndex())) {
2090 dd->viewport->update();
2093 if (dd->shouldAutoScroll(event->
pos()))
2094 qq->startAutoScroll();
2114 if (dd->viewport->rect().contains(event->
pos())) {
2117 QRect rect(p.
x() + horizontalOffset(), p.
y() + verticalOffset(), 1, 1);
2118 rect.
adjust(-dd->spacing(), -dd->spacing(), dd->spacing(), dd->spacing());
2120 index = intersectVector.
count() > 0
2127 if (dd->model->supportedDropActions() &
event->dropAction()) {
2130 if (index != dd->root) {
2131 dd->dropIndicatorPosition =
position(event->
pos(), qq->visualRect(index),
index);
2132 switch (dd->dropIndicatorPosition) {
2139 row = index.
row() + 1;
2153 if (!dd->droppingOnItself(event, index))
2159 #endif //QT_NO_DRAGANDDROP 2169 verticalScrollBar()->setSingleStep(1);
2170 verticalScrollBar()->setPageStep(pageSteps);
2171 verticalScrollBar()->setRange(0, steps - pageSteps);
2173 verticalScrollBar()->setRange(0, 0);
2190 horizontalScrollBar()->setSingleStep(1);
2191 horizontalScrollBar()->setPageStep(pageSteps);
2192 horizontalScrollBar()->setRange(0, steps - pageSteps);
2194 horizontalScrollBar()->setRange(0, 0);
2202 bool above,
bool below,
const QRect &
area,
const QRect &rect)
const 2206 if (scrollValueMap.isEmpty()) {
2209 int scrollBarValue = verticalScrollBar()->value();
2211 for (
int i = 0; i < flowPositions.count() - 1 && i <= scrollBarValue; ++i)
2214 value =
qBound(0, scrollValueMap.at(verticalScrollBar()->value()) - numHidden, flowPositions.count() - 1);
2234 const int max = segmentPositions.count() - 1;
2235 int currentValue =
qBound(0, horizontalScrollBar()->value(), max);
2236 int position = segmentPositions.at(currentValue);
2237 int maximumValue =
qBound(0, horizontalScrollBar()->maximum(), max);
2238 int maximum = segmentPositions.at(maximumValue);
2239 return (isRightToLeft() ? maximum - position : position);
2242 int position = flowPositions.at(scrollValueMap.at(horizontalScrollBar()->value()));
2243 int maximum = flowPositions.at(scrollValueMap.at(horizontalScrollBar()->maximum()));
2255 int value = verticalScrollBar()->value();
2256 if (value >= segmentPositions.count())
2258 return segmentPositions.at(value) -
spacing();
2261 int value = verticalScrollBar()->value();
2262 if (value > scrollValueMap.count())
2264 return flowPositions.at(scrollValueMap.at(value)) -
spacing();
2271 bool leftOf,
bool rightOf,
const QRect &
area,
const QRect &rect)
const 2277 if (scrollValueMap.isEmpty())
2280 value =
qBound(0, scrollValueMap.at(horizontalScrollBar()->value()), flowPositions.count() - 1);
2294 const int verticalValue = verticalScrollBar()->value();
2295 const int horizontalValue = horizontalScrollBar()->value();
2300 if (segmentPositions.isEmpty())
2302 const int max = segmentPositions.count() - 1;
2304 int currentValue =
qBound(0, horizontalValue, max);
2305 int previousValue =
qBound(0, currentValue + dx, max);
2306 int currentCoordinate = segmentPositions.at(currentValue) -
spacing();
2307 int previousCoordinate = segmentPositions.at(previousValue) -
spacing();
2308 dx = previousCoordinate - currentCoordinate;
2310 int currentValue =
qBound(0, verticalValue, max);
2311 int previousValue =
qBound(0, currentValue + dy, max);
2312 int currentCoordinate = segmentPositions.at(currentValue) -
spacing();
2313 int previousCoordinate = segmentPositions.at(previousValue) -
spacing();
2314 dy = previousCoordinate - currentCoordinate;
2317 if (flowPositions.isEmpty())
2319 const int max = scrollValueMap.count() - 1;
2321 int currentValue =
qBound(0, verticalValue, max);
2322 int previousValue =
qBound(0, currentValue + dy, max);
2323 int currentCoordinate = flowPositions.at(scrollValueMap.at(currentValue));
2324 int previousCoordinate = flowPositions.at(scrollValueMap.at(previousValue));
2325 dy = previousCoordinate - currentCoordinate;
2327 int currentValue =
qBound(0, horizontalValue, max);
2328 int previousValue =
qBound(0, currentValue + dx, max);
2329 int currentCoordinate = flowPositions.at(scrollValueMap.at(currentValue));
2330 int previousCoordinate = flowPositions.at(scrollValueMap.at(previousValue));
2331 dx = previousCoordinate - currentCoordinate;
2339 doStaticLayout(info);
2341 flowPositions.resize(flowPositions.count());
2342 segmentPositions.resize(segmentPositions.count());
2343 segmentStartRows.resize(segmentStartRows.count());
2351 if (flowPositions.isEmpty()
2352 || segmentPositions.isEmpty()
2353 || index.
row() >= flowPositions.count())
2356 const int segment = qBinarySearch<int>(segmentStartRows, index.
row(),
2357 0, segmentStartRows.count() - 1);
2367 pos.
setX(flowPositions.at(index.
row()));
2368 pos.
setY(segmentPositions.at(segment));
2370 pos.
setY(flowPositions.at(index.
row()));
2371 pos.
setX(segmentPositions.at(segment));
2373 int right = (segment + 1 >= segmentPositions.count()
2375 : segmentPositions.at(segment + 1));
2388 if (info.
first == 0) {
2389 flowPositions.clear();
2390 segmentPositions.clear();
2391 segmentStartRows.clear();
2392 segmentExtents.clear();
2393 scrollValueMap.clear();
2397 segmentStartRows.append(0);
2398 }
else if (info.
wrap) {
2400 x = batchSavedPosition;
2401 y = segmentPositions.last();
2403 x = segmentPositions.last();
2404 y = batchSavedPosition;
2408 x = batchSavedPosition;
2412 y = batchSavedPosition;
2424 const QPoint topLeft = initStaticLayout(info);
2435 int segStartPosition;
2437 int deltaFlowPosition;
2438 int deltaSegPosition;
2446 flowPosition = topLeft.
x();
2447 segPosition = topLeft.
y();
2449 deltaSegPosition = useItemSize ? batchSavedDeltaSeg : info.
grid.
height();
2454 flowPosition = topLeft.
y();
2455 segPosition = topLeft.
x();
2457 deltaSegPosition = useItemSize ? batchSavedDeltaSeg : info.
grid.
width();
2461 for (
int row = info.
first; row <= info.
last; ++row) {
2463 flowPositions.append(flowPosition);
2477 if (info.
wrap && (flowPosition + deltaFlowPosition >= segEndPosition)) {
2478 segmentExtents.append(flowPosition);
2479 flowPosition = info.
spacing + segStartPosition;
2480 segPosition += deltaSegPosition;
2483 segmentPositions.append(segPosition);
2484 segmentStartRows.append(row);
2485 deltaSegPosition = 0;
2488 scrollValueMap.append(flowPositions.count());
2489 flowPositions.append(flowPosition);
2491 deltaSegPosition =
qMax(deltaSegHint, deltaSegPosition);
2492 flowPosition += info.
spacing + deltaFlowPosition;
2497 batchSavedDeltaSeg = deltaSegPosition;
2505 rect.
setBottom(segPosition + deltaSegPosition);
2507 rect.
setRight(segPosition + deltaSegPosition);
2513 segmentExtents.append(flowPosition);
2514 scrollValueMap.append(flowPositions.count());
2515 flowPositions.append(flowPosition);
2516 segmentPositions.append(info.
wrap ? segPosition + deltaSegPosition :
INT_MAX);
2535 int segStartPosition;
2537 int flowStartPosition;
2538 int flowEndPosition;
2540 segStartPosition = area.
top();
2541 segEndPosition = area.
bottom();
2542 flowStartPosition = area.
left();
2543 flowEndPosition = area.
right();
2545 segStartPosition = area.
left();
2546 segEndPosition = area.
right();
2547 flowStartPosition = area.
top();
2548 flowEndPosition = area.
bottom();
2550 if (segmentPositions.count() < 2 || flowPositions.isEmpty())
2553 const int segLast = segmentPositions.
count() - 2;
2554 int seg = qBinarySearch<int>(segmentPositions, segStartPosition, 0, segLast + 1);
2555 for (; seg <= segLast && segmentPositions.at(seg) <= segEndPosition; ++seg) {
2556 int first = segmentStartRows.at(seg);
2557 int last = (seg < segLast ? segmentStartRows.at(seg + 1) :
batchStartRow) - 1;
2558 if (segmentExtents.at(seg) < flowStartPosition)
2560 int row = qBinarySearch<int>(flowPositions, flowStartPosition, first, last);
2561 for (; row <= last && flowPositions.at(row) <= flowEndPosition; ++row) {
2567 #if 0 // for debugging 2569 qWarning(
"intersectingSet: row %d was invalid", row);
2578 dd->doDelayedItemsLayout();
2588 QRect result = rect;
2603 positions = segmentPositions;
2604 else if (!flowPositions.isEmpty()) {
2605 positions.
reserve(scrollValueMap.size());
2606 foreach (
int itemShown, scrollValueMap)
2607 positions.
append(flowPositions.at(itemShown));
2609 if (positions.
isEmpty() || bounds <= length)
2610 return positions.
count();
2612 for (
int i = 1; i < positions.
count(); ++i)
2613 if (positions.
at(i) > 0)
2614 return length / positions.
at(i);
2618 int steps = positions.
count() - 1;
2619 int max =
qMax(length, bounds);
2620 int min =
qMin(length, bounds);
2621 int pos = min - (max - positions.
last());
2623 while (pos >= 0 && steps > 0) {
2624 pos -= (positions.
at(steps) - positions.
at(steps - 1));
2631 return qMax(pageSteps, 1);
2642 visibleFlowPositions.
reserve(flowPositions.count() - 1);
2643 for (
int i = 0; i < flowPositions.count() - 1; i++) {
2645 visibleFlowPositions.
append(flowPositions.at(i));
2649 int topIndex =
index;
2650 const int bottomIndex = topIndex;
2651 const int bottomCoordinate = visibleFlowPositions.
at(index);
2653 while (topIndex > 0 &&
2654 (bottomCoordinate - visibleFlowPositions.
at(topIndex - 1) + itemExtent) <= (viewportSize)) {
2658 const int itemCount = bottomIndex - topIndex + 1;
2663 return index - itemCount + 1;
2665 return index - (itemCount / 2);
2672 if (flowOrientation == orientation) {
2674 return visibleFlowPositions.
at(index);
2675 }
else if (!segmentStartRows.isEmpty()) {
2676 int segment = qBinarySearch<int>(segmentStartRows,
index, 0, segmentStartRows.count() - 1);
2677 int leftSegment = segment;
2678 const int rightSegment = leftSegment;
2679 const int bottomCoordinate = segmentPositions.at(segment);
2681 while (leftSegment > scrollValue &&
2682 (bottomCoordinate - segmentPositions.at(leftSegment-1) + itemExtent) <= (viewportSize)) {
2686 const int segmentCount = rightSegment - leftSegment + 1;
2691 return segment - segmentCount + 1;
2693 return segment - (segmentCount / 2);
2704 flowPositions.clear();
2705 segmentPositions.clear();
2706 segmentStartRows.clear();
2707 segmentExtents.clear();
2708 batchSavedPosition = 0;
2710 batchSavedDeltaSeg = 0;
2719 if (index.
row() >= items.count())
2727 dd->viewUpdateGeometries();
2732 if (row >= 0 && row < items.count())
2733 tree.removeLeaf(items.at(row).rect(), row);
2740 if (row >= 0 && row < items.count())
2741 tree.insertLeaf(items.at(row).rect(), row);
2744 #ifndef QT_NO_DRAGANDDROP 2751 if (indexes.
count() > 0 ) {
2756 && (*it).column() == dd->column)
2757 draggedItems.push_back(*it);
2761 QPixmap pixmap = dd->renderToPixmap(indexes, &rect);
2762 rect.
adjust(horizontalOffset(), verticalOffset(), 0, 0);
2769 draggedItems.clear();
2771 dd->clearOrRemove();
2784 if (qq->acceptDrops()) {
2788 if ((index.
flags() & dropableFlags) == dropableFlags)
2791 QPoint start = dd->pressedPosition;
2792 QPoint delta = (dd->movement ==
QListView::Snap ? snapToGrid(end) - snapToGrid(start) : end - start);
2794 for (
int i = 0; i < indexes.
count(); ++i) {
2796 QRect rect = dd->rectForIndex(index);
2799 if (qq->isRightToLeft())
2800 dest.
setX(dd->flipX(dest.
x()) - rect.
width());
2801 moveItem(index.
row(), dest);
2804 dd->stopAutoScroll();
2805 draggedItems.clear();
2806 dd->emitIndexesMoved(indexes);
2812 updateContentsSize();
2814 dd->viewUpdateGeometries();
2822 draggedItemsPos =
QPoint(-1, -1);
2828 if (e->
source() != qq || !dd->canDecode(e))
2834 QRect itemsRect = this->itemsRect(draggedItems);
2837 draggedItemsPos = e->
pos();
2845 index = intersectVector.count() > 0 ? intersectVector.last() :
QModelIndex();
2847 index = qq->indexAt(e->
pos());
2850 if (draggedItems.contains(index))
2858 if (dd->shouldAutoScroll(e->
pos()))
2859 dd->startAutoScroll();
2862 #endif // QT_NO_DRAGANDDROP 2866 tree.create(
qMax(rowCount - hiddenCount(), 0));
2871 if (scrollElasticBand)
2872 dd->scrollElasticBandBy(isRightToLeft() ? -dx : dx, dy);
2875 if (!draggedItems.isEmpty())
2884 for (
int row = topLeft.
row(); row <
bottom; ++row)
2891 if (info.
last >= items.count()) {
2894 for (
int row = items.count(); row <= info.
last; ++row) {
2899 doDynamicLayout(info);
2906 if (index.
isValid() && index.
row() < items.count())
2907 return items.at(index.
row());
2914 int leafCount = tree.leafCount();
2915 for (
int l = 0;
l < leafCount; ++
l)
2916 tree.leaf(
l).clear();
2922 else if (contents.
width() / contents.
height() >= 3)
2931 if (info.
first == 0) {
2934 items.reserve(rowCount() - hiddenCount());
2936 int idx = info.
first - 1;
2937 while (idx > 0 && !items.at(idx).isValid())
2956 const QPoint topLeft = initDynamicLayout(info);
2958 int segStartPosition;
2960 int deltaFlowPosition;
2961 int deltaSegPosition;
2970 deltaSegPosition = (useItemSize ? batchSavedDeltaSeg : info.
grid.
height());
2972 flowPosition = topLeft.
x();
2973 segPosition = topLeft.
y();
2978 deltaSegPosition = (useItemSize ? batchSavedDeltaSeg : info.
grid.
width());
2980 flowPosition = topLeft.
y();
2981 segPosition = topLeft.
x();
2984 if (moved.count() != items.count())
2985 moved.resize(items.count());
2989 for (
int row = info.
first; row <= info.
last; ++row) {
2997 deltaFlowPosition = item->
w + info.
spacing;
2999 deltaFlowPosition = item->
h + info.
spacing;
3007 && flowPosition + deltaFlowPosition > segEndPosition
3008 && flowPosition > segStartPosition) {
3009 flowPosition = segStartPosition;
3010 segPosition += deltaSegPosition;
3012 deltaSegPosition = 0;
3018 deltaSegHint = item->
h + info.
spacing;
3020 deltaSegHint = item->
w + info.
spacing;
3021 deltaSegPosition =
qMax(deltaSegPosition, deltaSegHint);
3027 if (!moved.testBit(row)) {
3031 item->
y = segPosition;
3033 item->
x = flowPosition + ((deltaFlowPosition - item->
w) / 2);
3034 item->
y = segPosition;
3039 item->
x = segPosition;
3041 item->
y = flowPosition + ((deltaFlowPosition - item->
h) / 2);
3042 item->
x = segPosition;
3049 rect |= item->
rect();
3051 rect |=
QRect(flowPosition, segPosition, deltaFlowPosition, deltaSegPosition);
3053 rect |=
QRect(segPosition, flowPosition, deltaSegPosition, deltaFlowPosition);
3056 flowPosition += deltaFlowPosition;
3059 batchSavedDeltaSeg = deltaSegPosition;
3061 bool done = (info.
last >= rowCount() - 1);
3073 int insertFrom = info.
first;
3074 if (done || info.
first == 0) {
3075 initBspTree(rect.
size());
3079 for (
int row = insertFrom; row <= info.
last; ++row)
3080 tree.insertLeaf(items.at(row).rect(), row);
3102 QRect rect(item.
x, item.
y, item.
w, item.
h);
3103 for (; it != indexes.
end(); ++
it) {
3115 if (i < items.count()) {
3116 if (items.at(i) == item)
3119 i = items.count() - 1;
3123 int c = items.count();
3129 if (items.at(i) == item) {
3130 items.at(i).indexHint = i;
3136 if (items.at(j) == item) {
3137 items.at(j).indexHint = j;
3151 for (
int i = 0; i < leaf.
count(); ++i) {
3152 int idx = leaf.
at(i);
3155 vi = &_this->
items[idx];
3173 tree.removeLeaf(rect, index);
3175 tree.insertLeaf(
QRect(dest, rect.
size()), index);
3181 if (moved.count() != items.count())
3182 moved.resize(items.count());
3183 moved.setBit(index,
true);
3198 return snapToGrid(draggedItemsPos + snapdelta) - snapToGrid(
pressedPosition()) - snapdelta;
3205 QRect rect = itemsRect(draggedItems);
3228 batchSavedDeltaSeg = 0;
3234 for (
int i = 0; i < items.count(); ++i)
3235 bounding |= items.at(i).rect();
3244 #ifndef QT_NO_ACCESSIBILITY 3247 int entry = visualIndex(current) + 1;
3265 #ifndef QT_NO_ACCESSIBILITY 3270 int entry = visualIndex(sel) + 1;
3279 int entry = visualIndex(desel) + 1;
3294 d->executePostedLayout();
3296 int visualIndex =
d->commonListView->itemIndex(itm);
3297 for (
int row = 0; row <= index.
row() && visualIndex >= 0; row++) {
3298 if (
d->isHidden(row))
3306 #endif // QT_NO_LISTVIEW
void doStaticLayout(const QListViewLayoutInfo &info)
void prepareItemsLayout()
void dragMoveEvent(QDragMoveEvent *e)
QListView(QWidget *parent=0)
Creates a new QListView with the given parent to view a model.
The QPainter class performs low-level painting on widgets and other paint devices.
virtual bool doBatchedItemLayout(const QListViewLayoutInfo &info, int max)=0
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const =0
Returns the number of columns for the children of the given parent.
void setSpacing(int space)
int horizontalOffset() const
Reimplemented Function
virtual void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
This slot is called when rows are about to be removed.
void dragLeaveEvent(QDragLeaveEvent *e)
Reimplemented Function
bool filterDragLeaveEvent(QDragLeaveEvent *)
static void updateAccessibility(QObject *, int who, Event reason)
Notifies accessibility clients about a change in object's accessibility information.
void setMovement(Movement movement)
The QAbstractItemDelegate class is used to display and edit data items from a model.
void setSelectionMode(QAbstractItemView::SelectionMode mode)
The QItemSelectionModel class keeps track of a view's selected items.
QPoint snapToGrid(const QPoint &pos) const
QRect adjusted(int x1, int y1, int x2, int y2) const
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
void setHeight(int h)
Sets the height of the rectangle to the given height.
void merge(const QItemSelection &other, QItemSelectionModel::SelectionFlags command)
Merges the other selection with this QItemSelection using the command given.
void setBottom(int pos)
Sets the bottom edge of the rectangle to the given y coordinate.
static mach_timebase_info_data_t info
void setRowHidden(int row, bool hide)
If hide is true, the given row will be hidden; otherwise the row will be shown.
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
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.
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.
virtual int horizontalScrollToValue(int index, QListView::ScrollHint hint, bool leftOf, bool rightOf, const QRect &area, const QRect &rect) const
virtual QStyleOptionViewItem viewOptions() const
Returns a QStyleOptionViewItem structure populated with the view's palette, font, state...
QRect mapToViewport(const QRect &rect, bool extend=true) const
void moveLeft(int pos)
Moves the rectangle horizontally, leaving the rectangle's left edge at the given x coordinate...
QModelIndex bottomRight() const
Returns the index for the item located at the bottom-right corner of the selection range...
void scrollContentsBy(int dx, int dy, bool scrollElasticBand)
QVector< QModelIndex > intersectingSet(const QRect &area) const
void removeHiddenRow(int row)
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 void removeHiddenRow(int row)
void setBatchSize(int batchSize)
int count(const T &t) const
Returns the number of occurrences of value in the vector.
QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const
Reimplemented Function
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.
int itemIndex(const QListViewItem &item) const
QItemSelection selection(const QRect &rect) const
void timerEvent(QTimerEvent *e)
Reimplemented Function
QListViewItem indexToListViewItem(const QModelIndex &index) const
bool isValid() const
Returns true if the selection range is valid; otherwise returns false.
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 setRootIndex(const QModelIndex &index)
Sets the root item to the item at the given index.
bool filterDropEvent(QDropEvent *e)
void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command)
Reimplemented Function
bool isSelectionRectVisible() const
void scrollTo(const QModelIndex &index, ScrollHint hint=EnsureVisible)
Reimplemented Function
QListViewItem indexToListViewItem(const QModelIndex &index) const
QVector< QListViewItem > items
virtual int verticalScrollToValue(int index, QListView::ScrollHint hint, bool above, bool below, const QRect &area, const QRect &rect) const
int horizontalScrollToValue(int index, QListView::ScrollHint hint, bool leftOf, bool rightOf, const QRect &area, const QRect &rect) const
static void addLeaf(QVector< int > &leaf, const QRect &area, uint visited, QBspTree::Data data)
QRect itemsRect(const QVector< QModelIndex > &indexes) const
QSize contentsSize() const
static qreal position(QGraphicsObject *item, QDeclarativeAnchorLine::AnchorLine anchorLine)
void restore()
Restores the current painter state (pops a saved state off the stack).
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the vector...
QListView::ViewMode viewMode
The QStyleOptionViewItemV4 class is used to describe the parameters necessary for drawing a frame in ...
Position decorationPosition
the position of the decoration for the item
QRect normalized() const
Returns a normalized rectangle; i.e., a rectangle that has a non-negative width and height...
void setResizeMode(ResizeMode mode)
void startDrag(Qt::DropActions supportedActions)
Reimplemented Function
void moveRight(int pos)
Moves the rectangle horizontally, leaving the rectangle's right edge at the given x coordinate...
int verticalOffset() const
Reimplemented Function
The QItemSelectionRange class manages information about a range of selected items in a model...
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the list.
void updateContentsSize()
int left() const
Returns the x-coordinate of the rectangle's left edge.
void accept()
Calls QDropEvent::accept().
QRect translated(int dx, int dy) const
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis...
QModelIndex modelIndex(int row) const
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 QRect mapToViewport(const QRect &rect) const
void paintEvent(QPaintEvent *e)
Reimplemented Function
long ASN1_INTEGER_get ASN1_INTEGER * a
int count(const T &t) const
Returns the number of occurrences of value in the list.
int perItemScrollToValue(int index, int value, int height, QAbstractItemView::ScrollHint hint, Qt::Orientation orientation, bool wrap, int extent) const
bool filterStartDrag(Qt::DropActions)
void updateVerticalScrollBar(const QSize &step)
DropIndicatorPosition
This enum indicates the position of the drop indicator in relation to the index at the current mouse ...
QAbstractItemView::ScrollMode horizontalScrollMode
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.
bool filterDragMoveEvent(QDragMoveEvent *)
QModelIndex closestIndex(const QRect &target, const QVector< QModelIndex > &candidates) const
virtual void doItemsLayout()
This function is intended to lay out the items in the view.
bool isIndexHidden(const QModelIndex &index) const
Reimplemented Function
void initBspTree(const QSize &contents)
The QDragMoveEvent class provides an event which is sent while a drag and drop action is in progress...
int verticalScrollToValue(int index, QListView::ScrollHint hint, bool above, bool below, const QRect &area, const QRect &rect) const
Q_DECL_CONSTEXPR T qAbs(const T &t)
int horizontalOffset() const
void moveBottom(int pos)
Moves the rectangle vertically, leaving the rectangle's bottom edge at the given y coordinate...
bool doBatchedItemLayout(const QListViewLayoutInfo &info, int max)
QVector< QModelIndex > intersectingSet(const QRect &area, bool doLayout=true) const
void dragMoveEvent(QDragMoveEvent *event)
This function is called continuously with the given event during a drag and drop operation over the w...
QModelIndex parent() const
Returns the parent of the model index, or QModelIndex() if it has no parent.
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
void setUniformItemSizes(bool enable)
QModelIndex indexAt(const QPoint &p) const
Reimplemented Function
void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
Reimplemented Function
void setWordWrap(bool on)
void save()
Saves the current painter state (pushes the state onto a stack).
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
void setRange(int min, int max)
Sets the slider's minimum to min and its maximum to max.
QRect rectForIndex(const QModelIndex &index) const
Returns the rectangle of the item at position index in the model.
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.
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the vector...
virtual int horizontalOffset() const
The QStyleOptionViewItemV2 class is used to describe the parameters necessary for drawing a frame in ...
bool isHidden(int row) const
bool event(QEvent *e)
Reimplemented Function
void setWidth(int w)
Sets the width to the given width.
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
void currentChanged(const QModelIndex ¤t, const QModelIndex &previous)
Reimplemented Function
void dropEvent(QDropEvent *event)
This function is called with the given event when a drop event occurs over the widget.
QModelIndex topLeft() const
Returns the index for the item located at the top-left corner of the selection range.
virtual Qt::ItemFlags flags(const QModelIndex &index) const
Returns the item flags for the given index.
void scrollContentsBy(int dx, int dy, bool scrollElasticBand)
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const =0
Returns the index of the item in the model specified by the given row, column and parent index...
void setCurrentColorGroup(ColorGroup cg)
Set the palette's current color group to cg.
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the vector.
LayoutMode layoutMode() const
int width() const
Returns the width.
void mouseMoveEvent(QMouseEvent *e)
Reimplemented Function
void append(const T &t)
Inserts value at the end of the list.
#define QT_BEGIN_NAMESPACE
This macro expands to.
QAbstractItemView::DropIndicatorPosition position(const QPoint &pos, const QRect &rect, const QModelIndex &idx) const
virtual QAbstractItemView::DropIndicatorPosition position(const QPoint &pos, const QRect &rect, const QModelIndex &idx) const
ViewItemFeatures features
a bitwise OR of the features that describe this view item
void dragMoveEvent(QDragMoveEvent *e)
Reimplemented Function
static bool isEmpty(const char *str)
QRect viewItemRect(const QListViewItem &item) const
QPoint bottomRight() const
Returns the position of the rectangle's bottom-right corner.
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.
friend class QListModeViewBase
QAbstractItemView::ScrollMode verticalScrollMode
bool contains(const T &value) const
virtual bool filterDragLeaveEvent(QDragLeaveEvent *)
QList< T > toList() const
void dataChanged(const QModelIndex &, const QModelIndex &)
void setRootIndex(const QModelIndex &index)
QItemSelectionModel * selectionModel() const
Returns the current selection model.
static const QCssKnownValue positions[NumKnownPositionModes - 1]
QPoint draggedItemsDelta() const
bool isSelected(const QModelIndex &index) const
Returns true if the given model item index is selected.
void initFrom(const QWidget *w)
void resizeContents(int width, int height)
Resize the internal contents to width and height and set the scroll bar ranges accordingly.
void setTop(int pos)
Sets the top edge of the rectangle to the given y coordinate.
int row() const
Returns the row this model index refers to.
void move(const QPoint &position)
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.
void adjust(int x1, int y1, int x2, int y2)
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
int visualIndex(const QModelIndex &index) const
void setRight(int pos)
Sets the right edge of the rectangle to the given x coordinate.
QRect mapToViewport(const QRect &rect) const
void append(const T &t)
Inserts value at the end of the vector.
virtual void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const =0
Draws the given primitive element with the provided painter using the style options specified by opti...
The QResizeEvent class contains event parameters for resize events.
Q_CORE_EXPORT void qWarning(const char *,...)
void setSize(const QSize &s)
Sets the size of the rectangle to the given size.
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
QRect draggedItemsRect() const
void setPositionForIndex(const QPoint &position, const QModelIndex &index)
const QSize & oldSize() const
Returns the old size of the widget.
virtual void reset()
Reset the internal state of the view.
QModelIndex currentIndex() const
Returns the model index of the current item.
QSize itemSize(const QStyleOptionViewItem &option, const QModelIndex &index) const
bool doItemsLayout(int num)
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.
State
Describes the different states the view can be in.
void rowsInserted(const QModelIndex &parent, int start, int end)
Reimplemented Function
void clearPropertyFlags()
Clears the QListView-specific property flags.
void scrollElasticBandBy(int dx, int dy)
void climbTree(const QRect &rect, callback *function, QBspTreeData data)
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...
int verticalScrollToValue(const QModelIndex &index, const QRect &rect, QListView::ScrollHint hint) const
void setPositionForIndex(const QPoint &position, const QModelIndex &index)
Sets the contents position of the item at index in the model to the given position.
void setDragEnabled(bool enable)
bool opaque
whether the rubber band is required to be drawn in an opaque style
void doItemsLayout()
Layout the items according to the flow and wrapping properties.
The QStyleOptionRubberBand class is used to describe the parameters needed for drawing a rubber band...
void setModelColumn(int column)
bool isValid() const
Returns true if this model index is valid; otherwise returns false.
void internalDrop(QDropEvent *e)
Called whenever items from the view is dropped on the viewport.
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 selectAll(QItemSelectionModel::SelectionFlags command)
bool uniformItemSizes() const
QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers)
Reimplemented Function
void qSwap(T &value1, T &value2)
const T & at(int i) const
Returns the item at index position i in the vector.
virtual int verticalOffset() const
The QAbstractItemModel class provides the abstract interface for item model classes.
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
Reimplemented Function
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...
void setWrapping(bool enable)
virtual void setRowCount(int)=0
The QMouseEvent class contains parameters that describe a mouse event.
QPoint initDynamicLayout(const QListViewLayoutInfo &info)
QPersistentModelIndex root
virtual void appendHiddenRow(int row)
QListView::Movement movement
bool isEmpty() const
Returns true if the rectangle is empty, otherwise returns false.
QPalette palette
the palette that should be used when painting the control
QList< QModelIndex > QModelIndexList
QPoint center() const
Returns the center point of the rectangle.
void moveItem(int index, const QPoint &dest)
virtual void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
This slot is called when the selection is changed.
The QAbstractItemView class provides the basic functionality for item view classes.
QPoint initStaticLayout(const QListViewLayoutInfo &info)
void setY(int y)
Sets the y coordinate of this point to the given y coordinate.
int top() const
Returns the y-coordinate of the rectangle's top edge.
The QItemSelection class manages information about selected items in a model.
QRect visualRect(const QModelIndex &index) const
Reimplemented Function
The QDropEvent class provides an event which is sent when a drag and drop action is completed...
The QListView class provides a list or icon view onto a model.
int right() const
Returns the x-coordinate of the rectangle's right edge.
QVector< QModelIndex > intersectingSet(const QRect &area) const
Finds the set of items intersecting with area.
QCommonListViewBase * commonListView
QListViewItem indexToListViewItem(const QModelIndex &index) const
The QTimerEvent class contains parameters that describe a timer event.
void setViewMode(ViewMode mode)
iterator begin()
Returns an STL-style iterator pointing to the first item in the vector.
void setLeft(int pos)
Sets the left edge of the rectangle to the given x coordinate.
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
Reimplemented Function
bool dropOn(QDropEvent *event, int *row, int *col, QModelIndex *index)
If the event hasn't already been accepted, determines the index to drop on.
void appendHiddenRow(int row)
int y() const
Returns the y-coordinate of the rectangle's top edge.
The Flow item arranges its children side by side, wrapping as necessary.
void resizeEvent(QResizeEvent *event)
This function is called with the given event when a resize event is sent to the widget.
const QSize & size() const
Returns the new size of the widget.
virtual void select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)
Selects the model item index using the specified command, and emits selectionChanged().
Movement movement() const
QWidget * source() const
If the source of the drag operation is a widget in this application, this function returns that sourc...
~QListView()
Destroys the view.
int x() const
Returns the x-coordinate of the rectangle's left edge.
QObject * parent() const
Returns a pointer to the parent object.
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)
const_iterator ConstIterator
Qt-style synonym for QList::const_iterator.
The QPoint class defines a point in the plane using integer precision.
T & last()
Returns a reference to the last item in the vector.
Q_DECL_CONSTEXPR const T & qBound(const T &min, const T &val, const T &max)
The QModelIndex class is used to locate data in a data model.
virtual void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const =0
Draws the given element with the provided painter with the style options specified by option...
QSize decorationSize
the size of the decoration for the item
ResizeMode resizeMode() const
QAbstractItemDelegate * delegateForIndex(const QModelIndex &index) const
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI...
int & rheight()
Returns a reference to the height.
void setWidth(int w)
Sets the width of the rectangle to the given width.
int height() const
Returns the height.
if(void) toggleToolbarShown
The QRect class defines a rectangle in the plane using integer precision.
QVector< QModelIndex > * interSectingVector
QModelIndexList selectedIndexes() const
Reimplemented Function
bool isValid() const
Returns true if both the width and height is equal to or greater than 0; otherwise returns false...
QRubberBand::Shape shape
the shape of the rubber band
int verticalOffset() const
int batchStartRow() const
State state() const
Returns the item view's state.
int y() const
Returns the y coordinate of this point.
void mouseReleaseEvent(QMouseEvent *event)
This function is called with the given event when a mouse button is released, after a mouse press eve...
virtual void rowsInserted(const QModelIndex &parent, int start, int end)
This slot is called when rows are inserted.
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 void updateGeometries()
Updates the geometry of the child widgets of the view.
void scrollContentsBy(int dx, int dy)
Scroll the view contents by dx and dy.
static QFixed flowPosition(const QTextFrame::iterator it)
bool isNull() const
Returns true if both the width and height is 0; otherwise returns false.
int perItemScrollingPageSteps(int length, int bounds, bool wrap) const
void setRowCount(int rowCount)
virtual void updateVerticalScrollBar(const QSize &step)
void accept()
Sets the accept flag of the event object, the equivalent of calling setAccepted(true).
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...
bool isEmpty() const
Returns true if the vector has size 0; otherwise returns false.
void updateHorizontalScrollBar(const QSize &step)
bool intersects(const QRect &r) const
Returns true if this rectangle intersects with the given rectangle (i.
CursorAction
This enum describes the different ways to navigate between items,.
void reserve(int size)
Attempts to allocate memory for at least size elements.
int x() const
Returns the x coordinate of this point.
void setGridSize(const QSize &size)
QModelIndexList indexes() const
Returns a list of model indexes that correspond to the selected items.
The QStyleOptionViewItem class is used to describe the parameters used to draw an item in a view widg...
void setSelectionRectVisible(bool show)
bool dropOn(QDropEvent *event, int *row, int *col, QModelIndex *index)
If the event hasn't already been accepted, determines the index to drop on.
void moveTop(int pos)
Moves the rectangle vertically, leaving the rectangle's top edge at the given y coordinate.
bool isEmpty() const
Returns true if either of the width and height is less than or equal to 0; otherwise returns false...
void resizeEvent(QResizeEvent *e)
Reimplemented Function
const QRect & rect() const
Returns the rectangle that needs to be updated.
bool isValid() const
Returns true if the rectangle is valid, otherwise returns false.
The QPaintEvent class contains event parameters for paint events.
QAbstractItemModel * model() const
Returns the model that this view is presenting.
void translate(int dx, int dy)
Moves the rectangle dx along the x axis and dy along the y axis, relative to the current position...
static const KeyPair *const end
void dragLeaveEvent(QDragLeaveEvent *event)
This function is called when the item being dragged leaves the view.
QModelIndex listViewItemToIndex(const QListViewItem &item) const
bool event(QEvent *event)
Reimplemented Function
The QEvent class is the base class of all event classes.
Q_CORE_EXPORT QTextStream & left(QTextStream &s)
void setX(int x)
Sets the x coordinate of this point to the given x coordinate.
void doDynamicLayout(const QListViewLayoutInfo &info)
void updateGeometries()
Reimplemented Function
#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
QRegion visualRegionForSelection(const QItemSelection &selection) const
Since 4.
void setState(State state)
Sets the item view's state to the given state.
void mouseReleaseEvent(QMouseEvent *e)
Reimplemented Function
QRect rect
the area that should be used for various calculations and painting
ViewMode viewMode() const
QStyleOptionViewItem viewOptions() const
Reimplemented Function
void setLayoutMode(LayoutMode mode)
void ignore()
Calls QDropEvent::ignore().
void internalDrag(Qt::DropActions supportedActions)
Called whenever the user starts dragging items and the items are movable, enabling internal dragging ...
void paintDragDrop(QPainter *painter)
bool doBatchedItemLayout(const QListViewLayoutInfo &info, int max)
virtual QListViewItem indexToListViewItem(const QModelIndex &index) const =0
static bool isNull(const QVariant::Private *d)
const QPoint & pos() const
Returns the position where the drop was made.
int & rwidth()
Returns a reference to the width.
void dropEvent(QDropEvent *e)
Reimplemented Function
virtual void updateHorizontalScrollBar(const QSize &step)
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.
The QList class is a template class that provides lists.
static int area(const QSize &s)
int horizontalScrollToValue(const QModelIndex &index, const QRect &rect, QListView::ScrollHint hint) const
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list...
bool isRowHidden(int row) const
Returns true if the row is hidden; otherwise returns false.
QPoint topLeft() const
Returns the position of the rectangle's top-left corner.
virtual void scrollContentsBy(int dx, int dy, bool scrollElasticBand)
QSize contentsSize() const
void removeAt(int i)
Removes the item at index position i.