def __init__(self, help_instance): QPushButton.__init__(self, "Toggle Help") self.setContentsMargins(1, 1, 1, 1) self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.setFont(QFont('SansSerif', 12)) self.setAutoDefault(False) self.setDefault(False) self.help_instance = help_instance self.clicked.connect(self.toggle_help)
def __init__(self, help_instance, help_text, informative_text = None): QPushButton.__init__(self, "?") self.setFont(QFont('SansSerif', 12)) self.setFlat(True) self.setFixedWidth(15) self.setFixedHeight(20) self.help_text = help_text self.informative_text = informative_text self.help_instance = help_instance self.clicked.connect(self.show_message) self.destroyed.connect(lambda: help_instance.remove_button(self)) # This uses a trick to send an extra parameter.
def __init__(self, action, parent): """ @param action: action to bound button with @type action: QAction @param parent: parent widget to bound button to @type parent: QWidget """ QPushButton.__init__(self, parent) self.__action = action self.__action.changed.connect(self._synchronizeButtonState) self.clicked.connect(self.__action.trigger) self._synchronizeButtonState()
def __init__(self, parent=None): self.hamburger = QImage(128, 128, QImage.Format_ARGB32) QPushButton.__init__(self, parent) self.svgrenderer = QSvgRenderer("icons\\hamburger.svg") paint = QPainter(self.hamburger) paint.setRenderHint(QPainter.HighQualityAntialiasing) paint.setRenderHint(QPainter.SmoothPixmapTransform) self.svgrenderer.render(paint) paint.end() pixmap = QPixmap() self.setIcon(QIcon(pixmap.fromImage(self.hamburger))) self.setStyleSheet("QPushButton, QPushButton:pressed{background-color: rgba(0,0,0,0)} QPushButton:hover {background-color: rgba(255,255,255,100); border-radius: 32px} ")
def __init__(self, parent=None): self.hamburger = QImage(128, 128, QImage.Format_ARGB32) QPushButton.__init__(self, parent) self.svgrenderer = QSvgRenderer("icons\\hamburger.svg") paint = QPainter(self.hamburger) paint.setRenderHint(QPainter.HighQualityAntialiasing) paint.setRenderHint(QPainter.SmoothPixmapTransform) self.svgrenderer.render(paint) paint.end() pixmap = QPixmap() self.setIcon(QIcon(pixmap.fromImage(self.hamburger))) self.setStyleSheet( "QPushButton, QPushButton:pressed{background-color: rgba(0,0,0,0)} QPushButton:hover {background-color: rgba(255,255,255,100); border-radius: 32px} " )
def __init__(self, atomic_number, parent=None): QPushButton.__init__(self, parent) self.setFixedSize(40, 40) self._atomic_number = atomic_number self._symbol = ep.symbol(atomic_number) self.setText(self._symbol) font = self.font() font.setWeight(QFont.Bold) self.setFont(font) self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding) self.setDefault(False) self.setAutoDefault(False)
def __init__ ( self, icon, slot ): """ Initialise the button. icon is either the name of an image file or one of the QStyle.SP_* values. """ QPushButton.__init__( self ) # Get the current style. sty = QApplication.instance().style() # Get the minimum icon size to use. ico_sz = sty.pixelMetric( QStyle.PM_ButtonIconSize ) if isinstance( icon, basestring ): pm = pixmap_cache( icon ) # Increase the icon size to accomodate the image if needed. pm_width = pm.width() pm_height = pm.height() if ico_sz < pm_width: ico_sz = pm_width if ico_sz < pm_height: ico_sz = pm_height ico = QIcon( pm ) else: ico = sty.standardIcon( icon ) # Configure the button. self.setIcon( ico ) self.setMaximumSize( ico_sz, ico_sz ) self.setFlat( True ) self.setFocusPolicy( Qt.NoFocus ) QObject.connect( self, SIGNAL( 'clicked()' ), slot ) #-- EOF ------------------------------------------------------------------------
def __init__( self, icon=None, text=None, parent=None, ): if icon: QPushButton.__init__(self, icon, text, parent) elif text: QPushButton.__init__(self, text, parent) else: QPushButton.__init__(self, parent) self.badge_counter = 0x00 self.badge_size = 50 self.redGradient = QRadialGradient(0.0, 0.0, 17.0, self.badge_size - 3, self.badge_size - 3) self.redGradient.setColorAt(0.0, QColor(0xe0, 0x84, 0x9b)) self.redGradient.setColorAt(0.5, QColor(0xe9, 0x34, 0x43)) self.redGradient.setColorAt(1.0, QColor(0xdc, 0x0c, 0x00))
def __init__( self, icon=None, text=None, parent=None, ): if icon: QPushButton.__init__(self, icon, text, parent) elif text: QPushButton.__init__(self, text, parent) else: QPushButton.__init__(self, parent) self.badge_counter = 0x00 self.badge_size = 50 self.redGradient = QRadialGradient(0.0, 0.0, 17.0, self.badge_size - 3, self.badge_size - 3) self.redGradient.setColorAt(0.0, QColor(0xe0, 0x84, 0x9b)) self.redGradient.setColorAt(0.5, QColor(0xe9, 0x34, 0x43)) self.redGradient.setColorAt(1.0, QColor(0xdc, 0x0c, 0x00))
def __init__(self, *args, **kwargs): QPushButton.__init__(self, *args, **kwargs) self.installEventFilter(self) self.clickedX = 0 self.clickedY = 0
def __init__(self, parent=None): QPushButton.__init__(self, parent) self._painted = False
def __init__(self, label): QPushButton.__init__(self) self.setText(label)
def __init__(self, parent = None): QPushButton.__init__(self, parent) self._painted = False
def __init__(self, category, table): """ Initialize the Delete Button """ self.category = category self.table = table QPushButton.__init__(self, QIcon(resource_manager.GetResourceFilePath("erase.png")), "") self.clicked.connect(self.deleteCategory)