Documentation


SFBoolGUI.cpp

Go to the documentation of this file.
00001 
00002 //                            SFBoolGUI.cpp                                   //
00004 
00005 #include<iostream>
00006 
00007 #include <qlabel.h>
00008 #include <qlayout.h>
00009 #include <qradiobutton.h>
00010 
00011 #include "SFBoolGUI.h"
00012 
00013 namespace X3DTK {
00014 namespace Qt{
00015 
00016 /* 
00017  *  Constructs a SFBoolGUI as a child of 'parent'
00018  */
00019 SFBoolGUI::SFBoolGUI(QString nameOfField, bool * boolToEdit, QWidget * parent, const char* name, WFlags fl)
00020 : QWidget(parent, name, fl)
00021 , boolToEdit(boolToEdit)
00022 {
00023     if ( !name )
00024       setName( "SFBool GUI" );
00025     
00026     // The layout
00027     SFBoolLayout = new QHBoxLayout(this);
00028     SFBoolLayout->setAutoAdd(true);
00029     
00030     // The label
00031     new QLabel(nameOfField, this);
00032     
00033     // the bool line edit
00034     radioButton = new QRadioButton(this);
00035 
00036     // signals and slots connections
00037     connect( radioButton, SIGNAL( toggled(bool) ), this, SLOT( changeValue(bool) ) );
00038     
00039     setValue();
00040 }
00041 
00042 /*
00043  *  Destroys the object and frees any allocated resources
00044  */
00045 SFBoolGUI::~SFBoolGUI()
00046 {
00047     // no need to delete child widgets, Qt does it all for us
00048 }
00049 
00050 void SFBoolGUI::setValue()
00051 {
00052     radioButton->setChecked(*boolToEdit);
00053 }
00054 
00055 void SFBoolGUI::changeValue(bool b)
00056 {
00057     *boolToEdit = b;
00058     emit changed();
00059 }
00060 } // Qt
00061 } // X3DTK

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