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): |