When used space in computer exceeds 90% of total storage the color of progressbar(On status bar) changes to NegativeBackground of KColorScheme
Indeed, screenshots would be nice. Thanks for the patch!
I would also say that the threshold might be better set at 90% than 80%. The typical recommendation *for any OS) is to leave 10% of the boot disk free, which a threshold of 90% would match.
Not sure why I was added as reviewer... anyway:
- no need to use this-> to call own class members, unless there is a conflict (which does not look like)
- please never hardcode colors! use KColorScheme instead
- it does not seem that the palette is reverted back when the space changes to less than the threshold
Why KColorScheme::Selection ? That should be used for items that can be selected.
We should probably use KColorScheme::Window instead
Why QPalette::Highlight ? That's supposed to be used for the selected text's color
What's the second setBrush() needed for?
The intension is to colorize the 'progressbar', which uses Highlight color from the palette. For styles that draw the progressbar text inside the progress bar, you need to also change the HighlightedText color, to ensure that the text stays readable on the changed background.
Thank you for pointing this out.
Default KCapactityBar style uses palette().window().color() to get its filling color (QPalette::Base color).
But breeze uses:
//! styled painting for KCapacityBar QStyle::ControlElement CE_CapacityBar;
My curront code works for breeze but not for Fusion.
Using for fusion :
So I guess I have to cover the two cases, breeze and more fusion like themes.
Could you please first update the code here to request feedback? I still see new_palette.setBrush(QPalette::Highlight, colorScheme.foreground(KColorScheme::ActiveText)) which is wrong, because QPalette::Highlight is a background color role, not a foreground color role.
Well as I said breeze uses QPalette::Highlight to draw CapacityBar ( rendered as ProgressBar by breeze) in breezestyle.cpp Style::drawProgressBarContentsControl( const QStyleOption* option, QPainter* painter, const QWidget* ) const
So I have updated the code to handle both case : breeze style and Fusion based style.
I have added screenshots to the commit comment.