wumu
2024-10-09 d93a5a61f94ac4cf795ba4a8970d9eeba037f4c3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#ifndef DATEDELEGATE_H
#define DATEDELEGATE_H
 
#include <QItemDelegate>
 
#include <QDateTimeEdit>
 
class DateDelegate : public QItemDelegate
{
public:
    DateDelegate(QObject *parent=0,QString format="yyyy");
 
    QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
    void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
 
private:
    QString m_formate; // 时间格式化的格式
};
 
#endif // DATEDELEGATE_H