Skip to content

Commit 601ff11

Browse files
mitchcurtisQt Cherry-pick Bot
authored andcommitted
Views: use isNull for zero-size checks rather than isEmpty
QSizeF::isEmpty returns true if either dimension is negative, but according to tst_QQuickListView::resizeView, we support negative-sized views. Amends 37c25c6. Change-Id: If860cd5a459adf75470e5fc2deba3967b2e66366 Reviewed-by: Richard Moe Gustavsen <[email protected]> (cherry picked from commit e646626) Reviewed-by: Qt Cherry-pick Bot <[email protected]> (cherry picked from commit 4c0df79) (cherry picked from commit f17ba18)
1 parent 7f41a13 commit 601ff11

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/quick/items/qquickgridview.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2402,7 +2402,7 @@ bool QQuickGridViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch
24022402
{
24032403
Q_Q(QQuickGridView);
24042404

2405-
if (q->size().isEmpty())
2405+
if (q->size().isNull())
24062406
return false;
24072407

24082408
int modelIndex = change.index;

src/quick/items/qquickitemview.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1760,7 +1760,7 @@ void QQuickItemViewPrivate::refill(qreal from, qreal to)
17601760
Q_Q(QQuickItemView);
17611761
if (!model || !model->isValid() || !q->isComponentComplete())
17621762
return;
1763-
if (q->size().isEmpty() && visibleItems.isEmpty())
1763+
if (q->size().isNull() && visibleItems.isEmpty())
17641764
return;
17651765
if (!model->count()) {
17661766
updateHeader();

src/quick/items/qquicklistview.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3658,7 +3658,7 @@ bool QQuickListViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch
36583658
int modelIndex = change.index;
36593659
int count = change.count;
36603660

3661-
if (q->size().isEmpty() && visibleItems.isEmpty())
3661+
if (q->size().isNull() && visibleItems.isEmpty())
36623662
return false;
36633663

36643664
qreal tempPos = isContentFlowReversed() ? -position()-size() : position();

0 commit comments

Comments
 (0)