Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-36049

Flickable's heightRatio can be NaN, inf or -inf

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4: Low
    • None
    • 5.2.1
    • None

    Description

      I have a Flickable with contentHeight explicitely set to the contents' size. If the contents are empty, it gets set to zero.

      This causes visibleArea.heightRatio to be changed to NaN, +inf or -inf because of the N/0 or 0/0 unchecked divisions inside QQuickFlickableVisibleArea::updateVisible:

          const qreal viewheight = flickable->height();
          const qreal maxyextent = -flickable->maxYExtent() + flickable->minYExtent();
          qreal pagePos = (-p->vData.move.value() + flickable->minYExtent()) / (maxyextent + viewheight);
          qreal pageSize = viewheight / (maxyextent + viewheight);
      

      If viewheight and maxyextent are both zero, this is a NaN. If they have the same nonzero value with opposite sign, this is a +inf/-inf.

      The docs instead say that the ratio should be clamped to the 0.0-1.0 range.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            peppe Giuseppe D'Angelo
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes