[Qt-interest] [Properties] The NOTIFY signal, and the READ and WRITE functions

Louis Du Verdier zemassacreur at yahoo.fr
Thu Jan 28 15:23:33 CET 2010


Hello,

In a project, I have to use properties with the NOTIFY signal. So I have declared the following property :
Q_PROPERTY(bool myProperty READ getValue WRITE setValue NOTIFY valueChanged);
In my opinion, the READ and WRITE functions, like the NOTIFY signal, should not be managed by me, but I don't manage them, my compilator say that my code have mistakes.
It don't say anything if I write my WRITE function like it :
void MyWidget::setValue(bool v)
{
        value = QVariant(v);
        emit valueChanged(v);
}
But if we have to manage the acessor/... functions, what is the utility of properties ? So I think my code is wrong, and that I have forgoten something.

Thanks,
Louis.



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100128/e45f8981/attachment.html 


More information about the Qt-interest-old mailing list