Hello everybody,
Have a trouble:

I have to delete selected headers in the tableView model. To get this I create two slots:

slotHeadersToBeDeleted slot checks whether selected Item was selected before. If yes (was selected and clicked again then it should be deleted from the vector for deleted headers) other way it should be added to the vector for deleted headers. When the necessary headers have been selected the user should push the button “deleteButton” and the headers are to be deleted.

Qt Code:
  1. Class1
  2. {
  3. …
  4. QVector<int> m_vHeadersToBeDeleted;
  5. QStandardItemModel m_pDataModel;
  6. …
  7. };
  8. …
  9.  
  10. void Class1:: slotHeadersToBeDeleted(int LogicalIndex)
  11. {
  12. bool headerStatus = false;
  13. QVector<int>::iterator i = m_vHeadersToBedeleted.begin();
  14. while (i < m_vHeadersToBedeleted.end())
  15. {
  16. if (*i == LogicalIndex)
  17. {
  18. m_vHeadersToBedeleted.erase(i);
  19. headerStatus = true;
  20. }
  21.  
  22. i++;
  23. }
  24. if (headerStatus) m_vHeadersToBedeleted.push_back(LogicalIndex);
  25. }
  26.  
  27. void Class1::slotDeleteSelectedItems()
  28. {
  29. QVector<int>::iterator i = m_vHeadersToBedeleted.begin();
  30. while (i < m_vHeadersToBedeleted.end())
  31. {
  32. m_pDataModel->removeRow(*i);
  33. i++;
  34. }
  35. }
To copy to clipboard, switch view to plain text mode 


and in the constructor of class Class1 I created two connections:

Qt Code:
  1. connect(m_pTable->verticalHeader(), SIGNAL(sectionClicked(int LogicalIndex)), this, SLOT(slotHeadersToBedeleted(int LogicalIndex)));
  2. connect(m_pDeleteButton, SIGNAL(clicked()), this, SLOT(slotDeleteSelectedItems()));
To copy to clipboard, switch view to plain text mode 

where m_pTable is QTableView object
m_pDeleteButton is a QPushButton

the headers are not deleted. Where am I mistaken?
Thank you.