COPASI API  4.16.103
Public Member Functions | List of all members
CQDateTimeEditDelegate Class Reference

#include <CQDateTimeEditDelegate.h>

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

Public Member Functions

 CQDateTimeEditDelegate (QObject *parent=0)
 
QWidget * createEditor (QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
 
void setEditorData (QWidget *editor, const QModelIndex &index) const
 
void setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
 
void updateEditorGeometry (QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const
 

Detailed Description

Definition at line 16 of file CQDateTimeEditDelegate.h.

Constructor & Destructor Documentation

CQDateTimeEditDelegate::CQDateTimeEditDelegate ( QObject *  parent = 0)

Definition at line 17 of file CQDateTimeEditDelegate.cpp.

18  : QItemDelegate(parent)
19 {}

Member Function Documentation

QWidget * CQDateTimeEditDelegate::createEditor ( QWidget *  parent,
const QStyleOptionViewItem &  option,
const QModelIndex &  index 
) const

Definition at line 21 of file CQDateTimeEditDelegate.cpp.

24 {
25  QDateTimeEdit *editor = new QDateTimeEdit(QDateTime::currentDateTime(), parent);
26  return editor;
27 }
void CQDateTimeEditDelegate::setEditorData ( QWidget *  editor,
const QModelIndex &  index 
) const

Definition at line 29 of file CQDateTimeEditDelegate.cpp.

31 {
32  QString dtStr = index.model()->data(index, Qt::EditRole).toString();
33  QDateTimeEdit *dtEdit = static_cast<QDateTimeEdit*>(editor);
34 
35  dtEdit->setDateTime(QDateTime::fromString(dtStr, Qt::ISODate));
36 }
void CQDateTimeEditDelegate::setModelData ( QWidget *  editor,
QAbstractItemModel *  model,
const QModelIndex &  index 
) const

Definition at line 38 of file CQDateTimeEditDelegate.cpp.

40 {
41  QDateTimeEdit *dtEdit = static_cast<QDateTimeEdit*>(editor);
42  QVariant value(dtEdit->dateTime().toString(Qt::ISODate));
43  model->setData(index, value, Qt::EditRole);
44 }
void CQDateTimeEditDelegate::updateEditorGeometry ( QWidget *  editor,
const QStyleOptionViewItem &  option,
const QModelIndex &  index 
) const

Definition at line 46 of file CQDateTimeEditDelegate.cpp.

48 {
49  editor->setGeometry(option.rect);
50 }

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