[Development] About ALIAS in Q_PROPERTY

Mikhail Svetkin mikhail.svetkin at gmail.com
Tue Mar 18 10:37:07 CET 2014


>
> I'm also not sure if it's worth it. Perhaps using Q_PRIVATE_PROPERTY gets
> us
> close enough?


 Q_PRIVATE_PROPERTY allows only pointer and can't use
ui->object->nextObject or ui_->getObject().


2014-03-12 18:36 GMT+06:00 Simon Hausmann <simon.hausmann at digia.com>:

> On Wednesday 12. March 2014 12.48.20 Olivier Goffart wrote:
> > On Monday 10 March 2014 17:43:35 Giuseppe D'Angelo wrote:
> > > Can you please explain what this feature is about, why do you think
> > > it's useful, how it's supposed to be used, etc.?
> > >
> > > On 10 March 2014 17:30, mikhail.svetkin at gmail.com
> > >
> > > <mikhail.svetkin at gmail.com> wrote:
> > > > Hello, I would like to clarify wherein the complexity
> > > > (https://codereview.qt-project.org/#change,80412)?
> > > > Ready to listen to any suggestions and implement them.
> >
> > This is a follow-up on the earlier discussion:
> > "About Q_PROPERTY in custom widget plugin for designer"
> >
> > Svetkin's first idea was to extend the READ and WRITE attributes to be
> more
> > complex expressions such as:
> >
> >   Q_PROPERTY(QString label READ ui->customWidget->label
> >                            WRITE ui->customWidget->setLabel)
> >
> > And he even made a patch for it: (
> https://codereview.qt-project.org/77758)
> > There was small issues with the patch. Notably on how complex can the
> > expression be, and also on the fact that it would still be hard to have a
> > NOTIFY signal.
> >
> > I was also wondering if it would not be better to copy QML's idea of
> > property aliases:
> >
> >  Q_PROPERTY(QString label ALIAS CustomWidget ui->customWidget->label)
> >
> > However, now that Svetkin proposed a patch, I feel that it is not so
> much of
> > a good idea. I think the syntax is not so nice especially the need to
> have
> > both the class name and the 'path' to the property. And also because the
> > notify signal is still not automatic.
> >
> > And overall, i find myself preferring the first idea better. Hence I
> would
> > like more opinions from the list.
> >
> > The other question is if we should have that at all. How common is it to
> > have property alias like this?
>
> I'm also not sure if it's worth it. Perhaps using Q_PRIVATE_PROPERTY gets
> us
> close enough?
>
>
> My worry would be that it has to work together with QML, which requires an
> API
> to resolve aliases at run-time, in order to install bindings on the _real_
> property and not the alias (and therefore also remove a previously
> installed
> binding).
>
> The alias implementation QML goes through quite some lengths to achieve
> that
> and the automatic connect to the notify signal.
>
>
> Simon
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20140318/4f1b4fd3/attachment.html>


More information about the Development mailing list