src/qvgui/qvparamsinspectorwidget.cpp

Go to the documentation of this file.
00001 /*
00002  *      Copyright (C) 2007. PARP Research Group.
00003  *      <http://perception.inf.um.es>
00004  *      University of Murcia, Spain.
00005  *
00006  *      This file is part of the QVision library.
00007  *
00008  *      QVision is free software: you can redistribute it and/or modify
00009  *      it under the terms of the GNU Lesser General Public License as
00010  *      published by the Free Software Foundation, version 3 of the License.
00011  *
00012  *      QVision is distributed in the hope that it will be useful,
00013  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *      GNU Lesser General Public License for more details.
00016  *
00017  *      You should have received a copy of the GNU Lesser General Public
00018  *      License along with QVision. If not, see <http://www.gnu.org/licenses/>.
00019  */
00020 
00024 
00025 #include <qvgui/qvparamsinspectorwidget.h>
00026 
00027 #include <QtGui/QWidget>
00028 
00029 #include <qvcore/qvpropertycontainer.h>
00030 #include <qvcore/qvworker.h>
00031 #include <qvgui/qvparamwidget.h>
00032 #include <qvdta/qvindexedstringlist.h>
00033 
00034 QVParamsInspectorWidget::QVParamsInspectorWidget(QVPropertyContainer *holder, QWidget *parent):QWidget(parent)
00035         {
00036         //setGeometry(QRect(10, 20, 200, 0));
00037         vboxLayout = new QVBoxLayout(this);
00038         vboxLayout->setSpacing(0);
00039 
00040         QVWorker *worker;
00041         if((worker = dynamic_cast<QVWorker*>(holder)) != NULL)
00042                 foreach(QString property, worker->getTriggerList())
00043                         vboxLayout->addWidget(new QVWorkerTriggerWidget(worker, property, this));
00044 
00045         foreach(QString property, holder->getPropertyList())
00046                 if(holder->isLinkedInput(property) or not holder->isInput(property) or holder->isGUIInvisible(property))
00047                         continue;
00048                 else if(holder->isType<int>(property)) // if the property is int.
00049                         {
00050                         QVIntParamWidget *int_widget = new QVIntParamWidget(holder,this,property);
00051                         vboxLayout->addWidget(int_widget);
00052                         writeOutputProperties();
00053                         connect(int_widget,SIGNAL(valueChanged(int)),this,SLOT(somePropertyChanged()));
00054                         }
00055                 else if(holder->isType<double>(property)) // if the property is double.
00056                         {
00057                         QVDoubleParamWidget *double_widget = new QVDoubleParamWidget(holder,this,property);
00058                         vboxLayout->addWidget(double_widget);
00059                         writeOutputProperties();
00060                         connect(double_widget,SIGNAL(valueChanged(double)),this,SLOT(somePropertyChanged()));
00061                         }
00062                 else if(holder->isType<bool>(property)) // if the property is bool.
00063                         {
00064                         QVBoolParamWidget *bool_widget = new QVBoolParamWidget(holder,this,property);
00065                         vboxLayout->addWidget(bool_widget);
00066                         writeOutputProperties();
00067                         connect(bool_widget,SIGNAL(valueChanged(bool)),this,SLOT(somePropertyChanged()));
00068                         }
00069                 else if(holder->isType<QString>(property)) // if the property is QString.
00070                         {
00071                         QVStringParamWidget *st_widget = new QVStringParamWidget(holder,this,property);
00072                         vboxLayout->addWidget(st_widget);
00073                         writeOutputProperties();
00074                         connect(st_widget,SIGNAL(valueChanged(QString)),this,SLOT(somePropertyChanged()));
00075                         }
00076                 else if(holder->isType<QVIndexedStringList>(property)) // if the property is QVIndexedStringList.
00077                         {
00078                         QVStringListParamWidget *sl_widget = new QVStringListParamWidget(holder,this,property);
00079                         vboxLayout->addWidget(sl_widget);
00080                         writeOutputProperties();
00081                         connect(sl_widget,SIGNAL(valueChanged(QVIndexedStringList)),this,SLOT(somePropertyChanged()));
00082                         }
00083 
00084         vboxLayout->addStretch();
00085         }
00086 
00087 void QVParamsInspectorWidget::somePropertyChanged()
00088         {
00089         writeOutputProperties();
00090         }

Generated on Thu Jul 17 17:23:28 2008 for QVision by  doxygen 1.5.3