DbDelegate Pile   version 0.0.1
DbDelegate pile.
DbDelegate Class Reference

Provides display and editing facilities for data items from a model. More...

#include <dbdelegate.h>

+ Inheritance diagram for DbDelegate:

Public Member Functions

virtual const DbModel * dbModelConst (const QModelIndex &index) const
 
virtual DbModel * dbModel (const QModelIndex &index) const
 
virtual QVariant getData (const QModelIndex &index, int role) const
 
virtual QModelIndex mapIndex (const QModelIndex &idx) const
 
 DbDelegate (QObject *parent=NULL)
 Default constructor.
 
virtual ~DbDelegate ()
 Destructor.
 
virtual void paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
 Painting an item.
 
virtual QSize sizeHint (const QStyleOptionViewItem &option, const QModelIndex &index) const
 The size needed by the delegate to display the item.
 
virtual QWidget * createEditor (QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
 Create a widget for editing a gived value.
 
virtual void setEditorData (QWidget *editor, const QModelIndex &index) const
 Sets the data to be displayed and edited from the model.
 
virtual void setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
 Gets data from the editor and stores it in the model.
 
virtual void updateEditorGeometry (QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const
 Updates the editor for the item according to the style.
 
virtual QString displayText (const QVariant &value, const QLocale &locale) const
 Last chance to change displayed text before actual paint.
 

Static Public Member Functions

static bool setAllDelegates (QTableView *view)
 Sets all delegates for a table. More...
 
static bool setAllDelegates (DbTaew *table, QTableView *view)
 Sets all delegates for a table. More...
 
static bool resetAllDelegates (QTableView *view)
 Resets all delegates for a table. More...
 
Control SetUp

Prepare controls to be used according to their type.

static bool setupControl (const DbModelCol &col_data, QCheckBox *control, const QVariant &value)
 
static bool setupControl (const DbModelCol &col_data, QComboBox *control, const QVariant &value)
 
static bool setupControl (const DbModelCol &col_data, QDateEdit *control, const QVariant &value)
 
static bool setupControl (const DbModelCol &col_data, QDateTimeEdit *control, const QVariant &value)
 
static bool setupControl (const DbModelCol &col_data, QDoubleSpinBox *control, const QVariant &value)
 
static bool setupControl (const DbModelCol &col_data, QLineEdit *control, const QVariant &value)
 
static bool setupControl (const DbModelCol &col_data, QSpinBox *control, const QVariant &value)
 
static bool setupControl (const DbModelCol &col_data, QTimeEdit *control, const QVariant &value)
 
static bool setupControl (const DbModelCol &col_data, QTextEdit *control, const QVariant &value)
 

Protected Member Functions

virtual void initStyleOption (QStyleOptionViewItem *option, const QModelIndex &index) const
 Initialize style options for an item.
 
virtual bool eventFilter (QObject *object, QEvent *event)
 Filter out some events.
 
virtual bool editorEvent (QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index)
 Start of editing and mouse events.
 

Detailed Description

Provides display and editing facilities for data items from a model.

Member Function Documentation

bool DbDelegate::resetAllDelegates ( QTableView *  view)
static

Resets all delegates for a table.

The method iterates all columns, gets the delegate and checks if it is a DbDelegate. If so it removes it and deletes the instance.

Parameters
viewthe view where delegates were installed
Returns
true if the model is a DbModel.
bool DbDelegate::setAllDelegates ( QTableView *  view)
static

Sets all delegates for a table.

This overload simply extracts the table or view definition and passes that to base implementation.

Parameters
viewThe target view.
Returns
true if the model is a DbModel and has a valid meta data object.
bool DbDelegate::setAllDelegates ( DbTaew *  table,
QTableView *  view 
)
static

Sets all delegates for a table.

Todo:

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