SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Classes | Public Types | Public Slots | Public Member Functions | Static Public Member Functions | Protected Member Functions | Properties | List of all members
smtk::extension::qtDoubleLineEdit Class Reference

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

#include <qtDoubleLineEdit.h>

Inheritance diagram for smtk::extension::qtDoubleLineEdit:
[legend]
Collaboration diagram for smtk::extension::qtDoubleLineEdit:
[legend]

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...
 
- Public Slots inherited from smtk::extension::qtLineEdit
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...
 
- Public Member Functions inherited from smtk::extension::qtLineEdit
 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
 
- Protected Member Functions inherited from smtk::extension::qtLineEdit
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
 
- Properties inherited from smtk::extension::qtLineEdit
QString text2
 
bool resetCursorPositionOnEditingFinished
 

Additional Inherited Members

- Signals inherited from smtk::extension::qtLineEdit
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.
 

Detailed Description

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

Member Function Documentation

◆ notation()

RealNumberNotation smtk::extension::qtDoubleLineEdit::notation ( ) const

Return the notation used to display the number.

See also
setNotation()

◆ precision()

int smtk::extension::qtDoubleLineEdit::precision ( ) const

Return the precision used to display the number.

See also
setPrecision()

◆ setGlobalPrecisionAndNotation()

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

◆ setNotation

void qtDoubleLineEdit::setNotation ( qtDoubleLineEdit::RealNumberNotation  _notation)
slot

Set the notation used to display the number.

See also
notation()

◆ setPrecision

void qtDoubleLineEdit::setPrecision ( int  precision)
slot

Set the precision used to display the number.

See also
precision()

◆ setUseGlobalPrecisionAndNotation

void qtDoubleLineEdit::setUseGlobalPrecisionAndNotation ( bool  value)
slot

Set whether to use global precision and notation values.

Default is true.

See also
useGlobalPrecisionAndNotation()

◆ simplifiedText()

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.

◆ useGlobalPrecisionAndNotation()

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.


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