David_Hansson | 2020-06-07 08:12:07 UTC | #1
Hi, if I want to call the value (as a string say) from the model (through a buttonclick from a pushbutton in the mainwidget), not through clicking in a cell in the QTableView but giving the information through a pair of integers. lets say row 0, column 0. Given the structure in the tutorial "Displaying tabular data in Qt5 ModelViews" https://www.pythonguis.com/courses/model-views/qtableview-modelviews-numpy-pandas/
I try value = self.model.data(0, 0, QModelIndex(), Qt.DisplayRole).toString()
But it doesnt work. (it crashes the app.)
scaracciolo | 2020-06-30 12:26:15 UTC | #2
Hi David!
You could try,
Purchasing Power Parity
Developers in [[ country ]] get [[ discount.discount_pc ]]% OFF on all books & courses with code [[ discount.coupon_code ]]Index = self.model.index(0, 0) value = self.model.data(index, Qt.DisplayRole)
David_Hansson | 2020-06-09 05:58:57 UTC | #3
PyQt/PySide 1:1 Coaching with Martin Fitzpatrick — Get one on one help with your Python GUI projects. Working together with you I'll identify issues and suggest fixes, from bugs and usability to architecture and maintainability.
This worked. Thank you.
Create GUI Applications with Python & Qt5 by Martin Fitzpatrick — (PyQt5 Edition) The hands-on guide to making apps with Python — Over 10,000 copies sold!