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

64-bit support for QAbstractSlider/QScrollbar

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P4: Low
    • None
    • None
    • All

    Description

      QScrollbars are limited to 32-bits, and for a lot of reasons, this makes sense. As noted in the documentation:

      QScrollBar only provides integer ranges. Note that although QScrollBar handles very large numbers, scroll bars on current screens cannot usefully represent ranges above about 100,000 pixels. Beyond that, it becomes difficult for the user to control the slider using either the keyboard or the mouse, and the scroll arrows will have limited use.

      {/quote}

      I completely agree.

      However... there are some edge case reasons where I think it makes sense to expand the range of the widget to a full 64-bits.

      My use case is a text editor, and while no one is asking to support exabyte files, I *DO *have users who want to be able to open files in the 2GB-5GB range (think machine generated files). For degenerate cases where there are a lot of short lines, files of this size would exceed the range of Qt's scrollbars.

      Also, my application uses 64-bit integers essentially everywhere internally, so in principle, it can handle such files just fine... except for when I want to display them, I end up having to do range checks and casts all over the place just to update things like the scrollbars.

      So because the scrollbars use 32-bit integers, I have essentially forced to only support opening 2GB files and have to use casts in a lot of places.

      The "solution" I am currently considering is to abandon using QAbstractScrollArea, and basically, custom making my own, with my own custom scrollbars... Not exactly ideal, but I think if I want 64-bit scrollbar range, I essentially have no choice.

      Honestly, I'm not sure what the downside to supporting 64-bit ranges is aside from an ABI break (which I certainly hope is addressable, especially when planning a new major release).

      From an API level perspective, it seems that most code should "just work" with an expanded range, with the only exception being any code that inherits from QAbstractSlider and family would need to update their overloads, signals, and slots.

      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
            evan.teran Evan Teran
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes