00001
00002
00004
00005 #include<iostream>
00006 #include<cmath>
00007 #ifdef _WIN32
00008 #define INFINITY 0x7FFFFFFF
00009 #endif
00010
00011 #include <qlabel.h>
00012 #include <qlayout.h>
00013
00014 #include <animal/X3DTK/Qt/objectGUI/WFloatLineEdit.h>
00015
00016 #include "X3DSFVec3fGUI.h"
00017
00018 namespace X3DTK {
00019 namespace Qt{
00020
00021
00022
00023
00024 X3DSFVec3fGUI::X3DSFVec3fGUI(QString nameOfField, X3DTK::SFVec3f * Vec3ToEdit, QWidget * parent, const char* name, WFlags fl)
00025 : QWidget(parent, name, fl)
00026 , Vec3ToEdit(Vec3ToEdit)
00027 {
00028 if ( !name )
00029 setName( "SFVector3 GUI" );
00030
00031
00032 SFVector3Layout = new QHBoxLayout(this);
00033 SFVector3Layout->setAutoAdd(true);
00034
00035
00036 new QLabel(nameOfField, this);
00037
00038
00039 editX = new WFloatLineEdit(this, "editX" );
00040 editX->setMinFloatValue( -INFINITY );
00041 editX->setMaxFloatValue( INFINITY );
00042
00043 editY = new WFloatLineEdit(this, "editY" );
00044 editY->setMinFloatValue( -INFINITY );
00045 editY->setMaxFloatValue( INFINITY );
00046
00047 editZ = new WFloatLineEdit(this, "editZ" );
00048 editZ->setMinFloatValue( -INFINITY );
00049 editZ->setMaxFloatValue( INFINITY );
00050
00051
00052 connect( editX, SIGNAL( floatValueChanged(float) ), this, SLOT( changeValueX(float) ) );
00053 connect( editY, SIGNAL( floatValueChanged(float) ), this, SLOT( changeValueY(float) ) );
00054 connect( editZ, SIGNAL( floatValueChanged(float) ), this, SLOT( changeValueZ(float) ) );
00055
00056 setValue();
00057 }
00058
00059
00060
00061
00062 X3DSFVec3fGUI::~X3DSFVec3fGUI()
00063 {
00064
00065 }
00066
00067 void X3DSFVec3fGUI::setValue()
00068 {
00069 editX->setFloatValue((*Vec3ToEdit).x);
00070 editY->setFloatValue((*Vec3ToEdit).y);
00071 editZ->setFloatValue((*Vec3ToEdit).z);
00072 }
00073
00074 void X3DSFVec3fGUI::changeValueX(float f)
00075 {
00076 (*Vec3ToEdit).x = f;
00077 emit changed();
00078 }
00079 void X3DSFVec3fGUI::changeValueY(float f)
00080 {
00081 (*Vec3ToEdit).y = f;
00082 emit changed();
00083 }
00084 void X3DSFVec3fGUI::changeValueZ(float f)
00085 {
00086 (*Vec3ToEdit).z = f;
00087 emit changed();
00088 }
00089
00090 }
00091 }