<div dir="ltr"><div>Since moc is unable to do safety checks for such complex expressions (in this case, `if (ui && ui->customWidget)`), this makes Q_PROPERTY potentially unsafe and the idea has no any value to me.</div>

<div>Simply do s/ui->customWidget/parent()->customWidget/g and imagine what could happen there...</div><div><br></div><div>P.S. @Olivier: "Svetkin" is a family name.</div></div><div class="gmail_extra"><br clear="all">

<div>Regards,<br>Konstantin</div>
<br><br><div class="gmail_quote">2014-03-12 13:48 GMT+02:00 Olivier Goffart <span dir="ltr"><<a href="mailto:olivier@woboq.com" target="_blank">olivier@woboq.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="">On Monday 10 March 2014 17:43:35 Giuseppe D'Angelo wrote:<br>
> Can you please explain what this feature is about, why do you think<br>
> it's useful, how it's supposed to be used, etc.?<br>
><br>
> On 10 March 2014 17:30, <a href="mailto:mikhail.svetkin@gmail.com">mikhail.svetkin@gmail.com</a><br>
><br>
> <<a href="mailto:mikhail.svetkin@gmail.com">mikhail.svetkin@gmail.com</a>> wrote:<br>
> > Hello, I would like to clarify wherein the complexity<br>
> > (<a href="https://codereview.qt-project.org/#change,80412" target="_blank">https://codereview.qt-project.org/#change,80412</a>)?<br>
> > Ready to listen to any suggestions and implement them.<br>
<br>
</div>This is a follow-up on the earlier discussion:<br>
"About Q_PROPERTY in custom widget plugin for designer"<br>
<br>
Svetkin's first idea was to extend the READ and WRITE attributes to be more<br>
complex expressions such as:<br>
<br>
  Q_PROPERTY(QString label READ ui->customWidget->label<br>
                           WRITE ui->customWidget->setLabel)<br>
<br>
And he even made a patch for it: (<a href="https://codereview.qt-project.org/77758" target="_blank">https://codereview.qt-project.org/77758</a>)<br>
There was small issues with the patch. Notably on how complex can the<br>
expression be, and also on the fact that it would still be hard to have a<br>
NOTIFY signal.<br>
<br>
I was also wondering if it would not be better to copy QML's idea of property<br>
aliases:<br>
<br>
 Q_PROPERTY(QString label ALIAS CustomWidget ui->customWidget->label)<br>
<br>
However, now that Svetkin proposed a patch, I feel that it is not so much of a<br>
good idea. I think the syntax is not so nice especially the need to have both<br>
the class name and the 'path' to the property. And also because the notify<br>
signal is still not automatic.<br>
<br>
And overall, i find myself preferring the first idea better. Hence I would<br>
like more opinions from the list.<br>
<br>
The other question is if we should have that at all. How common is it to have<br>
property alias like this?<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Olivier<br>
<br>
Woboq - Qt services and support - <a href="http://woboq.com" target="_blank">http://woboq.com</a> - <a href="http://code.woboq.org" target="_blank">http://code.woboq.org</a><br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
Development mailing list<br>
<a href="mailto:Development@qt-project.org">Development@qt-project.org</a><br>
<a href="http://lists.qt-project.org/mailman/listinfo/development" target="_blank">http://lists.qt-project.org/mailman/listinfo/development</a><br>
</div></div></blockquote></div><br></div>