Hello everybody!!I am quite new to PyQt and programming.I am trying to populate a QTreeView from an sqlite3 database ,but with no success. My database has this form:
column1 | columnn2
-------------------------------------------------
sth1\sth2\sth3 |
sth4\sth5 | value00
sth6\sth7\sth8 |
sth9\sth10\sth11\sth12 | value01
sth9\sth10\st11\sth13 | value02

The QTreeView will have two columns and will look like this:

sth1
|-----sth2
|-----sth3
sth4
|-----sth5 |---value00
sth6
|-----sth7
|-----sth8
sth9
|-----sth10
|-----sth11
|-----sth12 |----value01
|-----sth13 |----value02

I searched the internet and I found that I must use QSqlDatabase,QSqlTableModel and QSqlQuery.
I created the database inside my gui code using these :
db = QtSql.QSqlDatabase.addDatabase('QSQLITE')
db.setDatabaseName('mydatabasename.db')
if not db.open():
QtGui.QMessageBox.warning(None,"My Program", QString("Database Error: %1").arg(db.lastError().text()))
return False

query=QtSql.QSqlQuery()
query.exec_('CREATE TABLE IF NOT EXISTS mytable (mypaths TEXT , myvalues TEXT)')
and this:
query.exec_("INSERT INTO mytable VALUES(?,?)", (…,…))

I read some of Summerfield 's chapters and I know how to create the QTreeView and that as a model I have to use QSqlTableModel:
self. model=QSqlTableModel(self)
self. model.setTable(“mytable”)
self. model.select()
but I have absolutely no idea what to do next. I don’t know how to put the database’s data into the QTreeView!
I would really appreciate any king of help!!!!Thanks in advance!!!!!