[99b84b]: libgui / FloatLine.cpp Maximize Restore History

Download this file

FloatLine.cpp    40 lines (33 with data), 880 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 <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <libkwave/String.h>
#include "FloatLine.h"
extern QString mstotime (int ms);
extern char* mstotimec (int ms);
//**********************************************************
FloatLine::FloatLine(QWidget *parent, double value)
:KRestrictedLine(parent)
{
digits = 1;
setValue (value);
setValidChars ("-0123456789.E");
}
//**********************************************************
void FloatLine::setValue (double value)
{
char buf[256];
char conv[256];
snprintf(conv, sizeof(conv), "%%.%df", digits);
snprintf(buf, sizeof(buf), conv, value);
setText(buf);
}
//**********************************************************
double FloatLine::value ()
{
return strtod (text(), 0);
}
//**********************************************************
FloatLine::~FloatLine ()
{
}