00001 /******************************************************************** 00002 *================== ЗАО "ННН" ========================* 00003 *********************************************************************/ 00015 /* 00016 * Support E-mail: lit-uriy@yandex.ru 00017 * Лицензия: GNU GPLv2 00018 * TabSize: 4 00019 * Encodding: UTF-8 (w/o BOM) 00020 * 00021 * 00022 * 00023 * 00024 * Log: 00025 * Date Athor Description 00026 * 00027 * 00028 ********************************************************************/ 00029 #ifndef YSTDDELEGATE_H 00030 #define YSTDDELEGATE_H 00031 00032 #include <QItemDelegate> 00033 #include <QModelIndex> 00034 #include <QObject> 00035 #include <QSize> 00036 #include <QSpinBox> 00037 00038 00046 class YStdDelegate : public QItemDelegate 00047 { 00048 Q_OBJECT 00049 00050 private: 00051 int typeeditor; 00052 00053 public: 00057 enum TypeEditor 00058 { 00059 TQSpinBox, 00060 TBool, 00061 TQDateTimeEdit 00062 }; 00063 00070 YStdDelegate(TypeEditor type, QObject *parent = 0); 00071 00075 QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, 00076 const QModelIndex &index) const; 00080 void setEditorData(QWidget *editor, const QModelIndex &index) const; 00084 void setModelData(QWidget *editor, QAbstractItemModel *model, 00085 const QModelIndex &index) const; 00086 00087 void updateEditorGeometry(QWidget *editor, 00088 const QStyleOptionViewItem &option, const QModelIndex &index) const; 00089 }; 00090 00091 #endif //YSTDDELEGATE_H
Copyright © 2008 ЗАО "ННН" | Trademarks | YStdDelegate_Example 1.0.0 |