The default module icons are special in OMNeT++5. You can manipulate them with the old getDisplaysString()/setTag() API. Changing the icon is pretty straightforward: set thefirst argument of
i tag in the module's displaystring.
The new API (that you were trying is just for anything else you want to draw on the canvas).
ps: we were considering replacing the old icon code with the new API making the whole UI much more versatile and also uniform, but at the end we have dropped that for OMNeT++ 5 because it would have introduced too much incompatibilities...