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();
    itemDelegate->setItemEditorFactory(editorFactory);
    @

    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,
    Miguel


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.