It's a bit more efficent to use the record() method without parameters, since you don't need a record populated with data:
QString columnName
= model
->record
().
fieldName( column
);
QString columnName = model->record().fieldName( column );
To copy to clipboard, switch view to plain text mode
The version with headerData() looks like this:
QString columnName
= model
->headerData
( column, Qt
::Horizontal ).
toString();
QString columnName = model->headerData( column, Qt::Horizontal ).toString();
To copy to clipboard, switch view to plain text mode
(although in some cases it might not return the original name of the column).
Bookmarks