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 
00033 
00034 QVParamsInspectorWidget::QVParamsInspectorWidget(QVPropertyContainer *holder, QWidget *parent):QWidget(parent)
00035         {
00036         //setGeometry(QRect(10, 20, 200, 0));
00037 
00038         vboxLayout = new QVBoxLayout(this);
00039         vboxLayout->setSpacing(0);
00040 
00041         QVWorker *worker;
00042         if((worker = dynamic_cast<QVWorker*>(holder)) != NULL)
00043                 {
00044                 QListIterator<QString> iter(worker->getTriggerList());
00045                 while (iter.hasNext())
00046                         {
00047                         QString property(iter.next());
00048                         QVWorkerTriggerWidget *triggerwidget = 
00049                                 new QVWorkerTriggerWidget(worker, property, this);
00050                         vboxLayout->addWidget(triggerwidget);
00051                         }
00052                 }
00053 
00054         QListIterator<QString> iter(holder->getPropertyList());
00055         while (iter.hasNext())
00056                 {
00057                 QString property(iter.next());
00058                 // Only input properties that are not linked will be displayed:
00059                 if(not holder->isLinkedInput(property) and holder->isInput(property))
00060                         {
00061                         if(holder->isType<int>(property))
00062                                 {
00063                                 QVIntParamWidget *int_widget = new QVIntParamWidget(holder,this,property);
00064                                 vboxLayout->addWidget(int_widget);
00065                                 writeOutputProperties();
00066                                 connect(int_widget,SIGNAL(valueChanged(int)),this,SLOT(somePropertyChanged()));
00067                                 } /* if the property is int. */
00068                         else if(holder->isType<double>(property))
00069                                 {
00070                                 QVDoubleParamWidget *double_widget = new QVDoubleParamWidget(holder,this,property);
00071                                 vboxLayout->addWidget(double_widget);
00072                                 writeOutputProperties();
00073                                 connect(double_widget,SIGNAL(valueChanged(double)),this,SLOT(somePropertyChanged()));
00074                                 } /* if the property is double. */
00075                         else if(holder->isType<bool>(property))
00076                                 {
00077                                 QVBoolParamWidget *bool_widget = new QVBoolParamWidget(holder,this,property);
00078                                 vboxLayout->addWidget(bool_widget);
00079                                 writeOutputProperties();
00080                                 connect(bool_widget,SIGNAL(valueChanged(bool)),this,SLOT(somePropertyChanged()));
00081                                 } /* if the property is bool. */
00082                         } /* if it is not linked and of the input type. */
00083                 } /* while there are more properties. */
00084 
00085         vboxLayout->addStretch();
00086 
00087         }
00088 
00089 void QVParamsInspectorWidget::somePropertyChanged()
00090         {
00091         writeOutputProperties();
00092         }

Generated on Thu Mar 13 19:18:16 2008 for QVision by  doxygen 1.5.3