Assuming you have already added them to the button group, you can just get
the list:
http://doc.qt.digia.com/qt/qbuttongroup.html#buttons

But if your buttons were added to a layout in designer, then you can ask
the layout: http://doc.qt.digia.com/qt/qlayout.html
Loop over the count() and itemAt(index) and call widget() on the layoutItem
it gives you.

There are also other ways, if your buttons are all over the place, to call
findChildren() on the common parent somewhere and just search for
QPushButton with certain name patterns.

If I were doing it, I would not lay out all these buttons using designer
because it ends up being messy with buttons all over your ui name space. I
would prefer to create the buttons in code afterwards and store them all in
either a list, or a dict if I need fast access to one by index at any time.



On Wednesday, December 5, 2012, Rishis3D wrote:

> ok, how do i iterate or grab all my Qpush Btn from my UI Python File to
> add them all in to a QButtonGroup ? right now i did manually.. and i hv
> more then 50 buttons...
> beocoz i created my ui file in Qt Designer and converted into a python
> file using pyuic4 module
>
> --
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings:
> http://groups.google.com/group/python_inside_maya/subscribe
>

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to