D
D
Deterok2015-05-05 09:41:22
Qt
Deterok, 2015-05-05 09:41:22

How to remove C++ pointer from QML?

There is a custom view that uses QAbstractTableModel. I register it as "Uncreateble type". And there is a special method that correctly generates data for my tabular model. I would like to learn how to delete pointers now. Is there a design pattern?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel K, 2015-05-05
@Deterok

From a comment to the question:
Returning where? Back to QML?
Creating a pointer in one class and deleting it in another is not desirable, but it is possible.
If working with a pointer within the same class, this is quite normal.
In my opinion, it would be correct to call the model function from QML (Q_INVOKABLE or through Q_PROPERTY), which is just passed your "link to the file" and it itself creates the desired class, transforms it and deletes the created class.
Or take out the function for creating a class and transforming it into another class altogether and do everything within it, giving only data to the model.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question