Setting QTableView column heading
Tomas Sobota
tom at sobota.net
Wed Jun 9 19:52:54 BST 2021
Try qtc.Qt.Horizontal
Tom
On Wed, Jun 9, 2021 at 8:47 PM Rich Shepard <rshepard at appl-ecosys.com>
wrote:
> In a module I import:
> from PyQt5 import QtWidgets as qtw
> from PyQt5 import QtGui as qtg
> from PyQt5 import QtCore as qtc
> from PyQt5 import QtSql as qts
>
> For the model I have these statements:
> self.model = qts.QSqlTableModel()
> self.model.setTable(table_name)
> self.model.setHeaderData(1, Qt.Horizontal, 'Type')
> self.model.select()
>
> When I run the application python tells me:
> $ python activitytypes.py
> []
> Traceback (most recent call last):
> File "activitytypes.py", line 49, in <module>
> window = ActTypes()
> File "activitytypes.py", line 29, in __init__
> self.model.setHeaderData(1, Qt.Horizontal, 'Type')
> NameError: name 'Qt' is not defined
>
> I haven't found where Qt.Horizontal is defined. Changing Qt to qtw, qtg,
> qtc, and qts all generate the same error.
>
> What am I missing?
>
> Rich
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210609/09cdc402/attachment.htm>
More information about the PyQt
mailing list