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 QLayoutItems 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

​

On 2 April 2015 at 09:14, Erik Spellerberg <[email protected]>
wrote:

> 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?
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/e004ba0f-c697-45e5-a81a-c4e4f1b92edb%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/e004ba0f-c697-45e5-a81a-c4e4f1b92edb%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Marcus Ottosson*
[email protected]

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODD%3DTJpS8VcvXnOXAbFedJffLK1%2B68j7dwizJtm4MB7uQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to