'Update the rankModel.'

def updateRankModel(self, measuresMask):

    values = []
    diff = (len(self.measure_scores) - len(measuresMask))
    if len(measuresMask):
        measuresMask += ([measuresMask[(-1)]] * diff)
    for i in range((self.ranksModel.columnCount() - 1), len(self.measure_scores), (-1)):
        self.ranksModel.removeColumn(i)
    for (i, (scores, m)) in enumerate(zip(self.measure_scores, measuresMask)):
        if ((not m) and self.ranksModel.item(0, (i + 1))):
            values.append([])
            continue
        values_one = []
        for (j, _score) in enumerate(scores):
            values_one.append(_score)
            item = self.ranksModel.item(j, (i + 1))
            if (not item):
                item = ScoreValueItem()
                self.ranksModel.setItem(j, (i + 1), item)
            item.setData(_score, Qt.DisplayRole)
        values.append(values_one)
    for (i, (vals, m)) in enumerate(zip(values, measuresMask)):
        if (not m):
            continue
        valid_vals = [v for v in vals if (v is not None)]
        if valid_vals:
            (vmin, vmax) = (min(valid_vals), max(valid_vals))
            for (j, v) in enumerate(vals):
                if (v is not None):
                    ratio = float(((v - vmin) / ((vmax - vmin) or 1)))
                    item = self.ranksModel.item(j, (i + 1))
                    item.setData(ratio, gui.BarRatioRole)
    self.ranksView.setColumnWidth(0, 20)
    self.ranksView.resizeRowsToContents()
