A QML type showing rows and a scroll bar
For part of my Qt Quick project, I need to expose data (including text and numbers in Persian) in rows with four or five columns, similar to a table. Each cell must be able to have a color, font for the text and emit the clicked signal when clicked/touched. The number of rows is various, because they can be added/removed. We should be able to scroll the rows. And we also should be able to search for a specific row using the text column, for example, in a separate row right after the first (title) row.
Is there a built-in QML type that covers the features above all? If yes, what component please? And if not, from where should I start to reach what I want?
Off the top of my head: https://doc.qt.io/qt-5/qml-qtquick-controls2-scrollview.html
There's a couple of ways you can do that.
There are many ways to Rome.
Ow thanks. Which is easier to pick out and better for that non-western language please?
@qcoderpro the text format/Languag doesn't matter either way. QString is able to display them.
Reading more carefully through your opening post.
I think the best option for you would be to create a c++ model do your stuff there (including the search) and expose that to qml.
Probably best to subclass QAbstractItemModel
take a look here for further information:
Sorry, I changed my mind. A table is too and unnecessarily sophisticated for the task which can be simply done using a
ListView. The delegate can be a button with some data (text and numbers etc) and when clicked it shows the thorough version of data inside a dialog box. New lists can also be added and we can scroll up/down the list and remove any list element at will. But I'm not sure I can search for a element given a text, for instance.
If I need to use C++ as the back-end (which is more preferable) instead of a
ListView, probably a suitable abstract class is QAbstractListModel Class. Do you agree up to here? If yes, where can I find an example to start the primary part of the back-end section using that class? It's complicated and I don't know how to derive it in a class. :(