문제

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

도움이 되었습니까?

해결책

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);
    }
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top