QGpGuiTools/PropertyValue.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of QGpGuiTools.
00004 **
00005 **  This library is free software; you can redistribute it and/or
00006 **  modify it under the terms of the GNU Lesser General Public
00007 **  License as published by the Free Software Foundation; either
00008 **  version 2.1 of the License, or (at your option) any later version.
00009 **
00010 **  This file is distributed in the hope that it will be useful, but WITHOUT
00011 **  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 **  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
00013 **  License for more details.
00014 **
00015 **  You should have received a copy of the GNU Lesser General Public
00016 **  License along with this library; if not, write to the Free Software
00017 **  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018 **
00019 **  See http://www.geopsy.org for more information.
00020 **
00021 **  Created : 2008-04-01
00022 **  Authors :
00023 **    Marc Wathelet
00024 **    Marc Wathelet (LGIT, Grenoble, France)
00025 **
00026 ***************************************************************************/
00027 
00028 #ifndef PROPERTYVALUE_H
00029 #define PROPERTYVALUE_H
00030 
00031 #include <QtGui>
00032 
00033 #include "QGpGuiToolsDLLExport.h"
00034 
00035 namespace QGpGuiTools {
00036 
00037 class QGPGUITOOLS_EXPORT PropertyValue : public QObject
00038 {
00039   Q_OBJECT
00040 public:
00041   PropertyValue(int id, QWidget * w, QWidget * label, int widgetType);
00042 
00043   QWidget * widget() const {return _widget;}
00044   QWidget * label() const {return _label;}
00045   int widgetType() const {return _widgetType;}
00046   int id() const {return _id;}
00047 
00048   void setValue(QVariant val);
00049   void reset();
00050 
00051   void freeze(bool f) {_frozen=f;}
00052   bool isFrozen() const {return _frozen;}
00053 
00054   QVariant value() const {return _value;}
00055   bool constant() const {return _constant;}
00056 
00057   bool isTouched() const {return _touched;}
00058   void setTouched(bool t=true) {_touched=t;}
00059 public slots:
00060   void touched();
00061 signals:
00062   void constantChanged(bool c);
00063   void touched(PropertyValue * p);
00064 private:
00065   int _id;
00066   QWidget * _widget;
00067   QWidget * _label;
00068   int _widgetType;
00069   uint _constant:1;
00070   uint _frozen:1;
00071   uint _touched:1;
00072   QVariant _value;
00073 };
00074 
00075 inline void PropertyValue::touched()
00076 {
00077   if(!_frozen) {
00078     _touched=true;
00079     emit touched(this);
00080     reset();
00081   }
00082 }
00083 
00084 } // namespace QGpGuiTools
00085 
00086 #endif // PROPERTYVALUE_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines