Widgets: use const (and const APIs) more
For CoW types, prefer const methods to avoid needless detach()ing. Change-Id: Ia6cad50a10facf6fd4f73d1390edb8642a0aed32 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>bb10
parent
f217894152
commit
b073ba57f8
|
|
@ -1082,7 +1082,7 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraphIteration(QGraphicsAnchorLayoutP
|
|||
if (candidates.isEmpty())
|
||||
after = (beforeSequence == adjacents.last() ? adjacents.first() : adjacents.last());
|
||||
else
|
||||
after = (candidates.last() == adjacents.last() ? adjacents.first() : adjacents.last());
|
||||
after = (candidates.constLast() == adjacents.last() ? adjacents.first() : adjacents.last());
|
||||
|
||||
// ### At this point we assumed that candidates will not contain 'after', this may not hold
|
||||
// when simplifying FLOATing anchors.
|
||||
|
|
@ -1134,9 +1134,9 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraphIteration(QGraphicsAnchorLayoutP
|
|||
|
||||
// One restriction we have is to not simplify half of an anchor and let the other half
|
||||
// unsimplified. So we remove center edges before and after the sequence.
|
||||
const AnchorData *firstAnchor = g.edgeData(beforeSequence, candidates.first());
|
||||
const AnchorData *firstAnchor = g.edgeData(beforeSequence, candidates.constFirst());
|
||||
if (firstAnchor->isCenterAnchor) {
|
||||
beforeSequence = candidates.first();
|
||||
beforeSequence = candidates.constFirst();
|
||||
candidates.remove(0);
|
||||
|
||||
// If there's not candidates to be simplified, leave.
|
||||
|
|
@ -1144,9 +1144,9 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraphIteration(QGraphicsAnchorLayoutP
|
|||
continue;
|
||||
}
|
||||
|
||||
const AnchorData *lastAnchor = g.edgeData(candidates.last(), afterSequence);
|
||||
const AnchorData *lastAnchor = g.edgeData(candidates.constLast(), afterSequence);
|
||||
if (lastAnchor->isCenterAnchor) {
|
||||
afterSequence = candidates.last();
|
||||
afterSequence = candidates.constLast();
|
||||
candidates.remove(candidates.count() - 1);
|
||||
|
||||
if (candidates.isEmpty())
|
||||
|
|
|
|||
|
|
@ -2152,7 +2152,7 @@ bool QGraphicsItem::isBlockedByModalPanel(QGraphicsItem **blockingPanel) const
|
|||
if (!blockingPanel)
|
||||
blockingPanel = &dummy;
|
||||
|
||||
QGraphicsScenePrivate *scene_d = d_ptr->scene->d_func();
|
||||
const QGraphicsScenePrivate *scene_d = d_ptr->scene->d_func();
|
||||
if (scene_d->modalPanels.isEmpty())
|
||||
return false;
|
||||
|
||||
|
|
|
|||
|
|
@ -940,7 +940,7 @@ void QGraphicsScenePrivate::grabMouse(QGraphicsItem *item, bool implicit)
|
|||
{
|
||||
// Append to list of mouse grabber items, and send a mouse grab event.
|
||||
if (mouseGrabberItems.contains(item)) {
|
||||
if (mouseGrabberItems.last() == item) {
|
||||
if (mouseGrabberItems.constLast() == item) {
|
||||
Q_ASSERT(!implicit);
|
||||
if (!lastMouseGrabberItemHasImplicitMouseGrab) {
|
||||
qWarning("QGraphicsItem::grabMouse: already a mouse grabber");
|
||||
|
|
@ -950,14 +950,14 @@ void QGraphicsScenePrivate::grabMouse(QGraphicsItem *item, bool implicit)
|
|||
}
|
||||
} else {
|
||||
qWarning("QGraphicsItem::grabMouse: already blocked by mouse grabber: %p",
|
||||
mouseGrabberItems.last());
|
||||
mouseGrabberItems.constLast());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Send ungrab event to the last grabber.
|
||||
if (!mouseGrabberItems.isEmpty()) {
|
||||
QGraphicsItem *last = mouseGrabberItems.last();
|
||||
QGraphicsItem *last = mouseGrabberItems.constLast();
|
||||
if (lastMouseGrabberItemHasImplicitMouseGrab) {
|
||||
// Implicit mouse grab is immediately lost.
|
||||
last->ungrabMouse();
|
||||
|
|
@ -987,12 +987,12 @@ void QGraphicsScenePrivate::ungrabMouse(QGraphicsItem *item, bool itemIsDying)
|
|||
return;
|
||||
}
|
||||
|
||||
if (item != mouseGrabberItems.last()) {
|
||||
if (item != mouseGrabberItems.constLast()) {
|
||||
// Recursively ungrab the next mouse grabber until we reach this item
|
||||
// to ensure state consistency.
|
||||
ungrabMouse(mouseGrabberItems.at(index + 1), itemIsDying);
|
||||
}
|
||||
if (!popupWidgets.isEmpty() && item == popupWidgets.last()) {
|
||||
if (!popupWidgets.isEmpty() && item == popupWidgets.constLast()) {
|
||||
// If the item is a popup, go via removePopup to ensure state
|
||||
// consistency and that it gets hidden correctly - beware that
|
||||
// removePopup() reenters this function to continue removing the grab.
|
||||
|
|
@ -1017,7 +1017,7 @@ void QGraphicsScenePrivate::ungrabMouse(QGraphicsItem *item, bool itemIsDying)
|
|||
// items get a GrabMouse event, but this is a rare case with a simple
|
||||
// implementation and it does ensure a consistent state.
|
||||
if (!itemIsDying && !mouseGrabberItems.isEmpty()) {
|
||||
QGraphicsItem *last = mouseGrabberItems.last();
|
||||
QGraphicsItem *last = mouseGrabberItems.constLast();
|
||||
QEvent event(QEvent::GrabMouse);
|
||||
sendEvent(last, &event);
|
||||
}
|
||||
|
|
@ -1039,11 +1039,11 @@ void QGraphicsScenePrivate::clearMouseGrabber()
|
|||
void QGraphicsScenePrivate::grabKeyboard(QGraphicsItem *item)
|
||||
{
|
||||
if (keyboardGrabberItems.contains(item)) {
|
||||
if (keyboardGrabberItems.last() == item)
|
||||
if (keyboardGrabberItems.constLast() == item)
|
||||
qWarning("QGraphicsItem::grabKeyboard: already a keyboard grabber");
|
||||
else
|
||||
qWarning("QGraphicsItem::grabKeyboard: already blocked by keyboard grabber: %p",
|
||||
keyboardGrabberItems.last());
|
||||
keyboardGrabberItems.constLast());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1051,7 +1051,7 @@ void QGraphicsScenePrivate::grabKeyboard(QGraphicsItem *item)
|
|||
if (!keyboardGrabberItems.isEmpty()) {
|
||||
// Just send ungrab event to current grabber.
|
||||
QEvent ungrabEvent(QEvent::UngrabKeyboard);
|
||||
sendEvent(keyboardGrabberItems.last(), &ungrabEvent);
|
||||
sendEvent(keyboardGrabberItems.constLast(), &ungrabEvent);
|
||||
}
|
||||
|
||||
keyboardGrabberItems << item;
|
||||
|
|
@ -1071,7 +1071,7 @@ void QGraphicsScenePrivate::ungrabKeyboard(QGraphicsItem *item, bool itemIsDying
|
|||
qWarning("QGraphicsItem::ungrabKeyboard: not a keyboard grabber");
|
||||
return;
|
||||
}
|
||||
if (item != keyboardGrabberItems.last()) {
|
||||
if (item != keyboardGrabberItems.constLast()) {
|
||||
// Recursively ungrab the topmost keyboard grabber until we reach this
|
||||
// item to ensure state consistency.
|
||||
ungrabKeyboard(keyboardGrabberItems.at(index + 1), itemIsDying);
|
||||
|
|
@ -1088,7 +1088,7 @@ void QGraphicsScenePrivate::ungrabKeyboard(QGraphicsItem *item, bool itemIsDying
|
|||
|
||||
// Send notification about mouse regrab.
|
||||
if (!itemIsDying && !keyboardGrabberItems.isEmpty()) {
|
||||
QGraphicsItem *last = keyboardGrabberItems.last();
|
||||
QGraphicsItem *last = keyboardGrabberItems.constLast();
|
||||
QEvent event(QEvent::GrabKeyboard);
|
||||
sendEvent(last, &event);
|
||||
}
|
||||
|
|
@ -1100,7 +1100,7 @@ void QGraphicsScenePrivate::ungrabKeyboard(QGraphicsItem *item, bool itemIsDying
|
|||
void QGraphicsScenePrivate::clearKeyboardGrabber()
|
||||
{
|
||||
if (!keyboardGrabberItems.isEmpty())
|
||||
ungrabKeyboard(keyboardGrabberItems.first());
|
||||
ungrabKeyboard(keyboardGrabberItems.constFirst());
|
||||
}
|
||||
|
||||
void QGraphicsScenePrivate::enableMouseTrackingOnViews()
|
||||
|
|
@ -1142,8 +1142,8 @@ void QGraphicsScenePrivate::storeMouseButtonsForMouseGrabber(QGraphicsSceneMouse
|
|||
for (int i = 0x1; i <= 0x10; i <<= 1) {
|
||||
if (event->buttons() & i) {
|
||||
mouseGrabberButtonDownPos.insert(Qt::MouseButton(i),
|
||||
mouseGrabberItems.last()->d_ptr->genericMapFromScene(event->scenePos(),
|
||||
event->widget()));
|
||||
mouseGrabberItems.constLast()->d_ptr->genericMapFromScene(event->scenePos(),
|
||||
event->widget()));
|
||||
mouseGrabberButtonDownScenePos.insert(Qt::MouseButton(i), event->scenePos());
|
||||
mouseGrabberButtonDownScreenPos.insert(Qt::MouseButton(i), event->screenPos());
|
||||
}
|
||||
|
|
@ -1308,7 +1308,7 @@ void QGraphicsScenePrivate::sendMouseEvent(QGraphicsSceneMouseEvent *mouseEvent)
|
|||
return;
|
||||
}
|
||||
|
||||
QGraphicsItem *item = mouseGrabberItems.last();
|
||||
QGraphicsItem *item = mouseGrabberItems.constLast();
|
||||
if (item->isBlockedByModalPanel())
|
||||
return;
|
||||
|
||||
|
|
@ -1335,7 +1335,7 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou
|
|||
|
||||
// Deliver to any existing mouse grabber.
|
||||
if (!mouseGrabberItems.isEmpty()) {
|
||||
if (mouseGrabberItems.last()->isBlockedByModalPanel())
|
||||
if (mouseGrabberItems.constLast()->isBlockedByModalPanel())
|
||||
return;
|
||||
// The event is ignored by default, but we disregard the event's
|
||||
// accepted state after delivery; the mouse is grabbed, after all.
|
||||
|
|
@ -1401,7 +1401,7 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou
|
|||
|
||||
// Any item will do.
|
||||
if (sceneModality && cachedItemsUnderMouse.isEmpty())
|
||||
cachedItemsUnderMouse << modalPanels.first();
|
||||
cachedItemsUnderMouse << modalPanels.constFirst();
|
||||
|
||||
// Find a mouse grabber by sending mouse press events to all mouse grabber
|
||||
// candidates one at a time, until the event is accepted. It's accepted by
|
||||
|
|
@ -1450,7 +1450,7 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou
|
|||
sendMouseEvent(mouseEvent);
|
||||
}
|
||||
|
||||
bool dontSendUngrabEvents = mouseGrabberItems.isEmpty() || mouseGrabberItems.last() != item;
|
||||
bool dontSendUngrabEvents = mouseGrabberItems.isEmpty() || mouseGrabberItems.constLast() != item;
|
||||
if (disabled) {
|
||||
ungrabMouse(item, /* itemIsDying = */ dontSendUngrabEvents);
|
||||
break;
|
||||
|
|
@ -2167,8 +2167,8 @@ QList<QGraphicsItem *> QGraphicsScene::collidingItems(const QGraphicsItem *item,
|
|||
*/
|
||||
QGraphicsItem *QGraphicsScene::itemAt(const QPointF &position, const QTransform &deviceTransform) const
|
||||
{
|
||||
QList<QGraphicsItem *> itemsAtPoint = items(position, Qt::IntersectsItemShape,
|
||||
Qt::DescendingOrder, deviceTransform);
|
||||
const QList<QGraphicsItem *> itemsAtPoint = items(position, Qt::IntersectsItemShape,
|
||||
Qt::DescendingOrder, deviceTransform);
|
||||
return itemsAtPoint.isEmpty() ? 0 : itemsAtPoint.first();
|
||||
}
|
||||
|
||||
|
|
@ -3771,7 +3771,7 @@ void QGraphicsScene::focusOutEvent(QFocusEvent *focusEvent)
|
|||
|
||||
// Remove all popups when the scene loses focus.
|
||||
if (!d->popupWidgets.isEmpty())
|
||||
d->removePopup(d->popupWidgets.first());
|
||||
d->removePopup(d->popupWidgets.constFirst());
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
@ -3868,7 +3868,7 @@ bool QGraphicsScenePrivate::dispatchHoverEvent(QGraphicsSceneHoverEvent *hoverEv
|
|||
|
||||
// Find the common ancestor item for the new topmost hoverItem and the
|
||||
// last item in the hoverItem list.
|
||||
QGraphicsItem *commonAncestorItem = (item && !hoverItems.isEmpty()) ? item->commonAncestorItem(hoverItems.last()) : 0;
|
||||
QGraphicsItem *commonAncestorItem = (item && !hoverItems.isEmpty()) ? item->commonAncestorItem(hoverItems.constLast()) : 0;
|
||||
while (commonAncestorItem && !itemAcceptsHoverEvents_helper(commonAncestorItem))
|
||||
commonAncestorItem = commonAncestorItem->parentItem();
|
||||
if (commonAncestorItem && commonAncestorItem->panel() != item->panel()) {
|
||||
|
|
@ -3909,7 +3909,7 @@ bool QGraphicsScenePrivate::dispatchHoverEvent(QGraphicsSceneHoverEvent *hoverEv
|
|||
// Generate a move event for the item itself
|
||||
if (item
|
||||
&& !hoverItems.isEmpty()
|
||||
&& item == hoverItems.last()) {
|
||||
&& item == hoverItems.constLast()) {
|
||||
sendHoverEvent(QEvent::GraphicsSceneHoverMove, item, hoverEvent);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -3959,7 +3959,7 @@ void QGraphicsScene::keyPressEvent(QKeyEvent *keyEvent)
|
|||
// ### Merge this function with keyReleaseEvent; they are identical
|
||||
// ### (except this comment).
|
||||
Q_D(QGraphicsScene);
|
||||
QGraphicsItem *item = !d->keyboardGrabberItems.isEmpty() ? d->keyboardGrabberItems.last() : 0;
|
||||
QGraphicsItem *item = !d->keyboardGrabberItems.isEmpty() ? d->keyboardGrabberItems.constLast() : 0;
|
||||
if (!item)
|
||||
item = focusItem();
|
||||
if (item) {
|
||||
|
|
@ -3991,7 +3991,7 @@ void QGraphicsScene::keyReleaseEvent(QKeyEvent *keyEvent)
|
|||
// ### Merge this function with keyPressEvent; they are identical (except
|
||||
// ### this comment).
|
||||
Q_D(QGraphicsScene);
|
||||
QGraphicsItem *item = !d->keyboardGrabberItems.isEmpty() ? d->keyboardGrabberItems.last() : 0;
|
||||
QGraphicsItem *item = !d->keyboardGrabberItems.isEmpty() ? d->keyboardGrabberItems.constLast() : 0;
|
||||
if (!item)
|
||||
item = focusItem();
|
||||
if (item) {
|
||||
|
|
@ -4100,9 +4100,9 @@ void QGraphicsScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent)
|
|||
// Reset the mouse grabber when the last mouse button has been released.
|
||||
if (!mouseEvent->buttons()) {
|
||||
if (!d->mouseGrabberItems.isEmpty()) {
|
||||
d->lastMouseGrabberItem = d->mouseGrabberItems.last();
|
||||
d->lastMouseGrabberItem = d->mouseGrabberItems.constLast();
|
||||
if (d->lastMouseGrabberItemHasImplicitMouseGrab)
|
||||
d->mouseGrabberItems.last()->ungrabMouse();
|
||||
d->mouseGrabberItems.constLast()->ungrabMouse();
|
||||
} else {
|
||||
d->lastMouseGrabberItem = 0;
|
||||
}
|
||||
|
|
@ -5901,7 +5901,7 @@ void QGraphicsScenePrivate::touchEventHandler(QTouchEvent *sceneTouchEvent)
|
|||
cachedItemsUnderMouse = itemsAtPosition(touchPoint.screenPos().toPoint(),
|
||||
touchPoint.scenePos(),
|
||||
static_cast<QWidget *>(sceneTouchEvent->target()));
|
||||
item = cachedItemsUnderMouse.isEmpty() ? 0 : cachedItemsUnderMouse.first();
|
||||
item = cachedItemsUnderMouse.isEmpty() ? 0 : cachedItemsUnderMouse.constFirst();
|
||||
}
|
||||
|
||||
if (sceneTouchEvent->device()->type() == QTouchDevice::TouchScreen) {
|
||||
|
|
@ -6012,7 +6012,7 @@ bool QGraphicsScenePrivate::sendTouchBeginEvent(QGraphicsItem *origin, QTouchEve
|
|||
{
|
||||
Q_Q(QGraphicsScene);
|
||||
|
||||
if (cachedItemsUnderMouse.isEmpty() || cachedItemsUnderMouse.first() != origin) {
|
||||
if (cachedItemsUnderMouse.isEmpty() || cachedItemsUnderMouse.constFirst() != origin) {
|
||||
const QTouchEvent::TouchPoint &firstTouchPoint = touchEvent->touchPoints().first();
|
||||
cachedItemsUnderMouse = itemsAtPosition(firstTouchPoint.screenPos().toPoint(),
|
||||
firstTouchPoint.scenePos(),
|
||||
|
|
@ -6128,7 +6128,7 @@ void QGraphicsScenePrivate::enterModal(QGraphicsItem *panel, QGraphicsItem::Pane
|
|||
}
|
||||
|
||||
if (!mouseGrabberItems.isEmpty() && lastMouseGrabberItemHasImplicitMouseGrab) {
|
||||
QGraphicsItem *item = mouseGrabberItems.last();
|
||||
QGraphicsItem *item = mouseGrabberItems.constLast();
|
||||
if (item->isBlockedByModalPanel())
|
||||
ungrabMouse(item, /*itemIsDying =*/ false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2378,7 +2378,7 @@ QGraphicsItem *QGraphicsView::itemAt(const QPoint &pos) const
|
|||
Q_D(const QGraphicsView);
|
||||
if (!d->scene)
|
||||
return 0;
|
||||
QList<QGraphicsItem *> itemsAtPos = items(pos);
|
||||
const QList<QGraphicsItem *> itemsAtPos = items(pos);
|
||||
return itemsAtPos.isEmpty() ? 0 : itemsAtPos.first();
|
||||
}
|
||||
|
||||
|
|
@ -2865,7 +2865,7 @@ bool QGraphicsView::viewportEvent(QEvent *event)
|
|||
// the mouse grab.
|
||||
// Remove all popups when the scene loses focus.
|
||||
if (!d->scene->d_func()->popupWidgets.isEmpty())
|
||||
d->scene->d_func()->removePopup(d->scene->d_func()->popupWidgets.first());
|
||||
d->scene->d_func()->removePopup(d->scene->d_func()->popupWidgets.constFirst());
|
||||
QApplication::sendEvent(d->scene, event);
|
||||
break;
|
||||
case QEvent::Show:
|
||||
|
|
@ -2889,7 +2889,7 @@ bool QGraphicsView::viewportEvent(QEvent *event)
|
|||
|| (QApplication::activeModalWidget() && QApplication::activeModalWidget() != window())
|
||||
|| (QApplication::activeWindow() != window())) {
|
||||
if (!d->scene->d_func()->popupWidgets.isEmpty())
|
||||
d->scene->d_func()->removePopup(d->scene->d_func()->popupWidgets.first());
|
||||
d->scene->d_func()->removePopup(d->scene->d_func()->popupWidgets.constFirst());
|
||||
}
|
||||
d->useLastMouseEvent = false;
|
||||
// a hack to pass a viewport pointer to the scene inside the leave event
|
||||
|
|
|
|||
|
|
@ -412,9 +412,9 @@ void QColumnViewPrivate::updateScrollbars()
|
|||
// find the total horizontal length of the laid out columns
|
||||
int horizontalLength = 0;
|
||||
if (!columns.isEmpty()) {
|
||||
horizontalLength = (columns.last()->x() + columns.last()->width()) - columns.first()->x();
|
||||
horizontalLength = (columns.constLast()->x() + columns.constLast()->width()) - columns.constFirst()->x();
|
||||
if (horizontalLength <= 0) // reverse mode
|
||||
horizontalLength = (columns.first()->x() + columns.first()->width()) - columns.last()->x();
|
||||
horizontalLength = (columns.constFirst()->x() + columns.constFirst()->width()) - columns.constLast()->x();
|
||||
}
|
||||
|
||||
QSize viewportSize = viewport->size();
|
||||
|
|
@ -629,7 +629,7 @@ void QColumnViewPrivate::closeColumns(const QModelIndex &parent, bool build)
|
|||
while (!dirsToAppend.isEmpty()) {
|
||||
QAbstractItemView *newView = createColumn(dirsToAppend.takeLast(), true);
|
||||
if (!dirsToAppend.isEmpty())
|
||||
newView->setCurrentIndex(dirsToAppend.last());
|
||||
newView->setCurrentIndex(dirsToAppend.constLast());
|
||||
}
|
||||
|
||||
if (build && !alreadyExists)
|
||||
|
|
@ -713,8 +713,8 @@ QAbstractItemView *QColumnViewPrivate::createColumn(const QModelIndex &index, bo
|
|||
columnSizes.resize(qMax(columnSizes.count(), columns.count() + 1));
|
||||
columnSizes[columns.count()] = initialWidth;
|
||||
}
|
||||
if (!columns.isEmpty() && columns.last()->isHidden())
|
||||
columns.last()->setVisible(true);
|
||||
if (!columns.isEmpty() && columns.constLast()->isHidden())
|
||||
columns.constLast()->setVisible(true);
|
||||
|
||||
columns.append(view);
|
||||
doLayout();
|
||||
|
|
@ -835,7 +835,7 @@ void QColumnViewPrivate::setPreviewWidget(QWidget *widget)
|
|||
{
|
||||
Q_Q(QColumnView);
|
||||
if (previewColumn) {
|
||||
if (!columns.isEmpty() && columns.last() == previewColumn)
|
||||
if (!columns.isEmpty() && columns.constLast() == previewColumn)
|
||||
columns.removeLast();
|
||||
previewColumn->deleteLater();
|
||||
}
|
||||
|
|
@ -1003,11 +1003,11 @@ void QColumnViewPrivate::_q_changeCurrentColumn()
|
|||
parentColumn->setCurrentIndex(current.parent());
|
||||
}
|
||||
|
||||
if (columns.last()->isHidden()) {
|
||||
columns.last()->setVisible(true);
|
||||
if (columns.constLast()->isHidden()) {
|
||||
columns.constLast()->setVisible(true);
|
||||
}
|
||||
if (columns.last()->selectionModel())
|
||||
columns.last()->selectionModel()->clear();
|
||||
if (columns.constLast()->selectionModel())
|
||||
columns.constLast()->selectionModel()->clear();
|
||||
updateScrollbars();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -885,7 +885,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const
|
|||
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
||||
if (absolutePath.startsWith(QLatin1String("//"))) { // UNC path
|
||||
QString host = pathElements.first();
|
||||
QString host = pathElements.constFirst();
|
||||
int r = 0;
|
||||
for (; r < d->root.children.count(); ++r)
|
||||
if (d->root.children.at(r).info.fileName() == host)
|
||||
|
|
|
|||
|
|
@ -2396,9 +2396,9 @@ QPoint QListModeViewBase::initStaticLayout(const QListViewLayoutInfo &info)
|
|||
} else if (info.wrap) {
|
||||
if (info.flow == QListView::LeftToRight) {
|
||||
x = batchSavedPosition;
|
||||
y = segmentPositions.last();
|
||||
y = segmentPositions.constLast();
|
||||
} else { // flow == QListView::TopToBottom
|
||||
x = segmentPositions.last();
|
||||
x = segmentPositions.constLast();
|
||||
y = batchSavedPosition;
|
||||
}
|
||||
} else { // not first and not wrap
|
||||
|
|
@ -2613,7 +2613,7 @@ int QListModeViewBase::perItemScrollingPageSteps(int length, int bounds, bool wr
|
|||
int steps = positions.count() - 1;
|
||||
int max = qMax(length, bounds);
|
||||
int min = qMin(length, bounds);
|
||||
int pos = min - (max - positions.last());
|
||||
int pos = min - (max - positions.constLast());
|
||||
|
||||
while (pos >= 0 && steps > 0) {
|
||||
pos -= (positions.at(steps) - positions.at(steps - 1));
|
||||
|
|
|
|||
|
|
@ -2357,10 +2357,10 @@ void QTreeView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFl
|
|||
return;
|
||||
}
|
||||
if (!topLeft.isValid() && !d->viewItems.isEmpty())
|
||||
topLeft = d->viewItems.first().index;
|
||||
topLeft = d->viewItems.constFirst().index;
|
||||
if (!bottomRight.isValid() && !d->viewItems.isEmpty()) {
|
||||
const int column = d->header->logicalIndex(d->header->count() - 1);
|
||||
const QModelIndex index = d->viewItems.last().index;
|
||||
const QModelIndex index = d->viewItems.constLast().index;
|
||||
bottomRight = index.sibling(index.row(), column);
|
||||
}
|
||||
|
||||
|
|
@ -2668,9 +2668,9 @@ void QTreeView::selectAll()
|
|||
SelectionMode mode = d->selectionMode;
|
||||
d->executePostedLayout(); //make sure we lay out the items
|
||||
if (mode != SingleSelection && mode != NoSelection && !d->viewItems.isEmpty()) {
|
||||
const QModelIndex &idx = d->viewItems.last().index;
|
||||
const QModelIndex &idx = d->viewItems.constLast().index;
|
||||
QModelIndex lastItemIndex = idx.sibling(idx.row(), d->model->columnCount(idx.parent()) - 1);
|
||||
d->select(d->viewItems.first().index, lastItemIndex,
|
||||
d->select(d->viewItems.constFirst().index, lastItemIndex,
|
||||
QItemSelectionModel::ClearAndSelect
|
||||
|QItemSelectionModel::Rows);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3163,7 +3163,7 @@ void QDockAreaLayout::splitDockWidget(QDockWidget *after,
|
|||
QDockWidget *dockWidget,
|
||||
Qt::Orientation orientation)
|
||||
{
|
||||
QList<int> path = indexOf(after);
|
||||
const QList<int> path = indexOf(after);
|
||||
if (path.isEmpty())
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ static QFontDatabase::WritingSystem writingSystemForFont(const QFont &font, bool
|
|||
return QFontDatabase::TraditionalChinese;
|
||||
}
|
||||
|
||||
system = writingSystems.last();
|
||||
system = writingSystems.constLast();
|
||||
|
||||
if (!*hasLatin) {
|
||||
// we need to show something
|
||||
|
|
|
|||
Loading…
Reference in New Issue