pqLineEdit subclass that supports a low precision view when inactive More...
#include <pqDoubleLineEdit.h>
Public Types | |
enum | RealNumberNotation { MixedNotation = 0, ScientificNotation, FixedNotation, FullNotation } |
This enum specifies which notations to use for displaying the value. More... | |
Public Slots | |
void | setNotation (RealNumberNotation _notation) |
Set the notation used to display the number. More... | |
void | setPrecision (int precision) |
Set the precision used to display the number. More... | |
void | setUseGlobalPrecisionAndNotation (bool value) |
Set whether to use global precision and notation values. More... | |
Public Slots inherited from pqLineEdit | |
void | setTextAndResetCursor (const QString &text) |
Same as QLineEdit::setText() except that it reset the cursor position to 0. More... | |
void | setResetCursorPositionOnEditingFinished (bool val) |
To enable/disable whether the cursor position is reset to 0 after editingFinished() is fired, use the resetCursorPositionOnEditingFinished property (default: true). More... | |
Public Member Functions | |
pqDoubleLineEdit (QWidget *parent=nullptr) | |
~pqDoubleLineEdit () override | |
RealNumberNotation | notation () const |
Return the notation used to display the number. More... | |
int | precision () const |
Return the precision used to display the number. More... | |
bool | useGlobalPrecisionAndNotation () const |
useGlobalPrecisionAndNotation indicates if the pqDoubleLineEdit should use global precision and notation values instead of the parameters specified on this instance. More... | |
QString | simplifiedText () const |
Returns the text being shown when the widget is not active or under mouse pointer. More... | |
Public Member Functions inherited from pqLineEdit | |
pqLineEdit (QWidget *parent=nullptr) | |
pqLineEdit (const QString &contents, QWidget *parent=nullptr) | |
~pqLineEdit () override | |
bool | resetCursorPositionOnEditingFinished () const |
To enable/disable whether the cursor position is reset to 0 after editingFinished() is fired, use the resetCursorPositionOnEditingFinished property (default: true). More... | |
Static Public Member Functions | |
static QString | formatDouble (double value, pqDoubleLineEdit::RealNumberNotation notation, int precision, int fullLowExponent=-6, int fullHighExponent=20) |
Return a double formatted according to a pqDoubleLineEdit::RealNumberNotation notation and a number of digits of precision. More... | |
static void | setGlobalPrecisionAndNotation (int precision, RealNumberNotation notation) |
Get/set the global precision and notation. More... | |
static int | globalPrecision () |
Get/set the global precision and notation. More... | |
static RealNumberNotation | globalNotation () |
Get/set the global precision and notation. More... | |
Protected Member Functions | |
void | paintEvent (QPaintEvent *evt) override |
void | resizeEvent (QResizeEvent *event) override |
Protected Member Functions inherited from pqLineEdit | |
void | triggerTextChangedAndEditingFinished () |
this is called by pqLineEditEventPlayer during event playback to ensure that the textChangedAndEditingFinished() signal is fired when text is changed using setText() in playback. More... | |
void | focusInEvent (QFocusEvent *event) override |
Properties | |
RealNumberNotation | notation |
int | precision |
bool | useGlobalPrecisionAndNotation |
Properties inherited from pqLineEdit | |
QString | text2 |
bool | resetCursorPositionOnEditingFinished |
Additional Inherited Members | |
Signals inherited from pqLineEdit | |
void | textChangedAndEditingFinished () |
Unlike QLineEdit::editingFinished() which gets fired whenever the widget looses focus irrespective of if the text actually was edited, textChangedAndEditingFinished() is fired only when the text was changed as well. More... | |
void | blank () |
This signal is never fired. More... | |
pqLineEdit subclass that supports a low precision view when inactive
pqDoubleLineEdit allows to edit a real number in full precision and display a simplified version when the widget is not in focus or under mouse pointer.
The precision and notation associated with the displayed number can be configured using the precision
and notation
properties on the pqDoubleLineEdit instance. Additionally, pqDoubleLineEdit can be configure to simply respect a global precision and notation specification by using the property useGlobalPrecisionAndNotation
(which is default).
When using FullNotation, the displayed text logic is deactivated and the user will be able to see the value that they will edit directly.
Since pqDoubleLineEdit is intended for numeric values, in its constructor, a QDoubleValidator
is created for convenience.
Definition at line 35 of file pqDoubleLineEdit.h.
This enum specifies which notations to use for displaying the value.
Enumerator | |
---|---|
MixedNotation | |
ScientificNotation | |
FixedNotation | |
FullNotation |
Definition at line 52 of file pqDoubleLineEdit.h.
pqDoubleLineEdit::pqDoubleLineEdit | ( | QWidget * | parent = nullptr | ) |
|
override |
RealNumberNotation pqDoubleLineEdit::notation | ( | ) | const |
Return the notation used to display the number.
int pqDoubleLineEdit::precision | ( | ) | const |
Return the precision used to display the number.
bool pqDoubleLineEdit::useGlobalPrecisionAndNotation | ( | ) | const |
useGlobalPrecisionAndNotation
indicates if the pqDoubleLineEdit should use global precision and notation values instead of the parameters specified on this instance.
Default is true.
|
static |
Get/set the global precision and notation.
All pqDoubleLineEdit instances that have useGlobalPrecisionAndNotation
property set to true will automatically respect the state set on the global variables.
|
static |
Get/set the global precision and notation.
All pqDoubleLineEdit instances that have useGlobalPrecisionAndNotation
property set to true will automatically respect the state set on the global variables.
|
static |
Get/set the global precision and notation.
All pqDoubleLineEdit instances that have useGlobalPrecisionAndNotation
property set to true will automatically respect the state set on the global variables.
QString pqDoubleLineEdit::simplifiedText | ( | ) | const |
Returns the text being shown when the widget is not active or under mouse pointer.
Primarily intended for test or debugging purposes.
|
static |
Return a double formatted according to a pqDoubleLineEdit::RealNumberNotation notation and a number of digits of precision.
Supports QLocale::FloatingPointShortest as precision. When using pqDoubleLineEdit::RealNumberNotation::FullNotation, precision is not used and fullLowExponent and fullHighExponent will be used to determine when to switch between scientific notation and fixed notation.
|
slot |
Set the notation used to display the number.
|
slot |
Set the precision used to display the number.
|
slot |
Set whether to use global precision and notation values.
Default is true.
|
overrideprotected |
|
overrideprotected |
|
readwrite |
Definition at line 39 of file pqDoubleLineEdit.h.
|
readwrite |
Definition at line 40 of file pqDoubleLineEdit.h.
|
readwrite |
Definition at line 42 of file pqDoubleLineEdit.h.