blob: e125314de9001551297b1957ab3fe0c711c22bad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
from __future__ import annotations
import sys
from PySide6.QtSql import QSqlQueryModel
from PySide6.QtWidgets import QTableView, QApplication
import createdb
from bookdelegate import BookDelegate
if __name__ == "__main__":
app = QApplication()
createdb.init_db()
model = QSqlQueryModel()
model.setQuery("select title, author, genre, year, rating from books")
table = QTableView()
table.setModel(model)
table.setItemDelegate(BookDelegate())
table.resize(800, 600)
table.show()
sys.exit(app.exec())
|