Issue
in maya one creates a button with:
cmds.button('buttonname', label='click me')
where buttonname is the name of the button object. At a later stage i can edit the button simply by calling:
cmds.button('buttonname', e=1, label='click me again')
Now the problem: i created a bunch of buttons in qt using a loop:
for s in Collection:
file = os.path.splitext(s)[0]
# Main widget
widgetItem = QtWidgets.QWidget()
layoutItem = QtWidgets.QVBoxLayout()
widgetItem.setLayout(layoutItem)
# Button
button = QtGui.QPushButton()
button.setObjectName(file)
layoutItem.addWidget(button)
How can i call/edit one of them using the button name?
Thanks in advance
Solution
Assuming you already have access to their parent widget, you can find them by findChild
method.
In C++ syntax, it would be something like this:
QPushButton *button = parentWidget->findChild<QPushButton *>("button1");
where button1
is the name of that button.
Answered By - frogatto
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.