use view model with only some edit lines
-
Hello,
it's my first project with QT and I have got some lineEdits on my window and I want to update them using (file or read from USB device )
So I want to make the model that can handle reading data from any source based on the clicked button and update the Line edits, and I want my design to follow the View modelI found that QDataWidgetMapper.mapper() should take index -which does not exist in my case I don't use any tableview or trees ,
What is the best practice to handle this case?
also How can i validate user inputs to line Edit in the model view architecture ? -
Hello,
it's my first project with QT and I have got some lineEdits on my window and I want to update them using (file or read from USB device )
So I want to make the model that can handle reading data from any source based on the clicked button and update the Line edits, and I want my design to follow the View modelI found that QDataWidgetMapper.mapper() should take index -which does not exist in my case I don't use any tableview or trees ,
What is the best practice to handle this case?
also How can i validate user inputs to line Edit in the model view architecture ? -
Hi
Please see
https://doc.qt.io/qt-5/qtwidgets-itemviews-simplewidgetmapper-example.htmlYou can use a std item model and fill from your file/usb
model = new QStandardItemModel(5, 3, this);or you can create a custom model that directly can also read itself from the "sources"
https://doc.qt.io/qt-5/qabstractitemmodel.html