KNumberModel Class
Creates a model of entries from N to M with rows at a given interval. More...
- Header:
#include <KNumberModel> - CMake:
find_package(KF6 REQUIRED COMPONENTS ItemModels)
target_link_libraries(mytarget PRIVATE KF6::ItemModels) - Inherits: QAbstractListModel
List of all members, including inherited members
Public Types
Properties
- formattingOptions : QLocale::NumberOptions
- maximumValue : qreal
- minimumValue : qreal
- stepSize : qreal
Public Functions
Detailed Description
The model contains two roles:
- display - the number represented as a string
- value - the actual value as a number
Member Type Documentation
enum KNumberModel::Roles
| Constant | |
|---|---|
KNumberModel::DisplayRole |
Qt::DisplayRole |
KNumberModel::ValueRole |
Qt::UserRole |
Property Documentation
formattingOptions : QLocale::NumberOptions
Defines the string representation of the number, e.g. "1,000" or "1000".
Default is QLocale::Default.
Access functions:
QLocale::NumberOptionsformattingOptions() constvoidsetFormattingOptions(QLocale::NumberOptionsoptions)
Notifier signal:
voidformattingOptionsChanged()
maximumValue : qreal
The maximum value for the model
The default value is 0.0.
Note: If
maximumValueis a multiple ofstepSizeadded tominimumValueit will be included. Otherwise it will not be reached. E.g. in a model with aminimumValueof 0.0, amaximumValueof 1.0 and astepSizeof 0.3, the final row will be 0.9.
Access functions:
qrealmaximumValue() constvoidsetMaximumValue(qrealmaximumValue)
Notifier signal:
voidmaximumValueChanged()
minimumValue : qreal
The minimum value for the model
The default value is 0.0.
Access functions:
qrealminimumValue() constvoidsetMinimumValue(qrealminimumValue)
Notifier signal:
voidminimumValueChanged()
stepSize : qreal
Step between listed entries
The default value is 1.0.
Access functions:
qrealstepSize() constvoidsetStepSize(qrealstepSize)
Notifier signal:
voidstepSizeChanged()
Member Function Documentation
[explicit] KNumberModel::KNumberModel(QObject *parent = nullptr)
qreal KNumberModel::value(const QModelIndex &index) const
Returns the value represented at the given index.