this QLineEdit descendent implements a validating edit field that allows to enter floating point numbers with a possibly defined range
More...
#include <jkqtedoubleedit.h>
this QLineEdit descendent implements a validating edit field that allows to enter floating point numbers with a possibly defined range
This widget supports this set of features:
- This widget accepts input in standard and scientific notation.
- The widget can optionally check (and correct) the edit range. Checking can be switched for the upper and lower bound indepently!
- The maximal number of decimals may be set using setDecimals().
- Note
- Note that trailing 0s are deleted from the string.
- This widget accepts comma and point as decimal separator and transforms them to the systems decimal separator, set in the current locale.
- This widget colors the background of the widget if the number you entered exceeds the range. In that case the edit corrects the value when it looses its focus. The error background color may be set by setErrorBackgroundColor().
- It is also possible to extend the default context menu with new QAction's by calling addContextmenuAction(), deleteContextmenuAction() and clearContextmenuActions().
- This widget may also be used to catch key events. You will have to register each event using addKeyEvent(). If a key event matches, the keyEvent() signal will be emitted.
Screenshot:
Basic usage is simple:
◆ JKQTEDoubleEdit()
| JKQTEDoubleEdit::JKQTEDoubleEdit |
( |
QWidget * |
parent | ) |
|
◆ ~JKQTEDoubleEdit()
| virtual JKQTEDoubleEdit::~JKQTEDoubleEdit |
( |
| ) |
|
|
virtual |
◆ addContextmenuAction()
| void JKQTEDoubleEdit::addContextmenuAction |
( |
QAction * |
menuAction | ) |
|
add a new QAction to the default context menu (append after a seprator)
◆ addKeyEvent()
| void JKQTEDoubleEdit::addKeyEvent |
( |
int |
key, |
|
|
Qt::KeyboardModifiers |
modifiers |
|
) |
| |
◆ backgroundColor()
| QColor JKQTEDoubleEdit::backgroundColor |
( |
| ) |
const |
color for the widget's background
◆ checkMaximum()
| bool JKQTEDoubleEdit::checkMaximum |
( |
| ) |
const |
returns whether the range maximum is checked
◆ checkMinimum()
| bool JKQTEDoubleEdit::checkMinimum |
( |
| ) |
const |
returns whether the range minimum is checked
◆ clearContextmenuActions()
| void JKQTEDoubleEdit::clearContextmenuActions |
( |
| ) |
|
remove all additional context menu QAction s
◆ contextMenuEvent()
| virtual void JKQTEDoubleEdit::contextMenuEvent |
( |
QContextMenuEvent * |
event | ) |
|
|
protectedvirtual |
◆ decimals()
| int JKQTEDoubleEdit::decimals |
( |
| ) |
const |
returns the number of displayed decimals
◆ deleteContextmenuAction()
| void JKQTEDoubleEdit::deleteContextmenuAction |
( |
QAction * |
menuAction | ) |
|
◆ errorBackgroundColor()
| QColor JKQTEDoubleEdit::errorBackgroundColor |
( |
| ) |
const |
background color used when an entry error occured (unparseable string)
◆ focusOut
| void JKQTEDoubleEdit::focusOut |
( |
double |
value | ) |
|
|
signal |
emitted when the widget looses focus
◆ focusOutEvent
| virtual void JKQTEDoubleEdit::focusOutEvent |
( |
QFocusEvent * |
event | ) |
|
|
protectedvirtualslot |
◆ increment()
| double JKQTEDoubleEdit::increment |
( |
| ) |
const |
increment, when using the buttons or up/down keys
◆ isIntegerWidget()
| bool JKQTEDoubleEdit::isIntegerWidget |
( |
| ) |
const |
is integer edit mode en-/disable (only integer numbers are allowed, i.e. no decimals!)
◆ keyEventMatches
| void JKQTEDoubleEdit::keyEventMatches |
( |
int |
key, |
|
|
Qt::KeyboardModifiers |
modifiers |
|
) |
| |
|
signal |
emitted when a key event matches
◆ keyPressEvent
| virtual void JKQTEDoubleEdit::keyPressEvent |
( |
QKeyEvent * |
event | ) |
|
|
protectedvirtualslot |
◆ maximum()
| double JKQTEDoubleEdit::maximum |
( |
| ) |
const |
maximum of the value range
◆ minimum()
| double JKQTEDoubleEdit::minimum |
( |
| ) |
const |
minimum of the value range
◆ noIntegerBackgroundColor()
| QColor JKQTEDoubleEdit::noIntegerBackgroundColor |
( |
| ) |
const |
background color used when an setIntegerWidget(true), but the entered number is no integer
◆ resizeEvent
| virtual void JKQTEDoubleEdit::resizeEvent |
( |
QResizeEvent * |
event | ) |
|
|
protectedvirtualslot |
◆ setBackgroundColor
| void JKQTEDoubleEdit::setBackgroundColor |
( |
const QColor & |
color | ) |
|
|
slot |
color for the widget's background
◆ setCheckBounds
| void JKQTEDoubleEdit::setCheckBounds |
( |
bool |
min, |
|
|
bool |
max |
|
) |
| |
|
slot |
sets which bounds of the range to checked
◆ setCheckMaximum
| void JKQTEDoubleEdit::setCheckMaximum |
( |
bool |
check | ) |
|
|
slot |
sets whether the range maximum is checked
◆ setCheckMinimum
| void JKQTEDoubleEdit::setCheckMinimum |
( |
bool |
check | ) |
|
|
slot |
sets whether the range minimum is checked
◆ setDecimals
| void JKQTEDoubleEdit::setDecimals |
( |
int |
decimals | ) |
|
|
slot |
set the number of displayed decimals
◆ setErrorBackgroundColor
| void JKQTEDoubleEdit::setErrorBackgroundColor |
( |
const QColor & |
color | ) |
|
|
slot |
background color used when an entry error occured (unparseable string)
◆ setIncrement
| void JKQTEDoubleEdit::setIncrement |
( |
double |
inc | ) |
|
|
slot |
increment, when using the buttons or up/down keys
◆ setIntegerWidget
| void JKQTEDoubleEdit::setIntegerWidget |
( |
bool |
intWidget | ) |
|
|
slot |
en-/disable integer edit mode (only integer numbers are allowed, i.e. no decimals!)
◆ setMaximum
| void JKQTEDoubleEdit::setMaximum |
( |
double |
value | ) |
|
|
slot |
maximum of the value range, also calls setCheckMaximum(true)
◆ setMinimum
| void JKQTEDoubleEdit::setMinimum |
( |
double |
value | ) |
|
|
slot |
minimum of the value range, also calls setCheckMinimum(true)
◆ setNoIntegerBackgroundColor
| void JKQTEDoubleEdit::setNoIntegerBackgroundColor |
( |
const QColor & |
noIntegerBackgroundColor | ) |
|
|
slot |
background color used when an setIntegerWidget(true), but the entered number is no integer
◆ setRange
| void JKQTEDoubleEdit::setRange |
( |
double |
min, |
|
|
double |
max |
|
) |
| |
|
slot |
set the value range, also calls setCheckMaximum(true) and setCheckMinimum(true)
◆ setShowUpDown
| void JKQTEDoubleEdit::setShowUpDown |
( |
bool |
showUpDown | ) |
|
|
slot |
sets whether up/down buttons are shown
◆ setSingleStep
| void JKQTEDoubleEdit::setSingleStep |
( |
double |
inc | ) |
|
|
slot |
sets the single step increment (equivalent to setIncrement(inc) )
◆ setValidator()
| void JKQTEDoubleEdit::setValidator |
( |
const QValidator * |
validator | ) |
|
|
protected |
◆ setValue
| void JKQTEDoubleEdit::setValue |
( |
double |
value | ) |
|
|
slot |
set the value entered in this widget
◆ showUpDown()
| bool JKQTEDoubleEdit::showUpDown |
( |
| ) |
const |
are the up/down buttons shown?
◆ stepDown
| void JKQTEDoubleEdit::stepDown |
( |
| ) |
|
|
slot |
◆ stepUp
| void JKQTEDoubleEdit::stepUp |
( |
| ) |
|
|
slot |
◆ updateWidget
| void JKQTEDoubleEdit::updateWidget |
( |
const QString & |
text | ) |
|
|
protectedslot |
◆ value()
| double JKQTEDoubleEdit::value |
( |
| ) |
const |
return the value entered in this widget
◆ valueChanged
| void JKQTEDoubleEdit::valueChanged |
( |
double |
value | ) |
|
|
signal |
emited whenever a entered value changed
◆ wheelEvent
| virtual void JKQTEDoubleEdit::wheelEvent |
( |
QWheelEvent * |
event | ) |
|
|
protectedvirtualslot |
◆ JKDoubleEdit_BASIC_REGEXP
| QString JKQTEDoubleEdit::JKDoubleEdit_BASIC_REGEXP |
|
protected |
◆ m_background
| QColor JKQTEDoubleEdit::m_background |
|
protected |
◆ m_btnDown
| QToolButton* JKQTEDoubleEdit::m_btnDown |
|
protected |
◆ m_btnUp
| QToolButton* JKQTEDoubleEdit::m_btnUp |
|
protected |
◆ m_checkMaximum
| bool JKQTEDoubleEdit::m_checkMaximum |
|
protected |
◆ m_checkMinimum
| bool JKQTEDoubleEdit::m_checkMinimum |
|
protected |
◆ m_contextmenuActions
| QList<QAction*> JKQTEDoubleEdit::m_contextmenuActions |
|
protected |
list of additional actions for context menu
◆ m_current
| double JKQTEDoubleEdit::m_current |
|
protected |
◆ m_decimals
| int JKQTEDoubleEdit::m_decimals |
|
protected |
◆ m_errorColor
| QColor JKQTEDoubleEdit::m_errorColor |
|
protected |
◆ m_increment
| double JKQTEDoubleEdit::m_increment |
|
protected |
◆ m_Integer
| bool JKQTEDoubleEdit::m_Integer |
|
protected |
◆ m_keyEvents
| QList<QPair<int, Qt::KeyboardModifiers> > JKQTEDoubleEdit::m_keyEvents |
|
protected |
used to store the key events
◆ m_maximum
| double JKQTEDoubleEdit::m_maximum |
|
protected |
◆ m_minimum
| double JKQTEDoubleEdit::m_minimum |
|
protected |
◆ m_noIntegerBackgroundColor
| QColor JKQTEDoubleEdit::m_noIntegerBackgroundColor |
|
protected |
◆ m_regexp
| QRegExp JKQTEDoubleEdit::m_regexp |
|
protected |
regular expression used to match floating point numbers
◆ m_showUpDown
| bool JKQTEDoubleEdit::m_showUpDown |
|
protected |
◆ m_validator
| QRegExpValidator* JKQTEDoubleEdit::m_validator |
|
protected |
RegExp validator for this widget.
◆ backgroundColor
| QColor JKQTEDoubleEdit::backgroundColor |
|
readwrite |
◆ checkMaximum
| bool JKQTEDoubleEdit::checkMaximum |
|
readwrite |
◆ checkMinimum
| bool JKQTEDoubleEdit::checkMinimum |
|
readwrite |
◆ decimals
| int JKQTEDoubleEdit::decimals |
|
readwrite |
◆ errorBackgroundColor
| QColor JKQTEDoubleEdit::errorBackgroundColor |
|
readwrite |
◆ increment
| double JKQTEDoubleEdit::increment |
|
readwrite |
◆ integerWidget
| bool JKQTEDoubleEdit::integerWidget |
|
readwrite |
◆ maximum
| double JKQTEDoubleEdit::maximum |
|
readwrite |
◆ minimum
| double JKQTEDoubleEdit::minimum |
|
readwrite |
◆ noIntegerBackgroundColor
| QColor JKQTEDoubleEdit::noIntegerBackgroundColor |
|
readwrite |
◆ showUpDown
| bool JKQTEDoubleEdit::showUpDown |
|
readwrite |
◆ value
| double JKQTEDoubleEdit::value |
|
readwrite |
The documentation for this class was generated from the following file: