Details
-
Suggestion
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
None
-
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
- relates to
-
QTBUG-59654 Spinbox selection with multicharacter suffix/prefix
-
- Reported
-
-
QTBUG-50363 Document the constraints of ComboBox's model property
-
- Open
-
-
QTBUG-22480 QScientificSpinBox for scientific notation in QDoubleSpinBox ?
-
- Reported
-
-
QTBUG-81984 qchart axis enhancement
-
- Reported
-