E4Gui/E4ModelToolBar.py

changeset 7
c679fb30c8f3
parent 0
de9c2efb9d02
child 12
1d8dd9706f46
equal deleted inserted replaced
6:52e8c820d0dd 7:c679fb30c8f3
111 111
112 self.clear() 112 self.clear()
113 113
114 for i in range(self.__model.rowCount(self.__root)): 114 for i in range(self.__model.rowCount(self.__root)):
115 idx = self.__model.index(i, 0, self.__root) 115 idx = self.__model.index(i, 0, self.__root)
116 v = QVariant(idx) 116 v = idx
117 117
118 title = idx.data(Qt.DisplayRole).toString() 118 title = idx.data(Qt.DisplayRole)
119 icon = idx.data(Qt.DecorationRole).toPyObject() 119 icon = idx.data(Qt.DecorationRole)
120 if icon == NotImplemented or icon is None: 120 if icon == NotImplemented or icon is None:
121 icon = QIcon() 121 icon = QIcon()
122 folder = self.__model.hasChildren(idx) 122 folder = self.__model.hasChildren(idx)
123 123
124 act = self.addAction(icon, title) 124 act = self.addAction(icon, title)
143 @return index of the action (QModelIndex) 143 @return index of the action (QModelIndex)
144 """ 144 """
145 if action is None: 145 if action is None:
146 return QModelIndex() 146 return QModelIndex()
147 147
148 v = action.data() 148 idx = action.data()
149 if not v.isValid(): 149 if idx is None:
150 return QModelIndex() 150 return QModelIndex()
151 151
152 idx = v.toPyObject()
153 if not isinstance(idx, QModelIndex): 152 if not isinstance(idx, QModelIndex):
154 return QModelIndex() 153 return QModelIndex()
155 154
156 return idx 155 return idx
157 156

eric ide

mercurial