It didn't work because view will take header data from model as you set model & implemented header data in model.
try this: you need to do all the manipulations in model only
QVariant CityModel
::headerData(int section, Qt
::Orientation orientation,
int role
) const {
if (role == Qt::DisplayRole)
{
if((0 == section ) && (orientation == Qt::Horizontal)
else
return cities[section];
}
}
QVariant CityModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if (role == Qt::DisplayRole)
{
if((0 == section ) && (orientation == Qt::Horizontal)
return QVariant("Name");
else
return cities[section];
}
return QVariant();
}
To copy to clipboard, switch view to plain text mode
Bookmarks