Hello all, this is a bit of a strange one. I have a subclass of QPushButton called simply Button, and I lay out a .ui file full of Buttons. I give them names and custom styles in QT Designer, but when examining these names and styles in Button's __init__() they're always blank. (This is after the call to super().__init__(…).)
Here's the relevant fragment.
def __init__(self, parent=None, showHitRects=False):
self.keepActiveLook = False
super().__init__(parent, showHitRects=showHitRects)
print('name', self.objectName(), self.styleSheet())
class Button(QPushButton, TouchMarginPlugin):
def __init__(self, parent=None, showHitRects=False):
self.keepActiveLook = False
super().__init__(parent, showHitRects=showHitRects)
print('name', self.objectName(), self.styleSheet())
To copy to clipboard, switch view to plain text mode
name and stylSheet are always ''. The name and styleSheet print correctly when I query them later, from a parent panel's __init__.
Does anyone know why this is happening, or how to retrieve the original name when the object's being __init__'d?
Thanks!
–DDR
Bookmarks