Warning about non-NOTIFYable properties in QML

I have a QML based application in Qt that generates some warnings at runtime:

QDeclarativeExpression: Expression "(function $text() { return pinyin })" depends on non-NOTIFYable properties: hanzi::DictionaryEntry::pinyin

I believe it refers to this class which has some properties with no notifier (because not needed):

#ifndef DICTIONARYENTRY_H
#define DICTIONARYENTRY_H

namespace hanzi {

class DictionaryEntry : public QObject {

    Q_OBJECT

    Q_PROPERTY(QString simplified READ simplified)
    Q_PROPERTY(QString traditional READ traditional)
    Q_PROPERTY(QString pinyin READ pinyin)
    Q_PROPERTY(QString definition READ definition)

public:

    explicit DictionaryEntry(QObject* parent = 0);
    const QString& simplified() const;
    const QString& traditional() const;
    const QString& pinyin() const;
    const QString& rawDefinition() const;
    const QStringList& definitions() const;
    const QString& definition() const;
    void setSimplified(const QString& v);
    void setTraditional(const QString& v);
    void setPinyin(const QString& v);
    void setDefinitions(const QStringList& v);

};

}
#endif // DICTIONARYENTRY_H

Does anybody know why it's showing these warnings, and, if they are not important, is there any way to disable them?


If the property values can change, then QML needs a NOTIFY signal so it can know when they have changed and update property bindings.

If they can't change, add CONSTANT to your property declaration, for example:

Q_PROPERTY(QString simplified READ simplified CONSTANT).

In your case, there are set methods, which implies the properties can change, but if they don't change when they're being used in your QML, you can get rid of the warnings by marking them as CONSTANT.