QHeaderView Sort Indicator sizing
I have a project with multiple QTableViews with sortable columns. Unfortunately, my users dislike the size of the arrow for the Sort Indicator in the QHeaderView. I've seen that I can change the image in a style sheet, but is there an easy way to just resize what's currently there? I ask, because the image would have to be skin color sensitive (I don't want black on black or something like that -- unless I could make sure it's sunken like the current arrow).
Has anyone done/tried something like this? (I couldn't find anything on the forums, and usually I'm pretty good with searches.)
Thanks,
Vycke
Re: QHeaderView Sort Indicator sizing
How about reimplementing / subclassing the headerview ??
or may be style sheets might also be a good option as u said.
Re: QHeaderView Sort Indicator sizing
Well, I tried the Style Sheet... which worked, except you can't use the Palette with Style Sheets (and since I have user-selectable palettes, able to be changed on the fly, this isn't good).
The QHeaderView is subclassed already in the app, but I have been unable to get paintSection() to override properly -- it appears that all the sections wind up selected/sunken, or it doesn't update the old selected section when you select a new one. I'm probably doing it wrong somehow, so I'll go over some other code I have (that rotates headers 90 degrees) and try this again.
If anyone else has a suggestion, I'm open to it :)
Vycke
Re: QHeaderView Sort Indicator sizing
Ok, just so anyone else trying to do the same thing has an answer, here's what I did:
Code:
//In the constructor for the Header subclass
m_styleSet = "QHeaderView::down-arrow { image: url(:/images/down_arrow.png); width: 13px; height:9px; subcontrol-position: bottom right;} "
"QHeaderView::up-arrow { image: url(:/images/up_arrow.png); subcontrol-position: bottom right; } "
"QHeaderView:: section { color: %1; background-color: %2; }";
this->setStyleSheet(setStyle);
I installed an event filter:
Code:
{
if ((event
->type
() == QEvent::ApplicationPaletteChange) ||
(event
->type
() == QEvent::PaletteChange)) {
this->setStyleSheet(setStyle);
return true;
}
}
This allows for palette changes & still gives me the arrow that I want (the .pngs)
Vycke