00001
00002
00004
00005 #include<iostream>
00006
00007 #include <qlabel.h>
00008 #include <qlayout.h>
00009 #include <qspinbox.h>
00010
00011 #include "SFIntGUI.h"
00012
00013 namespace X3DTK {
00014 namespace Qt{
00015
00016
00017
00018
00019 SFIntGUI::SFIntGUI(QString nameOfField, int * intToEdit, QWidget * parent, const char* name, WFlags fl)
00020 : QWidget(parent, name, fl)
00021 , intToEdit(intToEdit)
00022 {
00023 if ( !name )
00024 setName( "SFInt GUI" );
00025
00026
00027 SFIntLayout = new QHBoxLayout(this);
00028 SFIntLayout->setAutoAdd(true);
00029
00030
00031 new QLabel(nameOfField, this);
00032
00033
00034 spinBox = new QSpinBox((int)-1e-10,(int)1e10,1,this);
00035
00036
00037 connect( spinBox, SIGNAL( valueChanged(int) ), this, SLOT( changeValue(int) ) );
00038
00039 setValue();
00040 }
00041
00042
00043
00044
00045 SFIntGUI::~SFIntGUI()
00046 {
00047
00048 }
00049
00050 void SFIntGUI::setValue()
00051 {
00052 spinBox->setValue(*intToEdit);
00053 }
00054
00055 void SFIntGUI::changeValue(int i)
00056 {
00057 *intToEdit = i;
00058 emit changed();
00059 }
00060 }
00061 }