[Interest] QSqlTableModel -- best approach for simple database application?

K. Frank kfrank29.c at gmail.com
Mon May 21 22:03:09 CEST 2012

Hi List!

I'm looking to build a simple database utility application.  The main goal is
to have a tool for conveniently viewing and editing some pre-defined tables.

(This is indeed related to my previous post about SQLite -- I am planning
to use SQLite as the database, barring advice to the contrary.)

I've started browsing the SQL Table Model example in the 4.8 documentation
(sql/tablemodel/tablemodel.cpp), but I seem to recall some discussions
suggesting that QSqlTableModel has some limitations or problems that
might make it not the best choice.

What approach would people suggest for building such an application?
My main goal is simplicity of design and ease of development.  I am
not looking to build a "slick" application nor am I particularly rigid in what
the user of the tool (primarily me) will have to do to use it.  The tables
involved will not be very large -- perhaps hundreds of rows, but probably
not thousands.

As a possible enhancement, I might want the data to be edited to be
displayed in the application based on views in the database, rather
than raw tables, or possibly in terms of "views" constructed with
application logic (e.g., various select statements), but I wouldn't
bother with this if it added much complexity to the application.

Any suggestions for how to approach building such an application
would be greatly appreciated.

(And if the answer is "copy the sql/tablemodel/ example, and tweak
it as needed," that would be fine.)


K. Frank

More information about the Interest mailing list