Public Types | Public Slots | Public Member Functions | Static Public Member Functions | Protected Member Functions | Properties | List of all members
pqDoubleLineEdit Class Reference

pqLineEdit subclass that supports a low precision view when inactive More...

#include <pqDoubleLineEdit.h>

Inheritance diagram for pqDoubleLineEdit:
Inheritance graph
[legend]
Collaboration diagram for pqDoubleLineEdit:
Collaboration graph
[legend]

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...
 
void setAlwaysUseFullPrecision (bool value)
 Set whether to always render at full precision. 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, QTextStream::RealNumberNotation notation, int precision)
 Return a double formatted according to a QTextStream::RealNumberNotation and number of digits of precision. More...
 
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 QString formatDoubleUsingGlobalPrecisionAndNotation (double value)
 Return a double formatted according to the values set for global precision and notation. 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...
 

Detailed Description

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 37 of file pqDoubleLineEdit.h.

Member Enumeration Documentation

◆ RealNumberNotation

This enum specifies which notations to use for displaying the value.

Enumerator
MixedNotation 
ScientificNotation 
FixedNotation 
FullNotation 

Definition at line 54 of file pqDoubleLineEdit.h.

Constructor & Destructor Documentation

◆ pqDoubleLineEdit()

pqDoubleLineEdit::pqDoubleLineEdit ( QWidget *  parent = nullptr)

◆ ~pqDoubleLineEdit()

pqDoubleLineEdit::~pqDoubleLineEdit ( )
override

Member Function Documentation

◆ notation()

RealNumberNotation pqDoubleLineEdit::notation ( ) const

Return the notation used to display the number.

See also
setNotation()

◆ precision()

int pqDoubleLineEdit::precision ( ) const

Return the precision used to display the number.

See also
setPrecision()

◆ useGlobalPrecisionAndNotation()

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.

◆ setGlobalPrecisionAndNotation()

static void pqDoubleLineEdit::setGlobalPrecisionAndNotation ( int  precision,
RealNumberNotation  notation 
)
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.

◆ globalPrecision()

static int pqDoubleLineEdit::globalPrecision ( )
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.

◆ globalNotation()

static RealNumberNotation pqDoubleLineEdit::globalNotation ( )
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.

◆ simplifiedText()

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.

◆ formatDouble() [1/2]

static QString pqDoubleLineEdit::formatDouble ( double  value,
QTextStream::RealNumberNotation  notation,
int  precision 
)
static

Return a double formatted according to a QTextStream::RealNumberNotation and number of digits of precision.

Deprecated:
deprecated in favor of pqDoubleLineEdit::formatDouble(double,pqDoubleLineEdit::RealNumberNotation,int)

◆ formatDouble() [2/2]

static QString pqDoubleLineEdit::formatDouble ( double  value,
pqDoubleLineEdit::RealNumberNotation  notation,
int  precision,
int  fullLowExponent = -6,
int  fullHighExponent = 20 
)
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.

◆ formatDoubleUsingGlobalPrecisionAndNotation()

static QString pqDoubleLineEdit::formatDoubleUsingGlobalPrecisionAndNotation ( double  value)
static

Return a double formatted according to the values set for global precision and notation.

◆ setNotation

void pqDoubleLineEdit::setNotation ( RealNumberNotation  _notation)
slot

Set the notation used to display the number.

See also
notation()

◆ setPrecision

void pqDoubleLineEdit::setPrecision ( int  precision)
slot

Set the precision used to display the number.

See also
precision()

◆ setUseGlobalPrecisionAndNotation

void pqDoubleLineEdit::setUseGlobalPrecisionAndNotation ( bool  value)
slot

Set whether to use global precision and notation values.

Default is true.

See also
useGlobalPrecisionAndNotation()

◆ setAlwaysUseFullPrecision

void pqDoubleLineEdit::setAlwaysUseFullPrecision ( bool  value)
slot

Set whether to always render at full precision.

◆ paintEvent()

void pqDoubleLineEdit::paintEvent ( QPaintEvent *  evt)
overrideprotected

◆ resizeEvent()

void pqDoubleLineEdit::resizeEvent ( QResizeEvent *  event)
overrideprotected

Property Documentation

◆ notation

RealNumberNotation pqDoubleLineEdit::notation
readwrite

Definition at line 41 of file pqDoubleLineEdit.h.

◆ precision

int pqDoubleLineEdit::precision
readwrite

Definition at line 42 of file pqDoubleLineEdit.h.

◆ useGlobalPrecisionAndNotation

bool pqDoubleLineEdit::useGlobalPrecisionAndNotation
readwrite

Definition at line 44 of file pqDoubleLineEdit.h.


The documentation for this class was generated from the following file: