I have a tableview with takes a qsortfilterproxymodel and is filtered by a particular name.

I have subclassed the qsortfilterproxymodel
Qt Code:
  1. class FilterProxyModel : public QSortFilterProxyModel
  2. {
  3. Q_OBJECT
  4. public:
  5. FilterProxyModel(QObject *parent = 0);
  6.  
  7. void moveUp( const int itemIndex);
  8. void moveDown( const int itemIndex);
  9. };
To copy to clipboard, switch view to plain text mode 

and here's the implementation
Qt Code:
  1. FilterProxyModel ::FilterProxyModel (QObject *parent) :
  2. {
  3.  
  4. }
  5.  
  6. void FilterProxyModel ::moveUp(const int itemIndex)
  7. {
  8. if(itemIndex > 0 && itemIndex < rowCount())
  9. {
  10. beginMoveRows(QModelIndex(), itemIndex, itemIndex, QModelIndex(),
  11. itemIndex - 1);
  12. moveRow(QModelIndex(), itemIndex, QModelIndex(), itemIndex - 1);
  13. endMoveRows();
  14. }
  15. }
  16.  
  17. void FilterProxyModel ::moveDown(const int itemIndex)
  18. {
  19. if(itemIndex >= 0 && itemIndex < rowCount() - 1)
  20. {
  21. beginMoveRows(QModelIndex(), itemIndex, itemIndex, QModelIndex(),
  22. itemIndex + 2);
  23. moveRow(QModelIndex(), itemIndex, QModelIndex(), itemIndex + 2);
  24. endMoveRows();
  25. }
  26. }
To copy to clipboard, switch view to plain text mode 

Here's how the model implemented
Qt Code:
  1. m_Model = new FilterProxyModel(this);
  2. m_Model ->setSourceModel(partiesModel);
  3. m_Model ->setFilterRegExp(QRegExp("party", Qt::CaseInsensitive, QRegExp::FixedString));
  4. m_Model ->setFilterKeyColumn(PartyModel::Action);
To copy to clipboard, switch view to plain text mode 

I want to move the items using a push button, when i call the function the move doesn't happen. Could you tell me what I'm missing?