[Interest] Wrong position QStyleOptionProgressBar on macOS

Max Paperno max-l at wdg.us
Fri Mar 20 21:43:49 CET 2020


On 3/20/2020 3:46 PM, John Weeks wrote:
> Alot of QStyle code seems to think that all drawing will be done in a widget solely occupied by whatever it is that QStyle is drawing.

Drawing should be done starting at the given 
QStyleOption.rect.topLeft(). I don't think any of the drawing methods 
assume pos(0, 0) (if they do that does sound like a bug). Am I missing 
something?

> I finally did this for QStyleProgressBar:
>   	QStyleOptionProgressBar options;
>   		painter->translate(r.left, r.top);
> 		options.rect.moveTo(0,0);

Assuming "r" is QStyleOptionViewItem.rect (if we're still talking about 
item views/delegates), why not just set QStyleOptionProgressBar.rect to 
the same coordinates? What is options.rect.topLeft() before the move?

-Max


More information about the Interest mailing list