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

Martin Salcedo mymundo at gmail.com
Fri Apr 25 18:16:29 BST 2014


Hello all

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

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*


*mymundo at gmail.com <mymundo at gmail.com>skype: mymundo.ar <http://mymundo.ar>
linkedin: ver perfil <http://www.linkedin.com/in/mymundo>*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20140425/9fb3b0e8/attachment.html>


More information about the PyQt mailing list