Public Member Functions

MapperDelegate Class Reference

Delegate used by the DataWidgetMapper in MappedBaseEditor. More...

#include <baseeditor.h>

Inheritance diagram for MapperDelegate:
Inheritance graph
[legend]
Collaboration diagram for MapperDelegate:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 MapperDelegate (QObject *parent=0)
void setEditorData (QWidget *editor, const QModelIndex &index) const
void setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const

Detailed Description

Delegate used by the DataWidgetMapper in MappedBaseEditor.

It's mainly used for testing purpose. Use of QSqlRelationalDelegate as base class is important because the model is based on QSqlRelationalTableModel.


Constructor & Destructor Documentation

MapperDelegate::MapperDelegate ( QObject parent = 0  ) 

                                                       : QSqlRelationalDelegate(parent)
{
}


Member Function Documentation

void MapperDelegate::setEditorData ( QWidget editor,
const QModelIndex index 
) const

This function is called every time the widget needs to be set up.

{
    //qDebug() << "DELEGATE SETTING EDITOR DATA: " << editor << index << index.data(Qt::EditRole);
    QSqlRelationalDelegate::setEditorData(editor, index);
}

void MapperDelegate::setModelData ( QWidget editor,
QAbstractItemModel model,
const QModelIndex index 
) const
Note:
That this delegate's setModelData() is called whenever Mappers's commit() or submit() is called AND property is not (!) set explicitely (?). Currently, this is always called, so some consistency checking might be implemented here.

{
    //qDebug() << "DELEGATE SETTING MODEL DATA: " << editor << model << index << index.data(Qt::EditRole);
    QSqlRelationalDelegate::setModelData(editor, model, index);
}


The documentation for this class was generated from the following files: