[Qt-interest] SQLITE3 and column type
Andre Somers
andre at familiesomers.nl
Mon Oct 11 18:41:06 CEST 2010
Op 11-10-2010 13:21, Wilhelm schreef:
> Am 11.10.2010 11:07, schrieb Raul Metsma:
>> Subclass QSqlQueryModel/QSqlTableModel and return on data( QModelIndex
>> &, Qt::DisplayType/Qt::EditType ) QDateTime
>>
> That leds to a table-specific table-model ...
>
> I did it actually with a specific QItemDelegate for that column.
>
> But I was looking for a possibility to "override" the column-type of the
> sqlite-table (which is "text"), so that the QItemEditorFactory could
> pick the right delegate.
>
Well, you could do that trick from a proxy model, that you equip with a
bit of API to set a mapping for each column of what the data type should
be. That is not too hard. You can then reuse that proxy without
hard-coding the mappings for a specific table. Of course, this will
break as soon as you actually use SQLite's option to store different
types in the same column...
André
More information about the Qt-interest-old
mailing list