Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class window_b(QtGui.QDialog):
- def __init__(self,parent=None):
- super(window_b, self).__init__(parent)
- window_a.setEnabled(False)
- self.ui = Ui_Form_window_b()
- self.ui.setupUi(self)
- self.setFocusPolicy(QtCore.Qt.StrongFocus)
- def mouseMoveEvent (self,event):
- source= self.sender()
- #print source.name()
- # The action I want to do when the mouse is over the button:
- source.setStyleSheet("background-color:#66c0ff;border-radiuββs: 5px;")
- print source.name()
- AttributeError: 'NoneType' object has no attribute 'name'
- class window_b(QtGui.QDialog):
- def __init__(self,parent=None):
- super(window_b, self).__init__(parent)
- window_a.setEnabled(False)
- self.ui = Ui_Form_window_b()
- self.ui.setupUi(self)
- self.setFocusPolicy(QtCore.Qt.StrongFocus)
- # Get all the buttons (you probably don't want all of them)
- buttons = self.findChildren(QtGui.QAbstractButton)
- for button in buttons:
- button.installEventFilter(self)
- def eventFilter(self, obj, event):
- if event.type() == QtCore.QEvent.Enter:
- print("mouse entered %s" % obj.objectName())
- elif event.type() == QtCore.QEvent.Leave:
- print("mouse leaved %s" % obj.objectName())
- return super(window_b, self).eventFilter(obj, event)
- QPushButton {
- border: 1px solid black;
- padding: 5px;
- }
- QPushButton:hover {
- border: 1px solid black;
- border-radius: 5px;
- background-color:#66c0ff;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement