Solved Table creation with ListView
-
Should be something like: https://pastebin.com/Vetsi5z7
-
Do you need to QML listView or QTableView is enough ? As @VRonin suggested, you can just use the QTableView along with QStandardModel to display it. If you want to display in QML, suggest you to use your own custom model.
-
@dheerendra I can't use QTableView because i'm working with qt 5.11 and developping mobile apps. In 5.11 version QTableView is only available for Desktop apps.
-
-
You are using the QML. You need to write your own model in C++ side to expose the data to qml. Use either ListView or TableView to display the data.
-
@VRonin Thank you
I'll try to use Tableview with custom model. Can i have an idea of how to seperates my data in identifiers payload and length colums?
The second problems is that i'm returning a List of QCanBusFrame. This type of data can't be displayed easily -
Can i have an idea of how to seperates my data in identifiers payload and length colums?
@VRonin said in Table creation with ListView:
Should be something like: https://pastebin.com/Vetsi5z7
This type of data can't be displayed easily
https://wiki.qt.io/How_to_Use_a_Custom_Class_in_C%2B%2B_Model_and_QML_View
-
@VRonin Last question.
Where should I seperate my data into frames? In main file or in model file? -
It's really up to you.
I would create theQCanBusFrame
outside the model and then load it but it's really just a matter of flavour -
const QRegularExpression partsRegExp(R"^\s*(\S+)\s+[(\S+)]\s+(.+?)\s*$");
from your link, this line code generate an error in QT. It says: Invalid character ''.................... -
old compiler?
You can double all the\
and remove theR
at the beginning -
@VRonin Thank you.
I seperated my data successfuly
You can mark it resolved