PARP Research Group University of Murcia, Spain


src/qvgui/qvparamsinspectorwidget.cpp

Go to the documentation of this file.
00001 /*
00002  *      Copyright (C) 2007, 2008. 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/qvparamwidget.h>
00026 #include <qvgui/qvparamsinspectorwidget.h>
00027 #include <QtGui/QWidget>
00028 #include <QLabel>
00029 
00030 #include <QVWorker>
00031 #include <QVIndexedStringList>
00032 
00033 QVParamsInspectorWidget::QVParamsInspectorWidget(QVPropertyContainer *holder, QWidget *parent):
00034         QWidget(parent), QVPropertyContainer("QVParamsInspectorWidget for " + holder->getName())
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         bool haveWidgets = false;
00046         foreach(QString property, holder->getPropertyList())
00047                 if(holder->isLinkedInput(property) or not holder->isInput(property) or holder->isGUIInvisible(property))
00048                         continue;
00049                 else if(holder->isType<int>(property)) // if the property is int.
00050                         {
00051                         QVIntParamWidget *int_widget = new QVIntParamWidget(holder,this,property);
00052                         vboxLayout->addWidget(int_widget);
00053                         haveWidgets = true;
00054                         writeOutputProperties();
00055                         connect(int_widget,SIGNAL(valueChanged(int)),this,SLOT(somePropertyChanged()));
00056                         }
00057                 else if(holder->isType<double>(property)) // if the property is double.
00058                         {
00059                         QVDoubleParamWidget *double_widget = new QVDoubleParamWidget(holder,this,property);
00060                         vboxLayout->addWidget(double_widget);
00061                         haveWidgets = true;
00062                         writeOutputProperties();
00063                         connect(double_widget,SIGNAL(valueChanged(double)),this,SLOT(somePropertyChanged()));
00064                         }
00065                 else if(holder->isType<bool>(property)) // if the property is bool.
00066                         {
00067                         QVBoolParamWidget *bool_widget = new QVBoolParamWidget(holder,this,property);
00068                         vboxLayout->addWidget(bool_widget);
00069                         haveWidgets = true;
00070                         writeOutputProperties();
00071                         connect(bool_widget,SIGNAL(valueChanged(bool)),this,SLOT(somePropertyChanged()));
00072                         }
00073                 else if(holder->isType<QString>(property)) // if the property is QString.
00074                         {
00075                         QVStringParamWidget *st_widget = new QVStringParamWidget(holder,this,property);
00076                         vboxLayout->addWidget(st_widget);
00077                         haveWidgets = true;
00078                         writeOutputProperties();
00079                         connect(st_widget,SIGNAL(valueChanged(QString)),this,SLOT(somePropertyChanged()));
00080                         }
00081                 else if(holder->isType<QVIndexedStringList>(property)) // if the property is QVIndexedStringList.
00082                         {
00083                         QVStringListParamWidget *sl_widget = new QVStringListParamWidget(holder,this,property);
00084                         vboxLayout->addWidget(sl_widget);
00085                         haveWidgets = true;
00086                         writeOutputProperties();
00087                         connect(sl_widget,SIGNAL(valueChanged(QVIndexedStringList)),this,SLOT(somePropertyChanged()));
00088                         }
00089                 else if(holder->isType<QColor>(property)) // if the property is QColor
00090                         {
00091                         QVColorParamWidget *sl_widget = new QVColorParamWidget(holder,this,property);
00092                         vboxLayout->addWidget(sl_widget);
00093                         haveWidgets = true;
00094                         writeOutputProperties();
00095                         connect(sl_widget,SIGNAL(valueChanged(QColor)),this,SLOT(somePropertyChanged()));
00096                         }
00097 
00098         if (!haveWidgets)
00099                 vboxLayout->addWidget(new QLabel("This container has no editable input properties."));
00100 
00101         vboxLayout->addStretch();
00102         }
00103 
00104 void QVParamsInspectorWidget::somePropertyChanged()
00105         {
00106         writeOutputProperties();
00107         }



QVision framework. PARP research group, copyright 2007, 2008.