QPainter save() and restore()
When using QPainter::save(),
"A save() must be followed by a corresponding restore()"
The safest way to ensure this would be to use the RAII idiom, much like in QMutexLocker and friends.
Does such a convenience class already exist for QPainter?
AFAIK it does not. But it should be easy to create one :-)
Yes it is. Took about 5 Minutes.
Still, it's so easy I thought someone would have already done it in Qt.
You could contribute it to Qt via http://www.qt-project.org/
Or leave it as a snippet in the "wiki":/wiki/Category:Snippets for the time being :)