Pregunta

I have the following QTableWidget: my program

My program is Perisan language in (Persian,Iran) locale,But Qt itself generate a set of number for each row in English language.

My question is, How i change the above numbers to my locale?(۰,۱,۲,۳,۴,۵,۶,۷,۸,۹)

¿Fue útil?

Solución

If you want to use QTableWidget you can set header text yourself with QTableWidget::setVerticalHeaderLabels.

If you switch to model/view approach you can reimplement QAbstractItemModel::headerData:

QVariant MyModel::headerData (int section, Qt::Orientation orientation, int role) const
{
    if (orientation == Qt::Vertical && role == Qt::DisplayRole)
    {
        QString persianDigit = ...;// get number in Persian from section value
        return persianDigit;
    }
    else
    {
         return QAbstractItemModel::headerData(section, orientation, role);
    }
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top