vendredi 2 janvier 2015

PyQt4 Qsql How to get data from a relational database and display them

I'm trying to get data from a database with 4 Relational tables and display them, how exactly do i do that? this is a second tab within the main application, I opened the database now how do i get the four tables to show up within a table? or using splitters? :S



from PyQt4.QtGui import *
from PyQt4.QtSql import *
from PyQt4.QtCore import *

class Window(QWidget):
def __init__(self):
super().__init__()
self.initUI()

def initUI(self):

db = QSqlDatabase.addDatabase('Example')
db.setDatabaseName('Example.db')
db.open()
model = QSqlTableModel(self)

Aucun commentaire:

Enregistrer un commentaire