Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef PROPERTYWIDGET_H
00029 #define PROPERTYWIDGET_H
00030
00031 #include "QGpGuiToolsDLLExport.h"
00032 #include "PropertyValue.h"
00033
00034 namespace QGpGuiTools {
00035
00036 class PropertyItem;
00037
00038 class QGPGUITOOLS_EXPORT PropertyWidget : public QWidget
00039 {
00040 Q_OBJECT
00041 public:
00042 PropertyWidget(QWidget * parent=0);
00043 ~PropertyWidget();
00044
00045 void setValue(int pid, QVariant val);
00046 QVariant value(int pid) {return _list[pid]->value();}
00047 bool constant(int pid) {return _list[pid]->constant();}
00048 PropertyValue * propertyValue(int pid) {return _list[pid];}
00049 int propertyCount() const {return _list.count();}
00050
00051 virtual void setWidgets();
00052 virtual void reset();
00053
00054 void setId(uint wid) {_wid=wid;}
00055 uint id() const {return _wid;}
00056
00057 void linkTo(PropertyWidget * w);
00058
00059 void touched(PropertyValue * p, QVariant val);
00060 private slots:
00061 void touched(PropertyValue * p) {touched(p, widgetValue( *p) );}
00062 signals:
00063 void setProperty(int id, QVariant val);
00064 void refreshValues();
00065 void touched();
00066 protected:
00067 PropertyValue * addProperty(int pid, QWidget * w, QWidget * label);
00068 PropertyValue * addProperty(int pid, QWidget * w=0) {return addProperty(pid, w, w);}
00069
00070 virtual int determineCustomWidgetType(int , QWidget * , QWidget * ) {return 0;}
00071 virtual bool connectCustomWidget(PropertyValue & ) {return false;}
00072 virtual bool setCustomWidget(PropertyValue & ) {return false;}
00073 virtual QVariant customWidgetValue(PropertyValue & ) {return QVariant();}
00074 private:
00075 inline int determineWidgetType(int pid, QWidget * w, QWidget * label);
00076 inline void connectWidget(PropertyValue & p);
00077 void setWidget(PropertyValue & p);
00078 QVariant widgetValue(PropertyValue & p);
00079
00080 QHash<int, PropertyValue *> _list;
00081 uint _wid;
00082 };
00083
00084 }
00085
00086 #endif // PROPERTYWIDGET_H