<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>By the way, other types you can use as property types are QPoint, QSize, QColor etc. But it is not possible to customize them.<br>
</p>
<p><br>
</p>
<div id="Signature">
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<p><span dir="ltr"><font face="Calibri,Arial,Helvetica,sans-serif" color="#3366FF" size="2"><span style="font-size:10pt; background-color:white"></span></font></span><span style="color:rgb(117,123,128); font-family:Consolas,monospace">'''</span></p>
<p><span style="color:rgb(117,123,128); font-family:Consolas,monospace"><b><u></u><span style="color:rgb(0,111,201)">Laís Pessine do Carmo</span></b><br>
</span></p>
<p><span style="color:rgb(117,123,128); font-family:Consolas,monospace"></span><font color="#006FC9" size="2"><span style="font-size:11pt; color:rgb(0,0,0)"><span style="font-family:Consolas,monospace; font-size:12pt; color:rgb(117,123,128)">Computer Engineering
</span><span style="font-family:Consolas,monospace; font-size:12pt; color:rgb(117,123,128)">T</span><span style="font-family:Consolas,monospace; font-size:12pt; color:rgb(117,123,128)">rainee at Beamline Software Group</span></span></font><br>
</p>
<font face="Calibri,Arial,Helvetica,sans-serif" color="#3366FF" size="2"><font face="Calibri,Arial,Helvetica,sans-serif"><font face="Calibri,Arial,Helvetica,sans-serif">
<div style="margin-top:0; margin-bottom:0"><font face="Calibri,Arial,Helvetica,sans-serif" color="black" size="3"><span style="font-size:12pt"><font color="#006FC9" size="2"><span style="font-size:11pt"><span style="color:rgb(0,0,0); font-family:Consolas,monospace"><span style="font-family:Consolas,monospace; font-size:12pt; color:rgb(117,123,128)"></span><b><span style="font-family:Consolas,monospace; font-size:12pt; color:rgb(0,111,201)">Brazilian
Synchrotron Light Laboratory - </span></b></span><b><span style="color:rgb(0,111,201); font-family:Consolas,monospace; font-size:12pt">L</span><span style="color:rgb(0,111,201); font-family:Consolas,monospace; font-size:12pt">NLS</span></b></span></font><b><font color="#006FC9" size="2"><span style="font-size:12pt; color:rgb(0,111,201); font-family:Consolas,monospace"><br>
Center of Research in Energy and Materials - CNPEM</span></font></b><font color="#006FC9" size="2"><span style="font-size:12pt; color:rgb(117,123,128); font-family:Consolas,monospace"><br>
+ 55 (11) 94233-772<font color="#006FC9"><font face="Calibri,Arial,Helvetica,sans-serif"></font></font>1 <font color="#006FC9" size="2"><span style="font-size:11pt; color:rgb(0,0,0)"><span style="font-family:Consolas,monospace; font-size:12pt; color:rgb(117,123,128)">/</span></span></font>
<font face="Calibri,Arial,Helvetica,sans-serif" color="#3366FF" size="2"><font face="Calibri,Arial,Helvetica,sans-serif"><font face="Calibri,Arial,Helvetica,sans-serif"><font face="Calibri,Arial,Helvetica,sans-serif" color="black" size="3"><span style="font-size:12pt"><font color="#006FC9" size="2"><span style="font-size:12pt; color:rgb(117,123,128); font-family:Consolas,monospace">Ramal
1226</span></font></span></font></font></font></font></span></font><font color="#006FC9" size="2"><span style="font-size:11pt"><span style="color:rgb(117,123,128); font-family:Consolas,monospace; font-size:12pt"> <span style="background-color:rgb(255,255,255)">
</span></span></span></font><font color="#006FC9" size="2"><span style="font-size:11pt; color:rgb(0,0,0)"><br>
<font color="#006FC9"><a id="LPNoLP" href="http://lnls.cnpem.br"><span style="font-size:14pt; background-color:rgb(255,255,255); color:rgb(0,111,201)"><b>http:/</b></span><b><font color="#006FC9"><span style="font-size:14pt; background-color:rgb(255,255,255); color:rgb(0,111,201)">/</span></font><span style="font-size:14pt; background-color:rgb(255,255,255); color:rgb(0,111,201)">lnls.cnpem.br</span></b></a></font><b><span style="background-color:rgb(255,255,255); color:rgb(0,111,201)"></span></b>
<font face="Calibri,Arial,Helvetica,sans-serif" color="#3366FF" size="2"><font face="Calibri,Arial,Helvetica,sans-serif"><font face="Calibri,Arial,Helvetica,sans-serif"><font face="Calibri,Arial,Helvetica,sans-serif" color="black" size="3"><span style="font-size:12pt"><font color="#006FC9" size="2"><span style="font-size:11pt"><span style="color:rgb(117,123,128); font-family:Consolas,monospace; font-size:12pt"><span style="background-color:rgb(255,255,255)"></span></span><b><span name="searchHitInReadingPane" id="0.768250062297091" class="highlight" style="color:rgb(0,111,201); font-family:Consolas,monospace; font-size:12pt; background-color:rgb(255,255,255)">lais.carmo</span><span name="searchHitInReadingPane" id="0.5587804111142429" class="highlight"></span><span style="color:rgb(117,123,128); font-family:Consolas,monospace; font-size:12pt"><span style="background-color:rgb(255,255,255); color:rgb(0,111,201)">@lnls.b</span><span style="color:rgb(0,111,201)">r</span></span></b></span></font><font color="#006FC9" size="2"><span style="font-size:11pt; color:rgb(0,0,0)"></span></font></span></font></font></font></font><br>
<span style="font-family:Consolas,monospace; font-size:12pt; color:rgb(117,123,128)"></span></span></font></span></font></div>
</font></font></font><span style="color:rgb(117,123,128); font-family:Consolas,monospace; font-size:12pt">'''</span><br>
<p></p>
</div>
</div>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> Lais P. Carmo<br>
<b>Sent:</b> Thursday, September 1, 2016 4:15 PM<br>
<b>To:</b> Kyle Altendorf; pyqt@riverbankcomputing.com<br>
<b>Subject:</b> Re: [PyQt] PyqtProperty types</font>
<div> </div>
</div>
<div>
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hi. Kyle, I used the decorador like <font size="2"><span style="font-size:10pt">@<span name="searchHitInReadingPane" id="0.8533341563734917" class="highlight">pyqt</span>Property(int)</span></font> and worked fine for simple types like int, float, bool.
Thank you very much!</p>
<p><br>
</p>
<p><font size="2"><span style="font-size:10pt">"I would think that while <br>
the Python side of things might be ok with that, I would not expect the <br>
C++/Qt side to fare so well. Also, how would Qt Designer know how to <br>
handle the type. "</span></font></p>
<p><font size="2"><span style="font-size:10pt"><br>
</span></font></p>
<p>Yes, that is what I have in mind too. It is true that I can set each property individually using int, float, bool etc. as type, but using compound types would turn it more organized.</p>
<p>For example, if I have a property called 'range' in a plot widget, I would compose it with two float fields 'min' and 'max'.</p>
<p><br>
</p>
<p>According to some research and attempts, it is possible to use 'PyQt_PyObject' as a type.</p>
<p><br>
</p>
<p></p>
<div><span style="color:rgb(114,50,173)"> @pyqtProperty("PyQt_PyObject")</span><br>
<span style="color:rgb(114,50,173)"> def pyobj(self):</span><br>
<span style="color:rgb(114,50,173)"> return self._pyobj</span><br>
<br>
<span style="color:rgb(114,50,173)"> @pyobj.setter</span><br>
<span style="color:rgb(114,50,173)"> def</span><span style="color:rgb(114,50,173)">
</span><span style="color:rgb(114,50,173)">pyobj(self, value):</span><br>
<span style="color:rgb(114,50,173)"> self._pyobj = value</span></div>
<p></p>
<p><br>
</p>
<p>The plugin which contains this code loads into QtDesigner. However, pyobj property does not show on the editor and, no matter what type _pyobj is, I always get this message:</p>
<p><span style="color:rgb(114,50,173)">"</span><span style="color:rgb(114,50,173)">The property "pyobj" of type (unknown) is not supported yet!</span><span style="color:rgb(114,50,173)">"</span></p>
<p><br>
<span style="color:rgb(114,50,173)"></span></p>
<p><span style="color:rgb(114,50,173)"><span style="color:rgb(0,0,0)">I read some articles saying that m</span><span style="color:rgb(0,0,0)">aybe it is necessary to implement a type in C, interface it to
</span><span style="color:rgb(0,0,0)">Python and register it so Qt can recognize it. But don't know how.</span><span style="color:rgb(0,0,0)">
</span></span></p>
<p><span style="color:rgb(114,50,173)"><span style="color:rgb(0,0,0)">In the docs, it is also said that QVariant can convert user
</span><span style="color:rgb(0,0,0)">Python types</span><span style="color:rgb(0,0,0)">, but nowhere there is a clear explanation.</span></span></p>
<p><span style="color:rgb(0,0,0)"><br>
Any ideias?</span></p>
<p><br>
<span style="color:rgb(114,50,173)"></span></p>
<p><span style="color:rgb(0,0,0)">Thanks for the attention.<br>
</span></p>
<div id="Signature">
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<p><span style="color:rgb(117,123,128); font-family:Consolas,monospace"><br>
</span></p>
<p><span style="color:rgb(117,123,128); font-family:Consolas,monospace">'''</span></p>
<p><span style="color:rgb(117,123,128); font-family:Consolas,monospace"><b><u></u><span style="color:rgb(0,111,201)">Laís Pessine do Carmo</span></b><br>
</span></p>
<p><span style="color:rgb(117,123,128); font-family:Consolas,monospace"></span><font color="#006FC9" size="2"><span style="font-size:11pt; color:rgb(0,0,0)"><span style="font-family:Consolas,monospace; font-size:12pt; color:rgb(117,123,128)">Computer Engineering
</span><span style="font-family:Consolas,monospace; font-size:12pt; color:rgb(117,123,128)">T</span><span style="font-family:Consolas,monospace; font-size:12pt; color:rgb(117,123,128)">rainee at Beamline Software Group</span></span></font><br>
</p>
<font face="Calibri,Arial,Helvetica,sans-serif" color="#3366FF" size="2"><font face="Calibri,Arial,Helvetica,sans-serif"><font face="Calibri,Arial,Helvetica,sans-serif">
<div style="margin-top:0; margin-bottom:0"><font face="Calibri,Arial,Helvetica,sans-serif" color="black" size="3"><span style="font-size:12pt"><font color="#006FC9" size="2"><span style="font-size:11pt"><span style="color:rgb(0,0,0); font-family:Consolas,monospace"><span style="font-family:Consolas,monospace; font-size:12pt; color:rgb(117,123,128)"></span><b><span style="font-family:Consolas,monospace; font-size:12pt; color:rgb(0,111,201)">Brazilian
Synchrotron Light Laboratory - </span></b></span><b><span style="color:rgb(0,111,201); font-family:Consolas,monospace; font-size:12pt">L</span><span style="color:rgb(0,111,201); font-family:Consolas,monospace; font-size:12pt">NLS</span></b></span></font><b><font color="#006FC9" size="2"><span style="font-size:12pt; color:rgb(0,111,201); font-family:Consolas,monospace"><br>
Center of Research in Energy and Materials - CNPEM</span></font></b><font color="#006FC9" size="2"><span style="font-size:12pt; color:rgb(117,123,128); font-family:Consolas,monospace"><br>
+ 55 (11) 94233-772<font color="#006FC9"><font face="Calibri,Arial,Helvetica,sans-serif"></font></font>1 <font color="#006FC9" size="2"><span style="font-size:11pt; color:rgb(0,0,0)"><span style="font-family:Consolas,monospace; font-size:12pt; color:rgb(117,123,128)">/</span></span></font>
<font face="Calibri,Arial,Helvetica,sans-serif" color="#3366FF" size="2"><font face="Calibri,Arial,Helvetica,sans-serif"><font face="Calibri,Arial,Helvetica,sans-serif"><font face="Calibri,Arial,Helvetica,sans-serif" color="black" size="3"><span style="font-size:12pt"><font color="#006FC9" size="2"><span style="font-size:12pt; color:rgb(117,123,128); font-family:Consolas,monospace">Ramal
1226</span></font></span></font></font></font></font></span></font><font color="#006FC9" size="2"><span style="font-size:11pt"><span style="color:rgb(117,123,128); font-family:Consolas,monospace; font-size:12pt"> <span style="background-color:rgb(255,255,255)">
</span></span></span></font><font color="#006FC9" size="2"><span style="font-size:11pt; color:rgb(0,0,0)"><br>
<font color="#006FC9"><a id="LPNoLP" href="http://lnls.cnpem.br"><span style="font-size:14pt; background-color:rgb(255,255,255); color:rgb(0,111,201)"><b>http:/</b></span><b><font color="#006FC9"><span style="font-size:14pt; background-color:rgb(255,255,255); color:rgb(0,111,201)">/</span></font><span style="font-size:14pt; background-color:rgb(255,255,255); color:rgb(0,111,201)">lnls.cnpem.br</span></b></a></font><b><span style="background-color:rgb(255,255,255); color:rgb(0,111,201)"></span></b>
<font face="Calibri,Arial,Helvetica,sans-serif" color="#3366FF" size="2"><font face="Calibri,Arial,Helvetica,sans-serif"><font face="Calibri,Arial,Helvetica,sans-serif"><font face="Calibri,Arial,Helvetica,sans-serif" color="black" size="3"><span style="font-size:12pt"><font color="#006FC9" size="2"><span style="font-size:11pt"><span style="color:rgb(117,123,128); font-family:Consolas,monospace; font-size:12pt"><span style="background-color:rgb(255,255,255)"></span></span><b><span name="searchHitInReadingPane" id="0.768250062297091" class="highlight" style="color:rgb(0,111,201); font-family:Consolas,monospace; font-size:12pt; background-color:rgb(255,255,255)">lais.carmo</span><span name="searchHitInReadingPane" id="0.5587804111142429" class="highlight"></span><span style="color:rgb(117,123,128); font-family:Consolas,monospace; font-size:12pt"><span style="background-color:rgb(255,255,255); color:rgb(0,111,201)">@lnls.b</span><span style="color:rgb(0,111,201)">r</span></span></b></span></font><font color="#006FC9" size="2"><span style="font-size:11pt; color:rgb(0,0,0)"></span></font></span></font></font></font></font><br>
<span style="font-family:Consolas,monospace; font-size:12pt; color:rgb(117,123,128)"></span></span></font></span></font></div>
</font></font></font><span style="color:rgb(117,123,128); font-family:Consolas,monospace; font-size:12pt">'''</span><br>
<p></p>
</div>
</div>
<br>
<br>
<div style="color:rgb(0,0,0)">
<div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> PyQt <pyqt-bounces@riverbankcomputing.com> on behalf of Kyle Altendorf <sda@fstab.net><br>
<b>Sent:</b> Monday, August 29, 2016 8:30 PM<br>
<b>To:</b> pyqt@riverbankcomputing.com<br>
<b>Subject:</b> Re: [PyQt] PyqtProperty types</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt">
<div class="PlainText">On 2016-08-29 15:31, David Morris wrote:<br>
> On Mon, Aug 29, 2016 at 8:27 PM, Lais P. Carmo <lais.carmo@lnls.br> <br>
> wrote:<br>
> <br>
>> 2) How can I create a property which is composed by others? An example <br>
>> of this kind is the property geometry of QWidget class: it is composed <br>
>> by X, Y, Width and Height properties.<br>
> <br>
> Don't over think this, it is not complicated. You have functions used <br>
> to get and set each property value ... anything can be done inside a <br>
> function. _Anything._ Just recombine data in a different format. A <br>
> property doesn't even have to be connected to a real variable if you <br>
> have a way of generating the data.<br>
<br>
I know we can return anything but in either form of a pyqtProperty <br>
definition you are supposed to specify the type of the property in <br>
addition to returning something of that type. I would think that while <br>
the Python side of things might be ok with that, I would not expect the <br>
C++/Qt side to fare so well. Also, how would Qt Designer know how to <br>
handle the type. Even if we take the simple approach of a compound <br>
property containing other properties, in what structure? A regular <br>
class inheriting from QObject? A dict? An ordered dict? I tried a few <br>
but they didn't work with various errors.<br>
<br>
Does anyone have examples of compound typed pyqtProperty's? If it's <br>
possible I would love to learn how.<br>
<br>
Cheers,<br>
-kyle<br>
_______________________________________________<br>
PyQt mailing list PyQt@riverbankcomputing.com<br>
<a href="https://www.riverbankcomputing.com/mailman/listinfo/pyqt">https://www.riverbankcomputing.com/mailman/listinfo/pyqt</a></div>
</span></font></div>
</div>
</div>
</div>
</div>
</body>
</html>