Ejemplo n.º 1
0
 def eventFilter(self, o, e):
     if (isinstance(o, QAbstractButton) and
             e.type() == QEvent.Paint):
         # paint by hand (borrowed from QTableCornerButton)
         btn = o
         opt = QStyleOptionHeader()
         opt.initFrom(btn)
         state = QStyle.State_None
         if btn.isEnabled():
             state |= QStyle.State_Enabled
         if btn.isActiveWindow():
             state |= QStyle.State_Active
         if btn.isDown():
             state |= QStyle.State_Sunken
         opt.state = state
         opt.rect = btn.rect()
         opt.text = btn.text()
         opt.position = QStyleOptionHeader.OnlyOneSection
         painter = QStylePainter(btn)
         painter.drawControl(QStyle.CE_Header, opt)
         return True     # eat event
     return False
Ejemplo n.º 2
0
 def eventFilter(o, e):
     if (isinstance(o, QAbstractButton)
             and e.type() == QEvent.Paint):
         # paint by hand (borrowed from QTableCornerButton)
         btn = o
         opt = QStyleOptionHeader()
         opt.initFrom(btn)
         state = QStyle.State_None
         if btn.isEnabled():
             state |= QStyle.State_Enabled
         if btn.isActiveWindow():
             state |= QStyle.State_Active
         if btn.isDown():
             state |= QStyle.State_Sunken
         opt.state = state
         opt.rect = btn.rect()
         opt.text = btn.text()
         opt.position = QStyleOptionHeader.OnlyOneSection
         painter = QStylePainter(btn)
         painter.drawControl(QStyle.CE_Header, opt)
         return True  # eat event
     return False