maxLibQt
|
MLDoubleSpinBox is a drop-in replacement for QtQuick Controls 2 SpinBox which can handle double-precision numbers and long integers. More...
Inherits Control.
Inherited by maxLibQt::controls::MLHexSpinBox.
Properties | |
bool | acceptableInput |
Indicates if input is valid (it would be nicer if the validator would expose an "isValid" prop/method!). More... | |
real | botValue |
The effective minimum value. More... | |
int | buttonRepeatDelay |
Milliseconds to delay before held +/- button repeat is activated. More... | |
int | buttonRepeatInterval |
+/- button repeat interval while held (in milliseconds). More... | |
string | cleanText |
Holds the text of the spin box excluding any prefix, suffix, or leading or trailing whitespace. More... | |
int | decimals |
Desired precision. More... | |
string | displayText |
QtObject | doubleValidator |
Default numeric validator, strictly enforces notation type, does not allow for custom inputMask with non-numeric components. More... | |
bool | editable |
double | from |
string | inputMask |
Input mask for the text edit control (. More... | |
bool | inputMethodComposing |
int | inputMethodHints |
int | notation |
For validator and text formatting. More... | |
int | pageSteps |
How many steps in a "page" step (PAGE UP/DOWN keys or CTRL-Wheel). More... | |
string | prefix |
Optional string to display before the value. More... | |
QtObject | regExpValidator |
This is an experimental validator using a RegExp instead of numerical validation (which we do anyway). More... | |
bool | selectByMouse |
Whether to allow selection of text (bound to the text editor of the spinbox control). More... | |
bool | showGroupSeparator |
Whether to format numbers with the thousands separator visible (using current locale if useLocaleFormat is true). More... | |
SpinBox | spinBoxItem |
The SpinBox item. More... | |
double | stepSize |
string | suffix |
Optional string to display after the value. More... | |
Item | textInputItem |
Use the "native" text editor of the SpinBox to preserve look/feel. If you use a custom SpinBox, you may need to set this property also. If defined, it must have a text property. More... | |
double | to |
real | topValue |
The effective maximum value. More... | |
bool | trimExtraZeros |
Whether to remove trailing zeros from decimals. More... | |
bool | useLocaleFormat |
Whether to format numbers according to the current locale. More... | |
QtObject | validator |
There are 2 validators available, see notes for each below. More... | |
double | value |
bool | wrap |
Public Member Functions | |
void | decrease () |
Decrement value by one stepSize. More... | |
void | doubleValidationRegEx () |
Return a RegExp object to validate numeric entry according to the current formatting & locale specs and accounting for any prefix/suffix. More... | |
void | escapeInputMaskChars (string) |
Make string safe for use in Qt input mask as a literal. More... | |
void | escapeRegExpChars (string) |
Make string safe for use in RegExp as a literal. More... | |
void | getCleanText (text, locale) |
Return text stripped of any prefix or suffix and trimmed. More... | |
void | increase () |
Increment value by one stepSize. More... | |
bool | setValue (real newValue, bool noWrap, bool notModified) |
Set the spin box value to newValue . More... | |
void | stepBy (int steps, bool noWrap) |
Adjust value by number of steps . More... | |
void | textFromValue (value, locale) |
Reimplimented from SpinBox. More... | |
void | valueFromText (text, locale) |
Reimplimented from SpinBox. More... | |
Signals | |
void | valueModified () |
Mimic SpinBox API (interactive change only, NOT emitted if value property is set directly). More... | |
MLDoubleSpinBox is a drop-in replacement for QtQuick Controls 2 SpinBox which can handle double-precision numbers and long integers.
Supports SpinBox API of Controls v2.4 (Qt 5.11) but can be used with any version of QtQuick Controls 2 (Qt v5.2+).
The possible value range is defined by ECMAScript Number limits: +/- Number.MAX_VALUE
for reals and between Number.MIN_SAFE_INTEGER
and Number.MAX_SAFE_INTEGER
for integers. This includes being able to handle unsigned 32b ints, something the base SpinBox can't do.
It has mostly the same properties, methods, and signal as SpinBox, except the value/from/to/stepSize
properties are doubles. The only exception are the up
and down
group, which could be accessed directly via spinBoxItem. It also has a number of other custom properties not found in the default SpinBox (see inline documentation below).
Use the decimals property to control precision (default is 2).
In addition to the regular SpinBox controls (arrow keys/wheel-scroll), it reacts to Page Up/Down keys and CTRL-scroll for page-sized steps (see pageSteps property).
Individual property documentation can be found inline.
prefix
and suffix
properties, but it is not in an ideal way. Specifically, in an editable spin box, the cursor is not placed in the correct position for editing the actual value (user can start typing before/after/in middle of prefix/suffix). It does still work and will auto-correct properly after editing is finished, but it is a bit awkward at best. They do work nicely in a non-editable spin box.Definition at line 72 of file MLDoubleSpinBox.qml.
bool maxLibQt::controls::MLDoubleSpinBox::acceptableInput |
Indicates if input is valid (it would be nicer if the validator would expose an "isValid" prop/method!).
Definition at line 111 of file MLDoubleSpinBox.qml.
real maxLibQt::controls::MLDoubleSpinBox::botValue |
The effective minimum value.
Definition at line 115 of file MLDoubleSpinBox.qml.
int maxLibQt::controls::MLDoubleSpinBox::buttonRepeatDelay |
Milliseconds to delay before held +/- button repeat is activated.
Definition at line 106 of file MLDoubleSpinBox.qml.
int maxLibQt::controls::MLDoubleSpinBox::buttonRepeatInterval |
+/- button repeat interval while held (in milliseconds).
Definition at line 107 of file MLDoubleSpinBox.qml.
string maxLibQt::controls::MLDoubleSpinBox::cleanText |
Holds the text of the spin box excluding any prefix, suffix, or leading or trailing whitespace.
Definition at line 109 of file MLDoubleSpinBox.qml.
int maxLibQt::controls::MLDoubleSpinBox::decimals |
Desired precision.
Definition at line 96 of file MLDoubleSpinBox.qml.
string maxLibQt::controls::MLDoubleSpinBox::displayText |
Definition at line 91 of file MLDoubleSpinBox.qml.
QtObject maxLibQt::controls::MLDoubleSpinBox::doubleValidator |
Default numeric validator, strictly enforces notation
type, does not allow for custom inputMask
with non-numeric components.
Definition at line 124 of file MLDoubleSpinBox.qml.
bool maxLibQt::controls::MLDoubleSpinBox::editable |
Definition at line 83 of file MLDoubleSpinBox.qml.
double maxLibQt::controls::MLDoubleSpinBox::from |
Definition at line 77 of file MLDoubleSpinBox.qml.
string maxLibQt::controls::MLDoubleSpinBox::inputMask |
Input mask for the text edit control (.
Definition at line 98 of file MLDoubleSpinBox.qml.
bool maxLibQt::controls::MLDoubleSpinBox::inputMethodComposing |
Definition at line 94 of file MLDoubleSpinBox.qml.
int maxLibQt::controls::MLDoubleSpinBox::inputMethodHints |
Definition at line 88 of file MLDoubleSpinBox.qml.
int maxLibQt::controls::MLDoubleSpinBox::notation |
For validator and text formatting.
Definition at line 97 of file MLDoubleSpinBox.qml.
int maxLibQt::controls::MLDoubleSpinBox::pageSteps |
How many steps in a "page" step (PAGE UP/DOWN keys or CTRL-Wheel).
Definition at line 105 of file MLDoubleSpinBox.qml.
string maxLibQt::controls::MLDoubleSpinBox::prefix |
Optional string to display before the value.
See notes in the main comments above.
Definition at line 103 of file MLDoubleSpinBox.qml.
QtObject maxLibQt::controls::MLDoubleSpinBox::regExpValidator |
This is an experimental validator using a RegExp instead of numerical validation (which we do anyway).
The advantage of using it is that:
validator:
regExpValidator Definition at line 131 of file MLDoubleSpinBox.qml.
bool maxLibQt::controls::MLDoubleSpinBox::selectByMouse |
Whether to allow selection of text (bound to the text editor of the spinbox control).
Definition at line 99 of file MLDoubleSpinBox.qml.
bool maxLibQt::controls::MLDoubleSpinBox::showGroupSeparator |
Whether to format numbers with the thousands separator visible (using current locale if useLocaleFormat is true).
Definition at line 101 of file MLDoubleSpinBox.qml.
SpinBox maxLibQt::controls::MLDoubleSpinBox::spinBoxItem |
The SpinBox item.
To use a custom one, replace the contentItem
with a class derived from Controls 2.x SpinBox. Or use any other contentItem
(or even null) and (optionally) set the textInputItem to some Item with a text
property for a custom display.
Definition at line 119 of file MLDoubleSpinBox.qml.
double maxLibQt::controls::MLDoubleSpinBox::stepSize |
Definition at line 81 of file MLDoubleSpinBox.qml.
string maxLibQt::controls::MLDoubleSpinBox::suffix |
Optional string to display after the value.
See notes in the main comments above.
Definition at line 104 of file MLDoubleSpinBox.qml.
Item maxLibQt::controls::MLDoubleSpinBox::textInputItem |
Use the "native" text editor of the SpinBox to preserve look/feel. If you use a custom SpinBox, you may need to set this property also. If defined, it must have a text property.
Definition at line 121 of file MLDoubleSpinBox.qml.
double maxLibQt::controls::MLDoubleSpinBox::to |
Definition at line 79 of file MLDoubleSpinBox.qml.
real maxLibQt::controls::MLDoubleSpinBox::topValue |
The effective maximum value.
Definition at line 113 of file MLDoubleSpinBox.qml.
bool maxLibQt::controls::MLDoubleSpinBox::trimExtraZeros |
Whether to remove trailing zeros from decimals.
Definition at line 102 of file MLDoubleSpinBox.qml.
bool maxLibQt::controls::MLDoubleSpinBox::useLocaleFormat |
Whether to format numbers according to the current locale.
If false, use standard "C" format.
Definition at line 100 of file MLDoubleSpinBox.qml.
QtObject maxLibQt::controls::MLDoubleSpinBox::validator |
There are 2 validators available, see notes for each below.
Definition at line 86 of file MLDoubleSpinBox.qml.
double maxLibQt::controls::MLDoubleSpinBox::value |
Definition at line 75 of file MLDoubleSpinBox.qml.
bool maxLibQt::controls::MLDoubleSpinBox::wrap |
Definition at line 85 of file MLDoubleSpinBox.qml.
void maxLibQt::controls::MLDoubleSpinBox::decrease | ( | ) |
Decrement value by one stepSize.
void maxLibQt::controls::MLDoubleSpinBox::doubleValidationRegEx | ( | ) |
Return a RegExp object to validate numeric entry according to the current formatting & locale specs and accounting for any prefix/suffix.
void maxLibQt::controls::MLDoubleSpinBox::escapeInputMaskChars | ( | string | ) |
Make string
safe for use in Qt input mask as a literal.
void maxLibQt::controls::MLDoubleSpinBox::escapeRegExpChars | ( | string | ) |
Make string
safe for use in RegExp as a literal.
void maxLibQt::controls::MLDoubleSpinBox::getCleanText | ( | text | , |
locale | |||
) |
Return text
stripped of any prefix or suffix and trimmed.
Same as cleanText property. Called by valueFromText() before other cleanup operations. Could be reimplemented for custom replacements.
void maxLibQt::controls::MLDoubleSpinBox::increase | ( | ) |
Increment value by one stepSize.
bool maxLibQt::controls::MLDoubleSpinBox::setValue | ( | real | newValue, |
bool | noWrap, | ||
bool | notModified | ||
) |
Set the spin box value to newValue
.
This is generally preferable to setting the value spin box property directly, but not required.
newValue | The value to set. |
noWrap | (optional) If true will prevent wrapping even if the spin box wrap property is true. Default is false. |
notModified | (optional) If true will prevent the valueModified() signal from being emitted. Default is false. |
void maxLibQt::controls::MLDoubleSpinBox::stepBy | ( | int | steps, |
bool | noWrap | ||
) |
void maxLibQt::controls::MLDoubleSpinBox::textFromValue | ( | value | , |
locale | |||
) |
Reimplimented from SpinBox.
void maxLibQt::controls::MLDoubleSpinBox::valueFromText | ( | text | , |
locale | |||
) |
Reimplimented from SpinBox.
|
signal |
Mimic SpinBox API (interactive change only, NOT emitted if value property is set directly).