TomASS
1st October 2011, 21:47
Hello all!
I've started developing my programs using MVC. I've:
model = new QSqlQueryModel;
model->setQuery("SELECT ID_t, ID_podmiot FROM m_transporty LIMIT 0 , 30");
if(model->lastError().isValid())
qDebug() << model->lastError();
ui->tableView->setModel(model);
Works beautifully!
Now - how do I now edit a data (eg in the "line" table)? How to call a cell editing (I click on it and nothing happens), and later as the values ​​(for example, when you click "save") write to the database?
I know I can read all the data in the model, but probably not the point of MVC. Since I changed one record (row) is what I overexpose the entire model?
Can I implement editing only in the model?
How do I add or delete a record not only the model but also from the database?
Thanks!
I've started developing my programs using MVC. I've:
model = new QSqlQueryModel;
model->setQuery("SELECT ID_t, ID_podmiot FROM m_transporty LIMIT 0 , 30");
if(model->lastError().isValid())
qDebug() << model->lastError();
ui->tableView->setModel(model);
Works beautifully!
Now - how do I now edit a data (eg in the "line" table)? How to call a cell editing (I click on it and nothing happens), and later as the values ​​(for example, when you click "save") write to the database?
I know I can read all the data in the model, but probably not the point of MVC. Since I changed one record (row) is what I overexpose the entire model?
Can I implement editing only in the model?
How do I add or delete a record not only the model but also from the database?
Thanks!