eric7/EricWidgets/EricIconBar.py

branch
eric7
changeset 8587
78971b458d25
parent 8584
90391fda03d5
child 8591
7cf4b7bc3d5a
equal deleted inserted replaced
8586:6a315398a554 8587:78971b458d25
162 self.__borderSize, self.__borderSize, 162 self.__borderSize, self.__borderSize,
163 self.__borderSize, self.__borderSize) 163 self.__borderSize, self.__borderSize)
164 164
165 for index, icon in enumerate(self.__icons): 165 for index, icon in enumerate(self.__icons):
166 iconLabel = self.__layout.itemAt(index) 166 iconLabel = self.__layout.itemAt(index)
167 iconLabel.setFixedSize(self.__barSize, self.__barSize) 167 if iconLabel:
168 iconLabel.setPixmap(icon.pixmap(self.__barSize, self.__barSize)) 168 widget = iconLabel.widget()
169 if widget:
170 widget.setFixedSize(self.__barSize, self.__barSize)
171 widget.setPixmap(
172 icon.pixmap(self.__barSize, self.__barSize))
169 173
170 def barSize(self): 174 def barSize(self):
171 """ 175 """
172 Public method to get the icon bar size. 176 Public method to get the icon bar size.
173 177
237 @param label label text to be shown as a tooltip (defaults to "") 241 @param label label text to be shown as a tooltip (defaults to "")
238 @type str (optional) 242 @type str (optional)
239 """ 243 """
240 # the stretch item is always the last one 244 # the stretch item is always the last one
241 self.insertIcon(self.count(), icon, label=label) 245 self.insertIcon(self.count(), icon, label=label)
242 self.__icons.append(QIcon(icon))
243 246
244 def insertIcon(self, index, icon, label=""): 247 def insertIcon(self, index, icon, label=""):
245 """ 248 """
246 Public method to insert an icon into the bar. 249 Public method to insert an icon into the bar.
247 250

eric ide

mercurial