[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: [PyQt] Fwd: How to implement QRadioButton with QDataWidgetMapper?
From: Martin Salcedo <mymundo () gmail ! com>
Date: 2014-04-25 17:16:29
Message-ID: CAAYUDuSx26GwKXZruhibgQzyeQQ7YEd7VmW8iH4bpN9dO1UE9w () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
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@gmail.com <mymundo@gmail.com>skype: mymundo.ar <http://mymundo.ar>
linkedin: ver perfil <http://www.linkedin.com/in/mymundo>*
[Attachment #5 (text/html)]
<div dir="ltr"><div class="gmail_quote"><div><div><div dir="ltr"><br><div \
class="gmail_quote"><div dir="ltr"><div style="font-family:verdana,sans-serif">Hello \
all</div><div style="font-family:verdana,sans-serif"> <br></div><div \
style="font-family:verdana,sans-serif">
I have a trouble undestanding the way to implement this QRadioButton with \
QDataWidgetMapper. </div><div style="font-family:verdana,sans-serif"><br></div><div \
style="font-family:verdana,sans-serif">
I have some radiobuttons gruped into a MyButtonGroup (custom QButtonGroup).</div><div \
style="font-family:verdana,sans-serif">The MyButtonGroup is this:</div><div \
style="font-family:verdana,sans-serif">
<br></div><div><div><font color="#0000ff" face="courier new, monospace"><b><div>from \
PyQt4.QtCore import pyqtProperty</div><div> from PyQt4 import \
QtGui,Qt</div><div><br></div></b></font></div><div><font color="#0000ff" \
face="courier new, monospace"><b>class \
MyButtonGroup(QtGui.QWidget):</b></font></div><div>
<font color="#0000ff" face="courier new, monospace"><b> __chequedvalue = \
None</b></font></div><div><font color="#0000ff" face="courier new, \
monospace"><b><br></b></font></div><div>
<font color="#0000ff" face="courier new, monospace"><b> \
@pyqtProperty(int)</b></font></div><div><font color="#0000ff" face="courier new, \
monospace"><b> def checkedValue(self):</b></font></div>
<div><font color="#0000ff"><b><span style="font-family:'courier \
new',monospace"> return \
self.__chequedvalue</span><br></b></font></div><div><font color="#0000ff" \
face="courier new, monospace"><b><br>
</b></font></div><div><font color="#0000ff" face="courier new, monospace"><b> \
@checkedValue.setter</b></font></div><div><font color="#0000ff" face="courier new, \
monospace"><b> def setCheckedValue(self, value):</b></font></div>
<div><font color="#0000ff" face="courier new, monospace"><b> #... here \
will implement the rbutton.setChecked(True)</b></font></div><div><span \
style="font-family:'courier new',monospace"><font color="#0000ff"><b> \
self.__chequedvalue = value</b></font></span><br>
</div></div><div><div dir="ltr"><font color="#888888"><font \
style="color:rgb(0,0,153)" face="verdana, sans-serif"><br></font></font></div><div \
dir="ltr"><font color="#888888"><font style="color:rgb(0,0,153)" face="verdana, \
sans-serif"><div style="color:rgb(0,0,0);display:inline">
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. </div></font></font></div><div dir="ltr">
<font color="#888888"><font style="color:rgb(0,0,153)" face="verdana, \
sans-serif"><div style="color:rgb(0,0,0);display:inline"><br></div></font></font></div><div \
dir="ltr"><font color="#888888"><font style="color:rgb(0,0,153)" face="verdana, \
sans-serif"><div style="color:rgb(0,0,0);display:inline">
My doubt is when I link the Object and addMapping pass the thirth parameter, like \
this. </div><br></font></font></div><div dir="ltr"><font \
style="font-family:verdana,sans-serif" color="#888888"><font \
style="color:rgb(0,0,153)" size="4"><b><div \
style="font-family:verdana,sans-serif;color:rgb(0,0,0);display:inline">
<br></div></b></font></font></div><div dir="ltr"><font color="#0000ff" face="courier \
new, monospace"><b><font><div style="display:inline">mapper = QData</div></font><div \
style="display:inline">
Widget</div><div style="display:inline">Mapper()</div></b></font></div><div \
dir="ltr"><div style="display:inline"><font color="#0000ff" face="courier new, \
monospace"><b>...</b></font></div>
</div><div dir="ltr"><font color="#0000ff" face="courier new, monospace"><div \
style="display:inline"><b>editor = MyButtonGroup()</b></div></font></div><div \
dir="ltr"><font color="#0000ff" face="courier new, monospace"><div \
style="display:inline">
<b>...</b></div></font></div><div dir="ltr"><font color="#0000ff"><div \
style="display:inline"><b><font face="courier new, \
monospace">mapper.addMapping(editor,colnr,"checkedValue")</font><br>
</b></div></font></div><div dir="ltr"><font><font size="4"><b><div \
style="display:inline"><font color="#000000" face="verdana, \
sans-serif"><br></font></div></b></font></font></div><div dir="ltr"> <font \
style="font-family:verdana,sans-serif" color="#888888"><font \
style="color:rgb(0,0,153)"><div \
style="font-family:verdana,sans-serif;color:rgb(0,0,0);display:inline">When the \
interface and objects are loaded, the values changed the to objects is not reflected \
to the mapper. </div>
</font></font></div><div dir="ltr"><br></div><div dir="ltr"><div \
style="font-family:verdana,sans-serif">Do you have examples?</div></div><div \
dir="ltr"><font style="font-family:verdana,sans-serif" color="#888888"><font \
style="color:rgb(0,0,153)"><div \
style="font-family:verdana,sans-serif;color:rgb(0,0,0);display:inline">
<br></div></font></font></div><div dir="ltr"><font \
style="font-family:verdana,sans-serif" color="#888888"><font \
style="color:rgb(0,0,153)"><div \
style="font-family:verdana,sans-serif;color:rgb(0,0,0);display:inline">
Best Regards, </div></font></font></div><span><font color="#888888"><div \
dir="ltr"><font style="font-family:verdana,sans-serif" color="#888888"><font \
style="color:rgb(0,0,153)"><div \
style="font-family:verdana,sans-serif;color:rgb(0,0,0);display:inline">
<br></div></font></font></div><div dir="ltr"><br></div><div dir="ltr"><font \
style="font-family:verdana,sans-serif" color="#888888"><font \
style="color:rgb(0,0,153)" size="4"><b><br><span style="color:rgb(11,83,148)">Martin \
Salcedo</span></b></font><br style="color:rgb(0,0,153)">
<font size="1"><i><span style="color:rgb(11,83,148)"><a \
href="mailto:mymundo@gmail.com" \
target="_blank">mymundo@gmail.com</a></span><br>skype: <a href="http://mymundo.ar" \
target="_blank">mymundo.ar</a><br>
linkedin: <a href="http://www.linkedin.com/in/mymundo" target="_blank">ver \
perfil</a></i></font> </font></div></font></span></div> </div>
</div><br></div>
</div></div></div><br></div>
[Attachment #6 (text/plain)]
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic