Answer the question
In order to leave comments, you need to log in
How to remove the limit on the number of displayed records in the tableView?
Good afternoon.
I am using Python 3.4.4 and PyQt 4.11.4. In the program, you need to display data from the SQLite database into a table. I drew a tableView and display all the records there:
db_connect = QtSql.QSqlDatabase.addDatabase("QSQLITE")
db_connect.setDatabaseName("datebase.db")
db_connect.open()
model = QtSql.QSqlQueryModel(parent = main_window)
model.setQuery("SELECT * FROM table")
model.setHeaderData(1, QtCore.Qt.Horizontal, "Дата")
model.setHeaderData(2, QtCore.Qt.Horizontal, "Тип")
model.setHeaderData(3, QtCore.Qt.Horizontal, "Номер")
main_window.tableView.setModel(model)
main_window.tableView.setColumnHidden(0, True)
main_window.tableView.resizeColumnsToContents()
main_window.tableView.horizontalHeader().setStretchLastSection(True)
db_connect.close()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question