eric6/E5Gui/E5ModelMenu.py

changeset 7366
bd743eacfbca
parent 7360
9190402e4505
child 7533
88261c96484b
equal deleted inserted replaced
7365:da7e4df94076 7366:bd743eacfbca
264 @param parent reference to the parent object (QObject) 264 @param parent reference to the parent object (QObject)
265 @return reference to the created action (QAction) 265 @return reference to the created action (QAction)
266 """ 266 """
267 fm = QFontMetrics(self.font()) 267 fm = QFontMetrics(self.font())
268 if self.__maxWidth == -1: 268 if self.__maxWidth == -1:
269 self.__maxWidth = fm.width('m') * 30 269 try:
270 self.__maxWidth = fm.horizontalAdvance("m") * 30
271 except AttributeError:
272 self.__maxWidth = fm.width('m') * 30
270 smallText = fm.elidedText(text, Qt.ElideMiddle, self.__maxWidth) 273 smallText = fm.elidedText(text, Qt.ElideMiddle, self.__maxWidth)
271 274
272 return QAction(icon, smallText, parent) 275 return QAction(icon, smallText, parent)
273 276
274 def __actionTriggered(self, action): 277 def __actionTriggered(self, action):

eric ide

mercurial