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 #ifndef SOURCEDELEGATE_H
00027 #define SOURCEDELEGATE_H
00028
00029 #include <QGpGuiTools.h>
00030
00031 #include "SourceParameters.h"
00032
00033 class SourceDelegate : public QItemDelegate
00034 {
00035 Q_OBJECT
00036 public:
00037 SourceDelegate(QObject *parent);
00038 ~SourceDelegate();
00039
00040 void setSourceType(SourceParameters::Type t) {_sourceType=t;}
00041
00042 virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem & style, const QModelIndex &index) const;
00043 virtual void setEditorData(QWidget *editor, const QModelIndex &index) const;
00044 virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
00045 virtual QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const;
00046 virtual void paint (QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const;
00047 public slots:
00048 void colorClicked(const QModelIndex& index);
00049 private slots:
00050 inline void commitSpin();
00051 private:
00052 int colorColumn() const;
00053
00054 SourceParameters::Type _sourceType;
00055 };
00056
00057 inline void SourceDelegate::commitSpin()
00058 {
00059 TRACE;
00060 DoubleSpinBox * w=qobject_cast<DoubleSpinBox *>(sender());
00061 if(w) emit commitData(w);
00062 }
00063
00064 #endif // SOURCEDELEGATE_H