Ported from PixlrEditor.kdapp.