Graphical toolkits like Qt and GTK+ have backends that communicate with the display server protocol. Note that Wayland is a protocol, not a piece of software (although there are some helpful functions provided by libwayland). In both Wayland and X, the toolkit is in charge of communicating with the display server, and its API’s should abstract all that away, so that any program written using Qt or GTK supports Wayland, X, and whatever display servers are used for OSX and Windows.
Now, because X is so old, it also provides API’s that behave similarly to a GUI toolkit, so you can write a graphical program in pure X. Or, you can rely on a subset of the X API’s to do your windows and widgets and everything else. A browser like Firefox is a good example of this, since it doesn’t use GTK or Qt. In that case, Firefox just needs a Wayland Backend.
Basically you get little issues where an App ties directly into xlib instead of using its toolkit, and then they need to port the app, or use XWayland.