[odb-users] ODB and QAbstractItemModel

Boris Kolpackov boris at codesynthesis.com
Thu Mar 5 06:38:06 EST 2015

Hi Brian,

Bourke-Martin, Brian <bbourke-martin at darkfield.com> writes:

>   I am currently using ODB for a project and I have also been looking to
> display some of the data objects in a Qt table.  Qt has a data model system
> by which you inherit from QAbstractItemModel but in the process you need to
> use "Qt"-ify the code using the CMake function QT4_WRAP_CPP.  Before I just
> down the rabbit hole attempting to run the odb and Qt function on the same
> code, I just was wondering if anyone else had attempted to do this.

I am not familiar with QAbstractItemModel or QT4_WRAP_CPP bit seeing
that nobody more knowledgable is pitching in, my suggestion is this:

Keep your object model (that is, the persistent classes) as simple
and any framework-free as possible. I would just keep them pure C++11
but in Qt that may prove difficult to interact with the rest of the
framework, so maybe I would use the fundamental types from QtCore
(e.g., QString, QSharedPointer, etc) but that's it.


More information about the odb-users mailing list