kMyMoneyEdit Class Reference

#include <kmymoneyedit.h>

Inheritance diagram for kMyMoneyEdit:

QHBox
Collaboration diagram for kMyMoneyEdit:

Collaboration graph
[legend]

List of all members.

Public Slots

void loadText (const QString &text)
void resetText (void)
void clearText (void)
void setText (const QString &txt)
void setCalculatorButtonVisible (const bool show)
void setResetButtonVisible (const bool show)
void setReadOnly (bool readOnly)

Signals

void valueChanged (const QString &text)
void textChanged (const QString &text)

Public Member Functions

 kMyMoneyEdit (QWidget *parent=0, const char *name=0, const int prec=-2)
 kMyMoneyEdit (const MyMoneySecurity &eq, QWidget *parent=0, const char *name=0)
 ~kMyMoneyEdit ()
MyMoneyMoney value (void) const
void setValue (const MyMoneyMoney &value)
bool isValid (void) const
virtual bool eventFilter (QObject *, QEvent *)
QString text (void) const
void setMinimumWidth (int w)
void setPrecision (const int prec)
int precision (void)
QWidgetfocusWidget (void) const
void setAllowEmpty (bool allowed=true)
void setValidator (const QValidator *v)
bool isCalculatorButtonVisible (void) const
bool isResetButtonVisible (void) const
bool isEmptyAllowed (void) const
KLineEditlineedit (void) const
void setHint (const QString &hint) const
bool isReadOnly (void) const

Protected Slots

void theTextChanged (const QString &text)
void slotCalculatorResult (void)
void slotCalculatorOpen (void)

Protected Member Functions

void ensureFractionalPart (void)
void calculatorOpen (QKeyEvent *ev)
void init (void)

Properties

bool calculatorButtonVisibility
bool resetButtonVisibility
bool allowEmpty
bool readOnly

Private Member Functions

void ensureFractionalPart (QString &txt) const

Private Attributes

QString previousText
QString m_text
kMyMoneyCalculatorm_calculator
QVBoxm_calculatorFrame
kMyMoneyLineEditm_edit
KPushButton * m_calcButton
KPushButton * m_resetButton
int m_prec


Detailed Description

This class represents a widget to enter monetary values. It has an edit field and a button to select a popup calculator. The result of the calculator (if used) is stored in the edit field.

Author:
Michael Edwardes, Thomas Baumgart

Constructor & Destructor Documentation

kMyMoneyEdit::kMyMoneyEdit ( QWidget parent = 0,
const char *  name = 0,
const int  prec = -2 
)

kMyMoneyEdit::kMyMoneyEdit ( const MyMoneySecurity eq,
QWidget parent = 0,
const char *  name = 0 
)

kMyMoneyEdit::~kMyMoneyEdit (  ) 


Member Function Documentation

void kMyMoneyEdit::ensureFractionalPart ( QString &  txt  )  const [private]

Internal helper function for value() and ensureFractionalPart(void).

void kMyMoneyEdit::ensureFractionalPart ( void   )  [protected]

This method ensures that the text version contains a fractional part.

void kMyMoneyEdit::calculatorOpen ( QKeyEvent *  ev  )  [protected]

This method opens the calculator and replays the key event pointed to by ev. If ev is 0, then no key event is replayed.

Parameters:
ev pointer to QKeyEvent that started the calculator.

void kMyMoneyEdit::init ( void   )  [protected]

Helper method for constructors.

void kMyMoneyEdit::theTextChanged ( const QString &  text  )  [protected, slot]

void kMyMoneyEdit::slotCalculatorResult ( void   )  [protected, slot]

void kMyMoneyEdit::slotCalculatorOpen ( void   )  [protected, slot]

MyMoneyMoney kMyMoneyEdit::value ( void   )  const

Deprecated:
Use value() instead

void kMyMoneyEdit::setValue ( const MyMoneyMoney value  ) 

bool kMyMoneyEdit::isValid ( void   )  const

virtual bool kMyMoneyEdit::eventFilter ( QObject ,
QEvent *   
) [virtual]

QString kMyMoneyEdit::text ( void   )  const [inline]

This method returns the value of the edit field in "numerator/denominator" format. If you want to get the text of the edit field, use lineedit()->text() instead.

void kMyMoneyEdit::setMinimumWidth ( int  w  )  [inline]

void kMyMoneyEdit::setPrecision ( const int  prec  ) 

Set the number of fractional digits that should be shown

Parameters:
prec number of fractional digits.
Note:
should be used prior to calling loadText()
See also:
precision

int kMyMoneyEdit::precision ( void   )  [inline]

return the number of fractional digits

See also:
setPrecision

QWidget* kMyMoneyEdit::focusWidget ( void   )  const

void kMyMoneyEdit::setAllowEmpty ( bool  allowed = true  ) 

This method allows to modify the behavior of the widget such that it accepts an empty value (all blank) or not. The default is to not accept an emtpy input and to convert an empty field into 0.00 upon loss of focus.

Parameters:
allowed if true, empty input is allowed, if false emtpy input will be converted to 0.00

void kMyMoneyEdit::setValidator ( const QValidator v  ) 

Overloaded for internal reasons. The API is not affected.

bool kMyMoneyEdit::isCalculatorButtonVisible ( void   )  const

bool kMyMoneyEdit::isResetButtonVisible ( void   )  const

bool kMyMoneyEdit::isEmptyAllowed ( void   )  const

KLineEdit* kMyMoneyEdit::lineedit ( void   )  const

void kMyMoneyEdit::setHint ( const QString &  hint  )  const

bool kMyMoneyEdit::isReadOnly ( void   )  const

void kMyMoneyEdit::loadText ( const QString &  text  )  [slot]

void kMyMoneyEdit::resetText ( void   )  [slot]

void kMyMoneyEdit::clearText ( void   )  [slot]

void kMyMoneyEdit::setText ( const QString &  txt  )  [inline, slot]

void kMyMoneyEdit::setCalculatorButtonVisible ( const bool  show  )  [slot]

This method allows to show/hide the calculator button of the widget. The parameter show controls the behavior. Default is to show the button.

Parameters:
show if true, button is shown, if false it is hidden

void kMyMoneyEdit::setResetButtonVisible ( const bool  show  )  [slot]

void kMyMoneyEdit::setReadOnly ( bool  readOnly  )  [slot]

void kMyMoneyEdit::valueChanged ( const QString &  text  )  [signal]

This signal is sent, when the focus leaves this widget and the amount has been changed by user during this session.

void kMyMoneyEdit::textChanged ( const QString &  text  )  [signal]


Member Data Documentation

QString kMyMoneyEdit::previousText [private]

QString kMyMoneyEdit::m_text [private]

KPushButton* kMyMoneyEdit::m_calcButton [private]

KPushButton* kMyMoneyEdit::m_resetButton [private]

int kMyMoneyEdit::m_prec [private]


Property Documentation

bool kMyMoneyEdit::calculatorButtonVisibility [read, write]

bool kMyMoneyEdit::resetButtonVisibility [read, write]

bool kMyMoneyEdit::allowEmpty [read, write]

bool kMyMoneyEdit::readOnly [read, write]


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

Generated on Wed Jan 26 13:07:59 2011 for KMyMoney by  doxygen 1.5.6