QWidget *CalendarDelegate::createEditor(QWidget *parent,
                                    const QStyleOptionViewItem& /* option */,
                                    const QModelIndex& /* index */) const {
    QDateEdit *editor = new QDateEdit(parent);
    editor->setCalendarPopup(m_calpopup);
    editor->installEventFilter(const_cast<CalendarDelegate*>(this));
    connect(editor, SIGNAL(editingFinished()), this, SLOT(commitAndCloseEditor()));
    return editor;
}
//------------------------------------------------------------------------------
QWidget* ConditionValueDelegate::createEditor(QWidget* parent,
	const QStyleOptionViewItem& option, const QModelIndex& index) const
{
	switch (field(index))
	{
	case AssignmentRule::Date:
	{
		QDateEdit* dateEditor = new QDateEdit(parent);
		dateEditor = new QDateEdit(parent);
		dateEditor->installEventFilter(new IgnoreUndoRedo(parent, parent));
		dateEditor->setCalendarPopup(true);
		dateEditor->setSpecialValueText(tr("None"));
		return dateEditor;
	}

	case AssignmentRule::Amount:
		return new MoneyEdit(parent);

	default:
		return new LineEdit("", parent);
	}
}