I want to use QPainter's transform setup to convert coordinates in my system into the device's system (including zoom) but I don't want to apply those same changes to pens. Currently I have tried:

Qt Code:
  1. QTransform trans = painter->transform();
  2. painter->resetTransform();
  3.  
  4. QPen pen = painter->pen();
  5. pen.setWidth(new_width);
  6. painter->setPen(pen);
  7.  
  8. painter->setTransform(trans);
To copy to clipboard, switch view to plain text mode 

This isn't working. After this call the pen is this giant rectangle rather than a two pixel line.

Any ideas?