ich habe eine QTableView, die die Daten aus meinem Model darstellt.
Im Modell habe ich die methode headerData ueberschrieben um die Text & Hintergrundfarbe der einzelnen Spalten-Header anzugeben.
Die Vordergrundfarbe passt, die hintergrundfarbe nur solange ich nicht in die table clicke, dann wird sie so ausgegraut... Die TExtfarbe bleibt korret...
Weiss jemand woran das liegen koennten....
Im Modell hab ich sowas :
Code: Alles auswählen
QVariant
MyTableModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if(orientation == Qt::Horizontal) {
if(section < m_pilotColumnList.size()) {
if(role == Qt::DisplayRole) {
QVariant v(m_pilotColumnList[section].pColumnData->displayedName);
return v;
}
else if(role == Qt::BackgroundRole) {
// LOG_DEBUG("headerdata***");
return m_pilotColumnList[section].header_bgColor;
}
else if(role == Qt::ForegroundRole) {
return m_pilotColumnList[section].header_fgColor;
}
else if(role == Qt::ToolTipRole) {
return m_pilotColumnList[section].pColumnData->description;
}
}
}
else if(orientation == Qt::Vertical) {
if(role == Qt::DisplayRole) {
return section+1;
}
}
return QVariant();
}
Gruss,
Nando