App crashes on model->rowCount()
Solved
General and Desktop
-
The model is a QSqlTableModel. (declared this way: QSqlTableModel *manufacturers_tbl_model;)
In the clicked slot of a pushbutton, I have this code.void RepairDevices::on_manufacturers_add_btn_clicked() { int row = manufacturers_tbl_model->rowCount(); }
And when I click the button, the application just...crashes!!!
What am I doing wrong? -
Hi,
Is manufacturers_tbl_model pointing to something valid ? i.e. did you do
manufacturers_tbl_model = new QSqlTableModel;
in the constructor or RepairDevices ? -
No it's not, you're shadowing your member variable.
-
Yes, that's what I meant.