| 141 |
david |
1 |
/*============================================================================
|
|
|
2 |
**
|
|
|
3 |
** Project/Product :
|
|
|
4 |
** Filename : textdelegate.h
|
|
|
5 |
** Author(s) : DDP
|
|
|
6 |
**
|
|
|
7 |
** Description : A delgated widget to assist in the editing of text items
|
|
|
8 |
** within a table
|
|
|
9 |
**
|
|
|
10 |
**
|
|
|
11 |
***==========================================================================*/
|
|
|
12 |
|
| 111 |
david |
13 |
#ifndef TEXTDELEGATE_H
|
|
|
14 |
#define TEXTDELEGATE_H
|
|
|
15 |
|
|
|
16 |
#include <QItemDelegate>
|
|
|
17 |
#include <QModelIndex>
|
|
|
18 |
#include <QObject>
|
|
|
19 |
#include <QSize>
|
|
|
20 |
#include <QTextEdit>
|
|
|
21 |
|
|
|
22 |
class textDelegate : public QItemDelegate
|
|
|
23 |
{
|
|
|
24 |
Q_OBJECT
|
|
|
25 |
|
|
|
26 |
public:
|
|
|
27 |
explicit textDelegate(int maxlen = 100, QObject *parent = 0);
|
|
|
28 |
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
|
|
|
29 |
const QModelIndex &index) const;
|
|
|
30 |
|
|
|
31 |
void setEditorData(QWidget *editor, const QModelIndex &index) const;
|
|
|
32 |
void setModelData(QWidget *editor, QAbstractItemModel *model,
|
|
|
33 |
const QModelIndex &index) const;
|
|
|
34 |
|
|
|
35 |
void updateEditorGeometry(QWidget *editor,
|
|
|
36 |
const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
|
|
37 |
|
|
|
38 |
int max_len;
|
|
|
39 |
signals:
|
|
|
40 |
|
|
|
41 |
public slots:
|
|
|
42 |
|
|
|
43 |
};
|
|
|
44 |
|
|
|
45 |
#endif // TEXTDELEGATE_H
|