Hi all,

I'm stuck in a bizarre error. I cannot return nothing but simple colors as BackgroundColorRole in my QAbstractItemModel's derived class

If I put some code like this in headerData method :

Qt Code:
  1. case Qt::BackgroundColorRole :
  2. {
  3. QLinearGradient gradient ( 0, 0, 1, 1);
  4. gradient.setColorAt ( 0,QColor::fromRgb (10*section,20*section,100+10*section ));
  5. gradient.setColorAt ( 1, QColor::fromRgb ( 255,255,255 ) );
  6. return QBrush ( gradient );
  7. }
To copy to clipboard, switch view to plain text mode 

my grid shows it's header(s) absolutely black.

I've tested the same code in a much simpler model I've created some time ago to test my grid and model and shows the expected result :
Captura-Simple Extended Grid TEST ( extending Qt's (c) Simple Tree model ).jpg

but when I've translated those 4 lines of code into my very-much-complex application doesn't crash, but shows a "nice" black header ( and if I put this code inside data () method, shows a white background, not the black one )

Any clues ? Where can I search ? I've been debugging and my model returns in both cases the same QBrush. And when I return a QColor, it works OK...

Qt Code:
  1. case Qt::BackgroundColorRole :
  2. return QColor::fromRgb (10*section,20*section,100+10*section ));
To copy to clipboard, switch view to plain text mode 

This is a capture of my grid, returning a Qbrush for headers & a QColor for Band header :
Captura-Estudios Planificación y Costes.jpg

I'll pay some virtual beers to the one that can point me to a valid clue !!