python-qt-tools / PyQt5-stubs

Stubs for PyQt5
GNU General Public License v3.0
66 stars 31 forks source link

Cannot access member "DisplayRole" for type "Type[ItemDataRole]" Member "DisplayRole" is unknown #159

Closed ahmedkhalf closed 2 years ago

ahmedkhalf commented 3 years ago
   45 ▏
   46 ▏   def data(self, ind: QModelIndex, role: Qt.ItemDataRole):                                                                                                                            
E  47 ▏   ▏   if role == Qt.ItemDataRole.DisplayRole:     ■ Cannot access member "DisplayRole" for type "Type[ItemDataRole]"    Member "DisplayRole" is unknown
   48 ▏   ▏   ▏   return self.files[ind.row()].name                                                                                                                                           
   49 ▏   ▏   return None    
   47 ▏

Linter: flake8

bluebird75 commented 2 years ago

Indeed. This is fixed in the current git code and will be available along with the next release.

In the meantime, you can install pyqt5-stubs from git directly with :

pip install git+https://github.com/python-qt-tools/PyQt5-stubs
bluebird75 commented 2 years ago

I have just released a new version of PyQt5-stubs. Please upgrade to PyQt5-stubs 5.15.6.0 , this will fix your problem.