Documentation


X3DSFRotationGUI.cpp

Go to the documentation of this file.
00001 
00002 //                            X3DSFRotationGUI.cpp                            //
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 "X3DSFRotationGUI.h"
00017 
00018 namespace X3DTK {
00019 namespace Qt{
00020 
00021 /* 
00022  *  Constructs a X3DSFRotationGUI as a child of 'parent'
00023  */
00024 X3DSFRotationGUI::X3DSFRotationGUI(QString nameOfField, X3DTK::SFRotation * Vec4ToEdit, QWidget * parent, const char* name, WFlags fl)
00025 : QWidget(parent, name, fl)
00026 , Vec4ToEdit(Vec4ToEdit)
00027 {
00028     if ( !name )
00029       setName( "X3DSFRotation GUI" );
00030     
00031     // The layout
00032     SFVector4Layout = new QHBoxLayout(this);
00033     SFVector4Layout->setAutoAdd(true);
00034     
00035     // The label
00036     new QLabel(nameOfField, this);
00037     
00038     // the x line edit
00039     new QLabel("x", this);
00040     editX = new WFloatLineEdit(this, "editX" );
00041     editX->setMinFloatValue( -INFINITY );
00042     editX->setMaxFloatValue( INFINITY );
00043     // the y line edit
00044     new QLabel("y", this);
00045     editY = new WFloatLineEdit(this, "editY" );
00046     editY->setMinFloatValue( -INFINITY );
00047     editY->setMaxFloatValue( INFINITY );
00048     // the y line edit
00049     new QLabel("z", this);
00050     editZ = new WFloatLineEdit(this, "editZ" );
00051     editZ->setMinFloatValue( -INFINITY );
00052     editZ->setMaxFloatValue( INFINITY );
00053     // the a (angle) line edit
00054     new QLabel("angle", this);
00055     editA = new WFloatLineEdit(this, "editA" );
00056     editA->setMinFloatValue( -INFINITY );
00057     editA->setMaxFloatValue( INFINITY );
00058     
00059     // signals and slots connections
00060     connect( editX, SIGNAL( floatValueChanged(float) ), this, SLOT( changeValueX(float) ) );
00061     connect( editY, SIGNAL( floatValueChanged(float) ), this, SLOT( changeValueY(float) ) );
00062     connect( editZ, SIGNAL( floatValueChanged(float) ), this, SLOT( changeValueZ(float) ) );
00063     connect( editA, SIGNAL( floatValueChanged(float) ), this, SLOT( changeValueA(float) ) );
00064     
00065     setValue();
00066 }
00067 
00068 /*
00069  *  Destroys the object and frees any allocated resources
00070  */
00071 X3DSFRotationGUI::~X3DSFRotationGUI()
00072 {
00073     // no need to delete child widgets, Qt does it all for us
00074 }
00075 
00076 void X3DSFRotationGUI::setValue()
00077 {
00078     editX->setFloatValue((*Vec4ToEdit).x);
00079     editY->setFloatValue((*Vec4ToEdit).y);
00080     editZ->setFloatValue((*Vec4ToEdit).z);
00081     editA->setFloatValue((*Vec4ToEdit).angle);
00082 }
00083 
00084 void X3DSFRotationGUI::changeValueX(float f)
00085 {
00086     (*Vec4ToEdit).x = f;
00087     emit changed();
00088 }
00089 void X3DSFRotationGUI::changeValueY(float f)
00090 {
00091     (*Vec4ToEdit).y = f;
00092     emit changed();
00093 }
00094 void X3DSFRotationGUI::changeValueZ(float f)
00095 {
00096     (*Vec4ToEdit).z = f;
00097     emit changed();
00098 }
00099 void X3DSFRotationGUI::changeValueA(float f)
00100 {
00101     (*Vec4ToEdit).angle = f;
00102     emit changed();
00103 }
00104 } // Qt
00105 } // X3DTK

Generated on Thu Dec 23 13:52:27 2004 by doxygen 1.3.6