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:
{
if (value.isValid() && role == Qt::DisplayRole) {
if (index.column() == 8 && value==99){
return value.toString().replace("99","0");
}
return value;
}
QVariant ModelLProd::data(const QModelIndex &index, int role) const
{
QVariant value = QSqlQueryModel::data(index, role);
if (value.isValid() && role == Qt::DisplayRole) {
if (index.column() == 8 && value==99){
return value.toString().replace("99","0");
}
return value;
}
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.
Bookmarks