Frage

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?(۰,۱,۲,۳,۴,۵,۶,۷,۸,۹)

War es hilfreich?

Lösung

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);
    }
}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top