The UK has a legal/constitutional system that appears, on the surface, to say one thing, but in reality says something else. On paper, de jure, the monarch has all the power, the parliament operates in their name, they appoint and dissolve the parliament, they sign all the laws, etc.
However in reality, parliament has all the power. The queen has no veto on laws, if they were to refuse to sign a law, they would have to resign (or there'd be a civil war). In theory the queen appoints the government and prime minister, but they must appoint the person who parliament has choose. In theory PM goes to the queen to dissolve parliament, but the queen cannot refuse. The monarch has mo power anymore is more of a formality.
And the Act of Settlement of 1700ish defines that only the protestant descendeds of Sophie of Hanover can be monarch. This is an example of Parliament defining who is (and more importantly for the Stuarts) who cannot be monarch.