-
Notifications
You must be signed in to change notification settings - Fork 5
/
mysqlrelationaldelegate.h
35 lines (23 loc) · 1.25 KB
/
mysqlrelationaldelegate.h
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
33
34
35
/*///////////////////////////////////////////////////////////////////////////////////////////////////
copy from http://developer.qt.nokia.com/wiki/QSqlRelationalDelegate_subclass_that_works_with_QSqlRelationalTableModel
retrieved 2011-04-03
license Creative Commons Attribution-ShareAlike 2.5 Generic
QSqlRelationalDelegate subclass that works with QSqlRelationalTableModel
When you are using a QSqlRelationalTableModel in combination with QSortFilterProxyModel, you loose the automatic combobox that is displayed in a QTableView.
This is a subclass of QSqlRelationalDelegate, that works
////////////////////////////////////////////////////////////*/
#ifndef MYSQLRELATIONALDELEGATE_H
#define MYSQLRELATIONALDELEGATE_H
#include <QSqlRelationalDelegate>
class mySqlRelationalDelegate : public QSqlRelationalDelegate
{
Q_OBJECT
public:
explicit mySqlRelationalDelegate(QObject *parent = 0);
QWidget *createEditor(QWidget *aParent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
void setEditorData(QWidget *editor, const QModelIndex &index) const;
signals:
public slots:
};
#endif // MYSQLRELATIONALDELEGATE_H