-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy patheditbox.cpp
57 lines (46 loc) · 1.05 KB
/
editbox.cpp
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
#include "editbox.h"
EditBox::EditBox( QLabel &location_label, QString initValue, QWidget *parent) :
QLineEdit(parent)
{
numEdit = 0 ;
this->setText( initValue ) ;
resize( location_label.size() ) ;
move( location_label.pos() ) ;
}
void EditBox::mousePressEvent( QMouseEvent * )
{
numEdit = new NumberEdit( this->text(), this ) ;
connect( numEdit, SIGNAL( finished( int ) ), this, SLOT( ReadValue() ) ) ;
/*if( this->pos() != QPoint( 0, 0 ) )
{
numEdit->move( this->x() , this->y() ) ;
}
else
{
numEdit->move( 0 , 0 ) ;
}
numEdit->show() ;
numEdit->raise() ;*/
numEdit->exec() ;
}
void EditBox::ReadValue()
{
if( numEdit != 0 )
{
this->setText( numEdit->GetStringValue() ) ;
}
delete numEdit ;
numEdit = 0 ;
}
int EditBox::GetIntValue()
{
return ( int )( this->text().toInt() ) ;
}
double EditBox::GetDoubleValue()
{
return ( double )( this->text().toDouble() ) ;
}
QString EditBox::GetStringValue()
{
return ( QString )( this->text() ) ;
}