39 @rtype any |
39 @rtype any |
40 """ |
40 """ |
41 if index.row() < 0 or index.row() >= self.rowCount(index.parent()): |
41 if index.row() < 0 or index.row() >= self.rowCount(index.parent()): |
42 return None |
42 return None |
43 |
43 |
44 if role == Qt.ToolTipRole: |
44 if role == Qt.ItemDataRole.ToolTipRole: |
45 if ( |
45 if ( |
46 self.__manager.downloads()[index.row()] |
46 self.__manager.downloads()[index.row()] |
47 .downloadedSuccessfully() |
47 .downloadedSuccessfully() |
48 ): |
48 ): |
49 return self.__manager.downloads()[index.row()].getInfoData() |
49 return self.__manager.downloads()[index.row()].getInfoData() |
106 @type QModelIndex |
106 @type QModelIndex |
107 @return flags |
107 @return flags |
108 @rtype Qt.ItemFlags |
108 @rtype Qt.ItemFlags |
109 """ |
109 """ |
110 if index.row() < 0 or index.row() >= self.rowCount(index.parent()): |
110 if index.row() < 0 or index.row() >= self.rowCount(index.parent()): |
111 return Qt.NoItemFlags |
111 return Qt.ItemFlag.NoItemFlags |
112 |
112 |
113 defaultFlags = QAbstractListModel.flags(self, index) |
113 defaultFlags = QAbstractListModel.flags(self, index) |
114 |
114 |
115 itm = self.__manager.downloads()[index.row()] |
115 itm = self.__manager.downloads()[index.row()] |
116 if itm.downloadedSuccessfully(): |
116 if itm.downloadedSuccessfully(): |
117 return defaultFlags | Qt.ItemIsDragEnabled |
117 return defaultFlags | Qt.ItemFlag.ItemIsDragEnabled |
118 |
118 |
119 return defaultFlags |
119 return defaultFlags |
120 |
120 |
121 def mimeData(self, indexes): |
121 def mimeData(self, indexes): |
122 """ |
122 """ |