Hey guys, I have a PyQt4 question for you. I have a layout containing only a bunch of checkboxes, and rather than querying the state of every one manually I want to loop over the items in the layout, then simply grab their label if they are active.
for i in xrange(self.qt_window.verticalLayout_cb.count()):
box = self.qt_window.verticalLayout_cb.itemAt(i)
print box
The problem here is that it's returning them as QWidgetItem, not QCheckBox so I can't work with them. Maybe I am going about this the wrong way?
If you post a small, but complete example it would be easier to test things out; but off the top of my head, layouts wrap widgets in QLayoutItem
s which has a widget()
method on it to retrieve the inner widget.
for i in xrange(self.qt_window.verticalLayout_cb.count()):
box = self.qt_window.verticalLayout_cb.itemAt(i).widget()
print box
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/e004ba0f-c697-45e5-a81a-c4e4f1b92edb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.