Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QAbstractListModel Cannot call my method in qml
Forum Updated to NodeBB v4.3 + New Features

QAbstractListModel Cannot call my method in qml

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 127 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.
  • M Offline
    M Offline
    Mihaill
    wrote on last edited by Mihaill
    #1

    Hi.
    I have inherited class

    class MarkerModel : public QAbstractListModel
    {
        Q_OBJECT
    

    And I create my method

    public slots:
        void addMarker(const QGeoCoordinate &coordinate);
    

    I register type in main.cpp

    qmlRegisterType<MarkerModel>("MarkerModel", 1,0, "MarkerModel");
    

    In qml I am passing a pointer to this class.
    And I want use all methods: 'rowCount', 'addMarker' and else in qml, but I get error:

    Cannot call methods  'addMarker' of null
    

    How I can fix this?

    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