Alignment of Table Horizontal Headers
Hello,
I would like to set the alignment for the horizontal header differently for each column, but it may not be the same as the items in their corresponding column. Help?
Thanks
May 31, 2011
Gerolf
Area 51 Engineer
3210 posts
You can read the docu of QAbstractItemModel::headerData. Afaik, there is no official example, doing this.
Signature
Nokia Certified Qt Specialist.
Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)
May 31, 2011
Eddy
Area 51 Engineer
1296 posts
you could use something like :
QVariant TableModel
:: headerData ( int section
, Qt :: Orientation orientation
, int role
) const
{
...other stuff
if ( orientation
== Qt :: Horizontal )
{
...
if ( role
== Qt :: TextAlignmentRole ) {
if ( col == 1 ) {
}
else {
}
}
hope this gives you some directions
Signature
Qt Certified Specialist
Qt Ambassador
May 31, 2011
Andre
Area 51 Engineer
6031 posts
@ShawnG:
Could you tell us what model and what view you are using? Are you using a QStandardItemModel with a QTableView, or a QTableWidget? Or something else?