diff options
Diffstat (limited to 'src/quick/items')
-rw-r--r-- | src/quick/items/qquickevents.cpp | 10 | ||||
-rw-r--r-- | src/quick/items/qquickitem.cpp | 16 | ||||
-rw-r--r-- | src/quick/items/qquickitemanimation.cpp | 27 | ||||
-rw-r--r-- | src/quick/items/qquickitemanimation_p_p.h | 8 | ||||
-rw-r--r-- | src/quick/items/qquickitemview.cpp | 4 | ||||
-rw-r--r-- | src/quick/items/qquickpincharea.cpp | 8 | ||||
-rw-r--r-- | src/quick/items/qquicktableview.cpp | 78 | ||||
-rw-r--r-- | src/quick/items/qquicktextedit.cpp | 8 |
8 files changed, 97 insertions, 62 deletions
diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp index 950afaed52..7e673b3fe4 100644 --- a/src/quick/items/qquickevents.cpp +++ b/src/quick/items/qquickevents.cpp @@ -813,7 +813,7 @@ QQuickPointerDevice *QQuickPointerDevice::tabletDevice(const QTabletEvent *event \readonly \qmlproperty int QtQuick::EventPoint::pointId - This property holds the ID of the event, if any. + This property holds the ID of the point, if any. Touchpoints have automatically-incrementing IDs: each time the user presses a finger against the touchscreen, it will be a larger number. @@ -826,12 +826,8 @@ QQuickPointerDevice *QQuickPointerDevice::tabletDevice(const QTabletEvent *event \readonly \qmlproperty bool QtQuick::EventPoint::accepted - Setting \a accepted to true prevents the event from being propagated to - Items below the PointerHandler's Item. - - Generally, if the handler acts on the mouse event, then it should be - accepted so that items lower in the stacking order do not also respond to - the same event. + Indicates whether this point has been accepted during delivery thus far. + This flag cannot be usefully set from QML. */ /*! diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 497672b497..3df899d63d 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -2095,7 +2095,7 @@ void QQuickItemPrivate::updateSubFocusItem(QQuickItem *scope, bool focus) /*! \class QQuickItem::ItemChangeData \inmodule QtQuick - \brief Adds supplimentary information to the QQuickItem::itemChange() + \brief Adds supplementary information to the QQuickItem::itemChange() function. The meaning of each member of this class is defined by the change type. @@ -2125,25 +2125,31 @@ void QQuickItemPrivate::updateSubFocusItem(QQuickItem *scope, bool focus) /*! \variable QQuickItem::ItemChangeData::realValue - Contains supplimentary information to the QQuickItem::itemChange() function. + The numeric value that has changed: \l {QQuickItem::opacity()}{opacity}, + \l {QQuickItem::rotation()}{rotation} or + \l {QScreen::devicePixelRatio}{device pixel ratio}. \sa QQuickItem::ItemChange */ /*! \variable QQuickItem::ItemChangeData::boolValue - Contains supplimentary information to the QQuickItem::itemChange() function. + The boolean value that has changed: \l {QQuickItem::visible()}{visible}, + \l {QQuickItem::enabled()}{enabled}, \l {QQuickItem::activeFocus()}{activeFocus} + or \l {QQuickItem::antialiasing()}{antialiasing}. \sa QQuickItem::ItemChange */ /*! \variable QQuickItem::ItemChangeData::item - Contains supplimentary information to the QQuickItem::itemChange() function. + The item that has been added or removed as a \l{QQuickItem::childItems()}{child}, + or the new \l{QQuickItem::parentItem()}{parent}. \sa QQuickItem::ItemChange */ /*! \variable QQuickItem::ItemChangeData::window - Contains supplimentary information to the QQuickItem::itemChange() function. + The \l{QQuickWindow}{window} in which the item has been shown, or \c nullptr + if the item has been removed from a window. \sa QQuickItem::ItemChange */ diff --git a/src/quick/items/qquickitemanimation.cpp b/src/quick/items/qquickitemanimation.cpp index dfb56ccc00..63359a7683 100644 --- a/src/quick/items/qquickitemanimation.cpp +++ b/src/quick/items/qquickitemanimation.cpp @@ -529,8 +529,8 @@ QAbstractAnimationJob* QQuickAnchorAnimation::transition(QQuickStateActions &act data->interpolatorType = QMetaType::QReal; data->interpolator = d->interpolator; data->reverse = direction == Backward ? true : false; - data->fromSourced = false; - data->fromDefined = false; + data->fromIsSourced = false; + data->fromIsDefined = false; for (int ii = 0; ii < actions.count(); ++ii) { QQuickStateAction &action = actions[ii]; @@ -543,7 +543,7 @@ QAbstractAnimationJob* QQuickAnchorAnimation::transition(QQuickStateActions &act QQuickBulkValueAnimator *animator = new QQuickBulkValueAnimator; if (data->actions.count()) { animator->setAnimValue(data); - animator->setFromSourcedValue(&data->fromSourced); + animator->setFromIsSourcedValue(&data->fromIsSourced); } else { delete data; } @@ -864,9 +864,9 @@ QAbstractAnimationJob* QQuickPathAnimation::transition(QQuickStateActions &actio data->exitInterval = d->duration ? qreal(d->exitDuration) / d->duration : qreal(0); data->endRotation = d->endRotation; data->reverse = direction == Backward ? true : false; - data->fromSourced = false; - data->fromDefined = (d->path && d->path->hasStartX() && d->path->hasStartY()) ? true : false; - data->toDefined = d->path ? true : false; + data->fromIsSourced = false; + data->fromIsDefined = (d->path && d->path->hasStartX() && d->path->hasStartY()) ? true : false; + data->toIsDefined = d->path ? true : false; int origModifiedSize = modified.count(); for (int i = 0; i < actions.count(); ++i) { @@ -885,8 +885,7 @@ QAbstractAnimationJob* QQuickPathAnimation::transition(QQuickStateActions &actio } } - if (target && d->path && - (modified.count() > origModifiedSize || data->toDefined)) { + if (target && d->path && (modified.count() > origModifiedSize || data->toIsDefined)) { data->target = target; data->path = d->path; data->path->invalidateSequentialHistory(); @@ -897,13 +896,13 @@ QAbstractAnimationJob* QQuickPathAnimation::transition(QQuickStateActions &actio // treat interruptions specially, otherwise we end up with strange paths if ((data->reverse || prevData.reverse) && prevData.currentV > 0 && prevData.currentV < 1) { - if (!data->fromDefined && !data->toDefined && !prevData.painterPath.isEmpty()) { + if (!data->fromIsDefined && !data->toIsDefined && !prevData.painterPath.isEmpty()) { QPointF pathPos = QQuickPath::sequentialPointAt(prevData.painterPath, prevData.pathLength, prevData.attributePoints, prevData.prevBez, prevData.currentV); if (!prevData.anchorPoint.isNull()) pathPos -= prevData.anchorPoint; if (pathPos == data->target->position()) { //only treat as interruption if we interrupted ourself data->painterPath = prevData.painterPath; - data->toDefined = data->fromDefined = data->fromSourced = true; + data->toIsDefined = data->fromIsDefined = data->fromIsSourced = true; data->prevBez.isValid = false; data->interruptStart = prevData.currentV; data->startRotation = prevData.startRotation; @@ -913,13 +912,13 @@ QAbstractAnimationJob* QQuickPathAnimation::transition(QQuickStateActions &actio } } } - pa->setFromSourcedValue(&data->fromSourced); + pa->setFromIsSourcedValue(&data->fromIsSourced); pa->setAnimValue(data); pa->setDuration(d->duration); pa->setEasingCurve(d->easingCurve); return initInstance(pa); } else { - pa->setFromSourcedValue(nullptr); + pa->setFromIsSourcedValue(nullptr); pa->setAnimValue(nullptr); delete pa; delete data; @@ -939,7 +938,7 @@ void QQuickPathAnimationUpdater::setValue(qreal v) } currentV = v; bool atStart = ((reverse && v == 1.0) || (!reverse && v == 0.0)); - if (!fromSourced && (!fromDefined || !toDefined)) { + if (!fromIsSourced && (!fromIsDefined || !toIsDefined)) { qreal startX = reverse ? toX + anchorPoint.x() : target->x() + anchorPoint.x(); qreal startY = reverse ? toY + anchorPoint.y() : target->y() + anchorPoint.y(); qreal endX = reverse ? target->x() + anchorPoint.x() : toX + anchorPoint.x(); @@ -947,7 +946,7 @@ void QQuickPathAnimationUpdater::setValue(qreal v) prevBez.isValid = false; painterPath = path->createPath(QPointF(startX, startY), QPointF(endX, endY), QStringList(), pathLength, attributePoints); - fromSourced = true; + fromIsSourced = true; } qreal angle; diff --git a/src/quick/items/qquickitemanimation_p_p.h b/src/quick/items/qquickitemanimation_p_p.h index 83b9899197..351a0cb2bc 100644 --- a/src/quick/items/qquickitemanimation_p_p.h +++ b/src/quick/items/qquickitemanimation_p_p.h @@ -92,7 +92,7 @@ class QQuickPathAnimationUpdater : public QQuickBulkValueUpdater { public: QQuickPathAnimationUpdater() : path(nullptr), pathLength(0), target(nullptr), reverse(false), - fromSourced(false), fromDefined(false), toDefined(false), + fromIsSourced(false), fromIsDefined(false), toIsDefined(false), toX(0), toY(0), currentV(0), orientation(QQuickPathAnimation::Fixed), entryInterval(0), exitInterval(0) {} ~QQuickPathAnimationUpdater() {} @@ -108,9 +108,9 @@ public: QQuickItem *target; bool reverse; - bool fromSourced; - bool fromDefined; - bool toDefined; + bool fromIsSourced; + bool fromIsDefined; + bool toIsDefined; qreal toX; qreal toY; qreal currentV; diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp index 2b4ca9e256..010a0152e1 100644 --- a/src/quick/items/qquickitemview.cpp +++ b/src/quick/items/qquickitemview.cpp @@ -2346,7 +2346,9 @@ FxViewItem *QQuickItemViewPrivate::createItem(int modelIndex, QQmlIncubator::Inc inRequest = true; - QObject* object = model->object(modelIndex, incubationMode); + // The model will run this same range check internally but produce a warning and return nullptr. + // Since we handle this result graciously in our code, we preempt this warning by checking the range ourselves. + QObject* object = modelIndex < model->count() ? model->object(modelIndex, incubationMode) : nullptr; QQuickItem *item = qmlobject_cast<QQuickItem*>(object); if (!item) { diff --git a/src/quick/items/qquickpincharea.cpp b/src/quick/items/qquickpincharea.cpp index 0692a1da42..1a07eb5923 100644 --- a/src/quick/items/qquickpincharea.cpp +++ b/src/quick/items/qquickpincharea.cpp @@ -556,7 +556,10 @@ void QQuickPinchArea::updatePinch() d->inPinch = true; d->stealMouse = true; if (d->pinch && d->pinch->target()) { - d->pinchStartPos = pinch()->target()->position(); + auto targetParent = pinch()->target()->parentItem(); + d->pinchStartPos = targetParent ? + targetParent->mapToScene(pinch()->target()->position()) : + pinch()->target()->position(); d->pinchStartScale = d->pinch->target()->scale(); d->pinchStartRotation = d->pinch->target()->rotation(); d->pinch->setActive(true); @@ -604,6 +607,9 @@ void QQuickPinchArea::updatePinchTarget() s = qMin(qMax(pinch()->minimumScale(),s), pinch()->maximumScale()); pinch()->target()->setScale(s); QPointF pos = d->sceneLastCenter - d->sceneStartCenter + d->pinchStartPos; + if (auto targetParent = pinch()->target()->parentItem()) + pos = targetParent->mapFromScene(pos); + if (pinch()->axis() & QQuickPinch::XAxis) { qreal x = pos.x(); if (x < pinch()->xmin()) diff --git a/src/quick/items/qquicktableview.cpp b/src/quick/items/qquicktableview.cpp index f9454fc5cb..5feec60874 100644 --- a/src/quick/items/qquicktableview.cpp +++ b/src/quick/items/qquicktableview.cpp @@ -958,43 +958,61 @@ QQuickTableViewPrivate::RebuildOptions QQuickTableViewPrivate::checkForVisibilit return RebuildOption::None; } - // Go through all columns from first to last, find the columns that used - // to be hidden and not loaded, and check if they should become visible - // (and vice versa). If there is a change, we need to rebuild. RebuildOptions rebuildOptions = RebuildOption::None; - for (int column = leftColumn(); column <= rightColumn(); ++column) { - const bool wasVisibleFromBefore = loadedColumns.contains(column); - const bool isVisibleNow = !qFuzzyIsNull(getColumnWidth(column)); - if (wasVisibleFromBefore == isVisibleNow) - continue; - - // A column changed visibility. This means that it should - // either be loaded or unloaded. So we need a rebuild. - qCDebug(lcTableViewDelegateLifecycle) << "Column" << column << "changed visibility to" << isVisibleNow; + if (loadedTableOuterRect.x() == origin.x() && leftColumn() != 0) { + // Since the left column is at the origin of the viewport, but still not the first + // column in the model, we need to calculate a new left column since there might be + // columns in front of it that used to be hidden, but should now be visible (QTBUG-93264). rebuildOptions.setFlag(RebuildOption::ViewportOnly); - if (column == leftColumn()) { - // The first loaded column should now be hidden. This means that we - // need to calculate which column should now be first instead. - rebuildOptions.setFlag(RebuildOption::CalculateNewTopLeftColumn); + rebuildOptions.setFlag(RebuildOption::CalculateNewTopLeftColumn); + } else { + // Go through all loaded columns from first to last, find the columns that used + // to be hidden and not loaded, and check if they should become visible + // (and vice versa). If there is a change, we need to rebuild. + for (int column = leftColumn(); column <= rightColumn(); ++column) { + const bool wasVisibleFromBefore = loadedColumns.contains(column); + const bool isVisibleNow = !qFuzzyIsNull(getColumnWidth(column)); + if (wasVisibleFromBefore == isVisibleNow) + continue; + + // A column changed visibility. This means that it should + // either be loaded or unloaded. So we need a rebuild. + qCDebug(lcTableViewDelegateLifecycle) << "Column" << column << "changed visibility to" << isVisibleNow; + rebuildOptions.setFlag(RebuildOption::ViewportOnly); + if (column == leftColumn()) { + // The first loaded column should now be hidden. This means that we + // need to calculate which column should now be first instead. + rebuildOptions.setFlag(RebuildOption::CalculateNewTopLeftColumn); + } + break; } - break; } - // Go through all rows from first to last, and do the same as above - for (int row = topRow(); row <= bottomRow(); ++row) { - const bool wasVisibleFromBefore = loadedRows.contains(row); - const bool isVisibleNow = !qFuzzyIsNull(getRowHeight(row)); - if (wasVisibleFromBefore == isVisibleNow) - continue; - - // A row changed visibility. This means that it should - // either be loaded or unloaded. So we need a rebuild. - qCDebug(lcTableViewDelegateLifecycle) << "Row" << row << "changed visibility to" << isVisibleNow; + if (loadedTableOuterRect.y() == origin.y() && topRow() != 0) { + // Since the top row is at the origin of the viewport, but still not the first + // row in the model, we need to calculate a new top row since there might be + // rows in front of it that used to be hidden, but should now be visible (QTBUG-93264). rebuildOptions.setFlag(RebuildOption::ViewportOnly); - if (row == topRow()) - rebuildOptions.setFlag(RebuildOption::CalculateNewTopLeftRow); - break; + rebuildOptions.setFlag(RebuildOption::CalculateNewTopLeftRow); + } else { + // Go through all loaded rows from first to last, find the rows that used + // to be hidden and not loaded, and check if they should become visible + // (and vice versa). If there is a change, we need to rebuild. + for (int row = topRow(); row <= bottomRow(); ++row) { + const bool wasVisibleFromBefore = loadedRows.contains(row); + const bool isVisibleNow = !qFuzzyIsNull(getRowHeight(row)); + if (wasVisibleFromBefore == isVisibleNow) + continue; + + // A row changed visibility. This means that it should + // either be loaded or unloaded. So we need a rebuild. + qCDebug(lcTableViewDelegateLifecycle) << "Row" << row << "changed visibility to" << isVisibleNow; + rebuildOptions.setFlag(RebuildOption::ViewportOnly); + if (row == topRow()) + rebuildOptions.setFlag(RebuildOption::CalculateNewTopLeftRow); + break; + } } return rebuildOptions; diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp index 5df5e5adcf..1d9e3761a2 100644 --- a/src/quick/items/qquicktextedit.cpp +++ b/src/quick/items/qquicktextedit.cpp @@ -2359,6 +2359,14 @@ void QQuickTextEdit::q_textChanged() d->determineHorizontalAlignment(); d->updateDefaultTextOption(); updateSize(); + + markDirtyNodesForRange(0, d->document->characterCount(), 0); + polish(); + if (isComponentComplete()) { + d->updateType = QQuickTextEditPrivate::UpdatePaintNode; + update(); + } + emit textChanged(); } |