SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
qtLineEdit subclass that supports a low precision view when inactive More...
#include <qtDoubleLineEdit.h>
Classes | |
class | qtInternals |
Public Types | |
enum | RealNumberNotation { MixedNotation = 0, ScientificNotation, FixedNotation } |
This enum specifies which notations to use for displaying the value. | |
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... | |
![]() | |
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). | |
Public Member Functions | |
qtDoubleLineEdit (QWidget *parent=nullptr) | |
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 qtDoubleLineEdit 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... | |
![]() | |
qtLineEdit (QWidget *parent=nullptr) | |
qtLineEdit (const QString &contents, QWidget *parent=nullptr) | |
bool | resetCursorPositionOnEditingFinished () const |
To enable/disable whether the cursor position is reset to 0 after editingFinished() is fired, use the resetCursorPositionOnEditingFinished property (default: true). | |
Static Public Member Functions | |
static void | setGlobalPrecisionAndNotation (int precision, RealNumberNotation notation) |
Get/set the global precision and notation. More... | |
static int | globalPrecision () |
static RealNumberNotation | globalNotation () |
static QString | formatDouble (double value, QTextStream::RealNumberNotation notation, int precision) |
Return a double formatted according to a QTextStream::RealNumberNotation and number of digits of precision. | |
static QString | formatDouble (double value, qtDoubleLineEdit::RealNumberNotation notation, int precision) |
static QString | formatDoubleUsingGlobalPrecisionAndNotation (double value) |
Return a double formatted according to the values set for global precision and notation. | |
Protected Member Functions | |
void | paintEvent (QPaintEvent *evt) override |
void | resizeEvent (QResizeEvent *event) override |
![]() | |
void | triggerTextChangedAndEditingFinished () |
this is called by qtLineEditEventPlayer during event playback to ensure that the textChangedAndEditingFinished() signal is fired when text is changed using setText() in playback. | |
Properties | |
RealNumberNotation | notation |
int | precision |
bool | useGlobalPrecisionAndNotation |
![]() | |
QString | text2 |
bool | resetCursorPositionOnEditingFinished |
Additional Inherited Members | |
![]() | |
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. | |
qtLineEdit subclass that supports a low precision view when inactive
qtDoubleLineEdit 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 qtDoubleLineEdit instance. Additionally, qtDoubleLineEdit can be configure to simply respect a global precision and notation specification by using the property useGlobalPrecisionAndNotation
(which is default).
Since qtDoubleLineEdit is intended for numeric values, in its constructor, a QDoubleValidator
is created for convenience.
This is from ParaView's pqDoubleLineEdit class. Changes pqInternals -> qtInternals and the class uses the smtk::extension namespace
RealNumberNotation smtk::extension::qtDoubleLineEdit::notation | ( | ) | const |
Return the notation used to display the number.
int smtk::extension::qtDoubleLineEdit::precision | ( | ) | const |
Return the precision used to display the number.
|
static |
Get/set the global precision and notation.
All qtDoubleLineEdit instances that have useGlobalPrecisionAndNotation
property set to true will automatically respect the state set on the global variables.
|
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.
QString qtDoubleLineEdit::simplifiedText | ( | ) | const |
Returns the text being shown when the widget is not active or under mouse pointer.
Primarily intended for test or debugging purposes.
bool smtk::extension::qtDoubleLineEdit::useGlobalPrecisionAndNotation | ( | ) | const |
useGlobalPrecisionAndNotation
indicates if the qtDoubleLineEdit should use global precision and notation values instead of the parameters specified on this instance.
Default is true.