[ fromfile: database.xml id: dbmodels ]
Figure 18.2 shows the concrete model classes for connecting to a QTableView.
If you want to show a table that was created after calling Example 18.4, it takes five lines of code with the QSqlTableModel.
Example 18.7. src/libs/tests/testsqlmetadata/testsqlmetadata.cpp
[ . . . . ] void TestSqlMetaData::showTable() { QSqlTableModel model; model.setTable("MetaData"); model.select(); QTableView *view = new QTableView; view->setModel(&model); view->setItemDelegate(new SimpleDelegate(view));
<include segid="tableview" mode="cpp" href="src/libs/tests/testsqlmetadata/testsqlmetadata.cpp" id="sqltablemodel-cpp" src="src/libs/tests/testsqlmetadata/testsqlmetadata.cpp"/>
TESTTRACKS
, and adds metadata for each mp3 file found to the table model.
It is included in the source tarball in from dist.
Generated: 2012-03-02 | © 2012 Alan Ezust and Paul Ezust. |