forked from Xiaoyuan-Liu/Student-Information-Manage-System
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatedelegate.h
More file actions
32 lines (21 loc) · 974 Bytes
/
datedelegate.h
File metadata and controls
32 lines (21 loc) · 974 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef DATEDELEGATE_H
#define DATEDELEGATE_H
#include <QStyledItemDelegate>
#include <QItemDelegate>
#include <QModelIndex>
#include <QPainter>
#include <QWidget>
#include<QDateTimeEdit>
class DateDelegate : public QItemDelegate
{
Q_OBJECT
public:
DateDelegate(QObject *parent = nullptr);
~DateDelegate();
QWidget *createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index) const;//返回改变Model数据的widget,该widget是经过定制行为的Widget
void setEditorData(QWidget * editor, const QModelIndex & index) const;//将可操作的数据提供给widget
void setModelData(QWidget * editor, QAbstractItemModel * model, const QModelIndex & index) const; //将widget的数据展示到Item中
void updateEditorGeometry(QWidget * editor, const QStyleOptionViewItem & option, const QModelIndex & index) const;//确保widget能够正确显示到view中
private:
};
#endif // DATEDELEGATE_H