So I have a QTableView, QSqlQueryModel as its model, what I want is to set up the data displayed in column Y inside that table based on data from column X.

Below is the code I have for changing the data of the column based on it's own data:
Qt Code:
  1. QVariant ModelLProd::data(const QModelIndex &index, int role) const
  2. {
  3. QVariant value = QSqlQueryModel::data(index, role);
  4. if (value.isValid() && role == Qt::DisplayRole) {
  5. if (index.column() == 8 && value==99){
  6. return value.toString().replace("99","0");
  7. }
  8. return value;
  9. }
To copy to clipboard, switch view to plain text mode 
So basically in index.column()==8 I have percentages and if the value==99 I want to go to index.column()==9 and return value.toString().replace("99","0")

Any ideeas? As I ran out of them.