⚠️ Forum Maintenance: Feb 6th, 8am - 14pm (UTC+2)

SQLITE DATETIME field and QItemDelegate

  • Hello,

    It's possible to use a QItemDelegate subclass in a view (model/view classes) to allow editing a DATETIME field
    with a QDateTimeEdit?

    My code looks like this:

    QItemEditorFactory *editorFactory = new QItemEditorFactory();
    QItemEditorCreatorBase *creator = new QStandardItemEditorCreator<QDateTimeEdit>();
    editorFactory->registerEditor(QVariant::DateTime, creator);

    QStyledItemDelegate* itemDelegate = new QStyledItemDelegate();

    As Qt converts the database field in a QVariant::int or a QVariant::String, it's never used the QDateTimeEdit delegate.

    Is there any possibility to force Qt to convert the SQLITE Field in a QVariant::DateTime?

    Thanks in advance,

Log in to reply