I'm a bit reluctant to make ctkMatrixWidget's code less readable just to please scripting.<div><br></div><div>From <a href="http://pythonqt.sourceforge.net/Features.html">http://pythonqt.sourceforge.net/Features.html</a>: it seems that we need to add our own "handlers" (whatever it means).<div>
I'm not sure what it implies though.</div><div>Julien.<br><br><div class="gmail_quote">On Fri, Aug 19, 2011 at 12:14 PM, Daniel Haehn <span dir="ltr"><<a href="mailto:haehn@bwh.harvard.edu">haehn@bwh.harvard.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi Julien,<br>
<br>
I tried it but it did not change anything.. :/<br>
<font color="#888888"><br>
Daniel<br>
</font><div><div></div><div class="h5"><br>
On Fri, Aug 19, 2011 at 12:03 PM, Julien Finet <<a href="mailto:julien.finet@kitware.com">julien.finet@kitware.com</a>> wrote:<br>
> Maybe QVector<double> needs to be entered in the meta object system.<br>
> Can you try adding<br>
><br>
> qRegisterMetaType<QVector<double> > ("QVector<double>");<br>
><br>
> in the constructor function of ctkMatrixWidget (better: init() of<br>
> ctkMatrixWidgetPrivate if it exists)<br>
> j.<br>
> On Fri, Aug 19, 2011 at 11:55 AM, Daniel Haehn <<a href="mailto:haehn@bwh.harvard.edu">haehn@bwh.harvard.edu</a>><br>
> wrote:<br>
>><br>
>> Hi again,<br>
>><br>
>> so it seems that PythonQt has problems to wrap a QVector<double>. The<br>
>> setValues method is not accesible from python and the values() method<br>
>> returns:<br>
>><br>
>> QVector<double> (C++ Object 0x14c479690)<br>
>><br>
>> rather than a python list. Maybe PythonQt only supports QVector<double*> ?<br>
>><br>
>> Maybe it makes more sense to return a QVariantList which maps to<br>
>> python tuples in PythonQt?<br>
>><br>
>> What do you guys think?<br>
>><br>
>> Thanks,<br>
>> Daniel<br>
>><br>
>> On Wed, Aug 17, 2011 at 7:56 PM, Daniel Haehn <<a href="mailto:haehn@bwh.harvard.edu">haehn@bwh.harvard.edu</a>><br>
>> wrote:<br>
>> > Great, thank you!<br>
>> ><br>
>> > Daniel<br>
>> ><br>
>> > On Wed, Aug 17, 2011 at 7:48 PM, Julien Finet <<a href="mailto:julien.finet@kitware.com">julien.finet@kitware.com</a>><br>
>> > wrote:<br>
>> >> Added in CTK:<br>
>> >><br>
>> >> <a href="https://github.com/commontk/CTK/commit/5ebd60003b230f961bfb5d2c89c17f0ddcb4a151" target="_blank">https://github.com/commontk/CTK/commit/5ebd60003b230f961bfb5d2c89c17f0ddcb4a151</a><br>
>> >> Added in Slicer: r17743<br>
>> >><br>
>> >> <a href="http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=17743" target="_blank">http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=17743</a><br>
>> >> Thanks,<br>
>> >> Julien.<br>
>> >><br>
>> >> On Wed, Aug 17, 2011 at 4:55 PM, Daniel Haehn <<a href="mailto:haehn@bwh.harvard.edu">haehn@bwh.harvard.edu</a>><br>
>> >> wrote:<br>
>> >>><br>
>> >>> Thanks for the feedback,<br>
>> >>><br>
>> >>> I just commited<br>
>> >>><br>
>> >>><br>
>> >>> <a href="https://github.com/haehn/CTK/commit/583a229fce5d99f06b78bab1c3a38cfe4255a328" target="_blank">https://github.com/haehn/CTK/commit/583a229fce5d99f06b78bab1c3a38cfe4255a328</a><br>
>> >>><br>
>> >>> Would be great if we could encounter these changes to upstream and<br>
>> >>> then to Slicer CTK - the EMSegmenter needs it :)<br>
>> >>><br>
>> >>> Thx,<br>
>> >>> Daniel<br>
>> >>><br>
>> >>> On Wed, Aug 17, 2011 at 4:48 PM, Julien Finet<br>
>> >>> <<a href="mailto:julien.finet@kitware.com">julien.finet@kitware.com</a>><br>
>> >>> wrote:<br>
>> >>> > Looks good, except that when populating the values vector<br>
>> >>> > (ctkMatrixWidget::values()), I would call<br>
>> >>> > ctkMatrixWidget::value(i,j)<br>
>> >>> > instead of manually querying the data in order to factorize code.<br>
>> >>> > Thanks,<br>
>> >>> > Julien.<br>
>> >>> > p.s.I agree that setValues() would also beneficiate from some<br>
>> >>> > refactorization as well, but it's another story...<br>
>> >>> ><br>
>> >>> > On Wed, Aug 17, 2011 at 4:15 PM, Daniel Haehn<br>
>> >>> > <<a href="mailto:haehn@bwh.harvard.edu">haehn@bwh.harvard.edu</a>><br>
>> >>> > wrote:<br>
>> >>> >><br>
>> >>> >> Hi guys,<br>
>> >>> >><br>
>> >>> >> could you please review<br>
>> >>> >><br>
>> >>> >><br>
>> >>> >><br>
>> >>> >><br>
>> >>> >> <a href="https://github.com/haehn/CTK/tree/add-SetValuesQPropertyMatrixWidget-feature" target="_blank">https://github.com/haehn/CTK/tree/add-SetValuesQPropertyMatrixWidget-feature</a><br>
>> >>> >><br>
>> >>> >> Thx,<br>
>> >>> >> Daniel<br>
>> >>> >><br>
>> >>> >> On Tue, Aug 16, 2011 at 3:57 PM, Jean-Christophe Fillion-Robin<br>
>> >>> >> <<a href="mailto:jchris.fillionr@kitware.com">jchris.fillionr@kitware.com</a>> wrote:<br>
>> >>> >> > +1 for setValues<br>
>> >>> >> > Jc<br>
>> >>> >> ><br>
>> >>> >> > On Tue, Aug 16, 2011 at 3:11 PM, Julien Finet<br>
>> >>> >> > <<a href="mailto:julien.finet@kitware.com">julien.finet@kitware.com</a>><br>
>> >>> >> > wrote:<br>
>> >>> >> >><br>
>> >>> >> >> Because a "Q_PROPERTY adds features through the meta-object<br>
>> >>> >> >> system".<br>
>> >>> >> >> Practically in this case, it allows the property to be wrapped<br>
>> >>> >> >> with<br>
>> >>> >> >> python, and initial values can also be set directly via the<br>
>> >>> >> >> Designer.<br>
>> >>> >> >> As a more philosophical point, the matrix "values" are a<br>
>> >>> >> >> "property"<br>
>> >>> >> >> of<br>
>> >>> >> >> the<br>
>> >>> >> >> matrix.<br>
>> >>> >> >> Julien.<br>
>> >>> >> >> On Tue, Aug 16, 2011 at 3:04 PM, Daniel Haehn<br>
>> >>> >> >> <<a href="mailto:haehn@bwh.harvard.edu">haehn@bwh.harvard.edu</a>><br>
>> >>> >> >> wrote:<br>
>> >>> >> >>><br>
>> >>> >> >>> Hi Julien,<br>
>> >>> >> >>><br>
>> >>> >> >>> why do you think a Q_PROPERTY is better? Anyway, I will give it<br>
>> >>> >> >>> a<br>
>> >>> >> >>> shot<br>
>> >>> >> >>> and let you know.<br>
>> >>> >> >>><br>
>> >>> >> >>> Cheers,<br>
>> >>> >> >>> Daniel<br>
>> >>> >> >>><br>
>> >>> >> >>> On Tue, Aug 16, 2011 at 1:48 PM, Julien Finet<br>
>> >>> >> >>> <<a href="mailto:julien.finet@kitware.com">julien.finet@kitware.com</a>><br>
>> >>> >> >>> wrote:<br>
>> >>> >> >>> > Either that or we make a Q_PROPERTY named "values":<br>
>> >>> >> >>> > Q_PROPERTY( QVector<double> values READ values WRITE<br>
>> >>> >> >>> > setValues)<br>
>> >>> >> >>> > There is already:<br>
>> >>> >> >>> > ctkMatrixWidget::setVector(QVector<double>),<br>
>> >>> >> >>> > maybe<br>
>> >>> >> >>> > it<br>
>> >>> >> >>> > could be renamed into setValues and values() should then also<br>
>> >>> >> >>> > be<br>
>> >>> >> >>> > written.<br>
>> >>> >> >>> > Julien.<br>
>> >>> >> >>> ><br>
>> >>> >> >>> > On Tue, Aug 16, 2011 at 12:37 PM, Daniel Haehn<br>
>> >>> >> >>> > <<a href="mailto:haehn@bwh.harvard.edu">haehn@bwh.harvard.edu</a>><br>
>> >>> >> >>> > wrote:<br>
>> >>> >> >>> >><br>
>> >>> >> >>> >> Hi guys,<br>
>> >>> >> >>> >><br>
>> >>> >> >>> >> it seems that it is not possible to set a value of a<br>
>> >>> >> >>> >> ctkMatrixWidget<br>
>> >>> >> >>> >> from Python?<br>
>> >>> >> >>> >><br>
>> >>> >> >>> >> Shall we just enable Q_INVOKABLE on the<br>
>> >>> >> >>> >> ctkMatrixWidget::setValue<br>
>> >>> >> >>> >> method?<br>
>> >>> >> >>> >><br>
>> >>> >> >>> >> Thanks,<br>
>> >>> >> >>> >> Daniel<br>
>> >>> >> >>> >> _______________________________________________<br>
>> >>> >> >>> >> Ctk-developers mailing list<br>
>> >>> >> >>> >> <a href="mailto:Ctk-developers@commontk.org">Ctk-developers@commontk.org</a><br>
>> >>> >> >>> >><br>
>> >>> >> >>> >><br>
>> >>> >> >>> >> <a href="http://public.kitware.com/cgi-bin/mailman/listinfo/ctk-developers" target="_blank">http://public.kitware.com/cgi-bin/mailman/listinfo/ctk-developers</a><br>
>> >>> >> >>> ><br>
>> >>> >> >>> ><br>
>> >>> >> >><br>
>> >>> >> >><br>
>> >>> >> >> _______________________________________________<br>
>> >>> >> >> Ctk-developers mailing list<br>
>> >>> >> >> <a href="mailto:Ctk-developers@commontk.org">Ctk-developers@commontk.org</a><br>
>> >>> >> >><br>
>> >>> >> >> <a href="http://public.kitware.com/cgi-bin/mailman/listinfo/ctk-developers" target="_blank">http://public.kitware.com/cgi-bin/mailman/listinfo/ctk-developers</a><br>
>> >>> >> >><br>
>> >>> >> ><br>
>> >>> >> ><br>
>> >>> >> ><br>
>> >>> >> > --<br>
>> >>> >> > <a href="tel:%2B1%20919%20869%208849" value="+19198698849">+1 919 869 8849</a><br>
>> >>> >> ><br>
>> >>> >> ><br>
>> >>> ><br>
>> >>> ><br>
>> >><br>
>> >><br>
>> ><br>
><br>
><br>
</div></div></blockquote></div><br></div></div>