File: rlineedit.cpp

package info (click to toggle)
qcad 1.3.3-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 4,504 kB
  • ctags: 2,449
  • sloc: cpp: 29,400; makefile: 49; sh: 15
file content (90 lines) | stat: -rw-r--r-- 1,704 bytes parent folder | download
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/***************************************************************************
                          rlineedit.cpp  -  description
                             -------------------
    begin                : Mon Sep 27 1999
    copyright            : (C) 1999 by Andreas Mustun
    email                : andrew@ribbonsoft.com
 ***************************************************************************/


/****************************************************************************
** rlineedit.cpp 1998/09/19 A. Mustun RibbonSoft
**
** Copyright (C) 1998 RibbonSoft.  All rights reserved.
**
*****************************************************************************/

#include <stdio.h>
#include <stdlib.h>
#include <qlineedit.h>

#include "rlineedit.h"
#include "rstring.h"
#include "rconfig.h"


// Constructor:
//
RLineEdit::RLineEdit(QWidget* _parent, const char* _name)
:QLineEdit(_parent, _name)
{
  setFont(QFont("helvetica", RCONFIG->getSettingInt("Application:FontSize0")));
}


// Destructor:
//
RLineEdit::~RLineEdit()
{
}



// Set a float value:
//
void
RLineEdit::setFloat(float _value)
{
  QString str;
  str.setNum(_value, 'g', 3);
  setText(str);
  //setText(strFloatToString(_value));
}


// Set a integer value:
//
void
RLineEdit::setInteger(int _value)
{
  /*char strValue[128];
  sprintf(strValue, "%d", _value);
  setText(strValue);*/
  
  QString str;
  str.setNum(_value);
  setText(str);
}


// Get the contents of this box as a float value:
//
float
RLineEdit::getFloat()
{
  //return atof(text());
  return text().toFloat();
}


// Get the contents of this box as an int value:
//
int
RLineEdit::getInt()
{
  //return atoi(text());
  return text().toInt();
}

// EOF