Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Adding more attached properties to Accessible - cannot assign to non-existent property
Forum Updated to NodeBB v4.3 + New Features

Adding more attached properties to Accessible - cannot assign to non-existent property

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 218 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bjdm
    wrote on last edited by
    #1

    Hi,

    I've been trying to add an additional extended property to Accessible in an effort to see if I can get labelledBy etc. to work but am having an issue accessing the new attached property (cannot assign to non-existent property "labelledBy").

    I have copied the implementation of description in qtdeclarative/src/quick/items/qquickaccessibleattached_p.h and changed to property name to labelledBy, but it is otherwise exactly the same ie. a simple QString property. To test this, I have set Accessible.labelledBy: "test" in a KDE application (tokodon) built against my own libQt5Quick.so which has been confirmed with ldd and cat /proc/$(pidof tokodon)/maps | grep Quick.

    A patch of the changes is here:

    diff --git a/src/quick/items/qquickaccessibleattached_p.h b/src/quick/items/qquickaccessibleattached_p.h
    index c24bce7bda..24110f10d4 100644
    --- a/src/quick/items/qquickaccessibleattached_p.h
    +++ b/src/quick/items/qquickaccessibleattached_p.h
    @@ -88,6 +88,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickAccessibleAttached : public QObject
         Q_PROPERTY(QAccessible::Role role READ role WRITE setRole NOTIFY roleChanged FINAL)
         Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged FINAL)
         Q_PROPERTY(QString description READ description WRITE setDescription NOTIFY descriptionChanged FINAL)
    +    Q_PROPERTY(QString labelledBy READ labelledBy WRITE setLabelledBy NOTIFY labelledByChanged FINAL)
         Q_PROPERTY(bool ignored READ ignored WRITE setIgnored NOTIFY ignoredChanged FINAL)
     
         QML_NAMED_ELEMENT(Accessible)
    @@ -146,6 +147,15 @@ public:
             }
         }
     
    +    QString labelledBy() const { return m_labelledBy; }
    +    void setLabelledBy(const QString &labelledBy)
    +    {
    +        if (m_labelledBy != labelledBy) {
    +            m_labelledBy = labelledBy;
    +            Q_EMIT(labelledByChanged());
    +        }
    +    }
    +
         // Factory function
         static QQuickAccessibleAttached *qmlAttachedProperties(QObject *obj);
     
    @@ -205,6 +215,7 @@ Q_SIGNALS:
         void roleChanged();
         void nameChanged();
         void descriptionChanged();
    +    void labelledByChanged();
         void ignoredChanged();
         void pressAction();
         void toggleAction();
    @@ -226,6 +237,7 @@ private:
         QString m_name;
         bool m_nameExplicitlySet = false;
         QString m_description;
    +    QString m_labelledBy;
     
         static QMetaMethod sigPress;
         static QMetaMethod sigToggle;
    

    I get the feeling I'm likely missing something obvious as everything appears to be as it should, my only though is maybe moc is doing something funny so I have cleaned and rebuilt and still the same result so I'm really not sure.

    Any help would be much appreciated.

    Many thanks,
    Brent

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved