-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathRateEditor.cpp
More file actions
39 lines (33 loc) · 794 Bytes
/
RateEditor.cpp
File metadata and controls
39 lines (33 loc) · 794 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "RateEditor.h"
RateEditor::
RateEditor(unsigned int pennies, QWidget *parent)
/*****************************************************************************
* Constructor
*/
: QLineEdit(parent)
{
int rate_dollars= pennies/100,
rate_cents= pennies%100;
QString str=QString("%1.%2").arg(rate_dollars).arg(rate_cents,2,10,QLatin1Char('0'));
setText(str);
setInputMask("0009.99");
}
RateEditor::
~RateEditor()
/*****************************************************************************
* Destructor
*/
{
}
unsigned int
RateEditor::
pennies() const
/*****************************************************************************
* Convert string back to pennies.
*/
{
bool ok;
double dval= text().toDouble(&ok);
Q_ASSERT(ok);
return dval*100;
}