There are a coupe of things which impact image quality.
The two which are not camera dependent are:
Photographer/skill and Lighting
When it comes to the device, there are generally 3 things which impact it. Sensor size, lens quality and generation of the camera (newer ones are better).
The viewfinder type does not directly impact the image quality. The optical has advantages in sports and other things which involve fast panning or very fast objects. It also has an advantage in very low light since the EVF will break down in to mostly noise. The EVF has an advantage to those learning exposure as the EVF (mirrorless) will have a WYSIWYG (what you see is what you get) view. Meaning no need to guess what bumping the exposure...