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

Add a reusable model for zoom levels in QComboBox / ComboBox

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • None
    • Core: Item Models
    • None

    Description

      qtwebengine/examples/pdfwidgets/pdfviewer/zoomselector(.cpp / .h) looks silly to me: a subclass of QComboBox that only populates some strings in itself.  It also got duplicated in https://codereview.qt-project.org/c/qt/qtdoc/+/456602 in the qtdoc repo.  But we have QComboBox::setModel() for that.  But creating an application-specific model would also tend to feel like donkey work, since the idea of setting zoom levels comes up over and over in many applications.

      The zoom levels that you want to offer tend to follow various formulas for "nice numbers".  So we should make that configurable somehow in this new QZoomLevelModel class.  Plus you might want common options like "zoom to fit", "zoom to fit width", "zoom to fit height" and whatever else; so we could have a flags property for those, and thus we are also providing a place to have the translated strings for those, so that the application doesn't need to bother with it.

      We should also make sure it works with ComboBox in Qt Quick Controls (although it's already easier in QML, you can usually avoid having a C++ model).  This class could be exposed to QML in QtQml.Models.

      Attachments

        Issue Links

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

          Activity

            People

              srutledg Shawn Rutledge
              srutledg Shawn Rutledge
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes