wumu
2024-10-08 efddb5166089573f9b2508d30b217ddebbb2fab2
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