How does
Qt Code:
  1. lsn.deleteLesson(ui->tableView_lessons->currentIndex())
To copy to clipboard, switch view to plain text mode 
In your button clicked calling function relate to
Qt Code:
  1. void lessons::deleteLesson(QModelIndex index)
  2. {
  3. QSqlTableModel *model = this->lessonsTable()
  4. .....
  5. }
To copy to clipboard, switch view to plain text mode 

You are passing a tableview index in the calling function to who knows what in the deleteLesson slot.

Also have you connected the signal and slot properly?