From: Gelonida on
Hi,

I have have a layout with qt designer, which contains radio buttons.

Now I want to add three buttons into a button group.

doing this manually works fine

with manually I mean adding a few lines in my widget class.
example:
bg = self.buttongroup = Qg.QButtonGroup()
bg.addButton(self.radioButton, 1)
bg.addButton(self.radioButton_2, 2)
bg.addButton(self.radioButton_3, 3)

When I try to create a button group from qt designer, then python code
is created which fails when running:

How I create a button group with qtdesigner.

- I select my three radio buttons
- I right click in the object inspector and select
"Assign to Button Group" -> "New Button Group"

I create my python file with
pyuic4 -o mywidget.py -x mywidget.ui

When I try to use my widget I receive follwoing error:

Traceback (most recent call last):
.. . .
line 37
self.QtGui.QApplication.translate("FormGridState", "buttonGroup",
None, QtGui.QApplication.UnicodeUTF8) = QtGui.QButtonGroup(FormGridState)
SyntaxError: can't assign to function call

The generated code lines for the buttongroup look like:
self.QtGui.QApplication.translate("Form1", "buttonGroup", None,
QtGui.QApplication.UnicodeUTF8) = QtGui.QButtonGroup(Form1)
self.QtGui.QApplication.translate("Form1", "buttonGroup", None,
QtGui.QApplication.UnicodeUTF8).setObjectName("QtGui.QApplication.translate(\"Form1\",
\"buttonGroup\", None, QtGui.QApplication.UnicodeUTF8)")
self.QtGui.QApplication.translate("Form1", "buttonGroup", None,
QtGui.QApplication.UnicodeUTF8).addButton(self.radioButton)


Am I doing something wrong or is this a bug?

I'm running ubuntu 10.4 , and python 2.6