Esempio n. 1
0
 def add_action(self, text, toggle=False, iconpath=None):
     child = ToolbarAction()
     if iconpath:
         image = QImage(iconpath)
         qsize = QtCore.QSize(24, 24)
         image = image.scaled(qsize)
         pixmap = QPixmap.fromImage(image)
         iconw = QIcon(pixmap)
         action = self.widget.addAction(iconw, text, child._cb_redirect)
     else:
         action = self.widget.addAction(text, child._cb_redirect)
     action.setCheckable(toggle)
     child.widget = action
     self.add_ref(child)
     return child
Esempio n. 2
0
 def add_action(self, text, toggle=False, iconpath=None):
     child = ToolbarAction()
     if iconpath:
         image = QImage(iconpath)
         qsize = QtCore.QSize(24, 24)
         image = image.scaled(qsize)
         pixmap = QPixmap.fromImage(image)
         iconw = QIcon(pixmap)
         action = self.widget.addAction(iconw, text,
                                        child._cb_redirect)
     else:
         action = self.widget.addAction(text, child._cb_redirect)
     action.setCheckable(toggle)
     child.widget = action
     self.add_ref(child)
     return child