[PyQt] Fwd: How to implement QRadioButton with QDataWidgetMapper?

Martin Salcedo mymundo at hotmail.com
Thu May 15 17:08:47 BST 2014

Hello all

I have a trouble undestanding the way to implement this QRadioButton with

I have some radiobuttons gruped into a MyButtonGroup (custom QButtonGroup).
The MyButtonGroup is this:

*from PyQt4.QtCore import pyqtProperty from PyQt4 import QtGui,Qt*
*class MyButtonGroup(QtGui.QWidget):*
*    __chequedvalue = None*

 *    @pyqtProperty(int)*
*    def checkedValue(self):*

*        return self.__chequedvalue*

*    @checkedValue.setter*
*    def setCheckedValue(self, value):*
*        #... here will implement the rbutton.setChecked(True)*
*        self.__chequedvalue = value*

​I created this because the radiobuttons can not be connected directly with
a QDataWidgetMapper, then the property checkedValue is going to manage the
checked state of the radiobuttons.

My doubt is when I link the Object and addMapping pass the thirth
parameter, like this.

*mapper = QData WidgetMapper()*
*editor = MyButtonGroup()*

*mapper.addMapping(editor,colnr,"checkedValue") *

 ​When the interface and objects are loaded, the values changed the to
objects is not reflected to the mapper.

​Do you have examples?

Best Regards,

*Martin Salcedo*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20140515/c7d1a3cb/attachment.html>

More information about the PyQt mailing list