The morphology–density relation in X-ray-bright galaxy groups