Alright, so I seemed to have found a workaround. You were on the right track, aocab. I need to run this project as root, and it turns out that root can't connect to the X server. Running xhost as a user worked as expected, but doing it as root produced the same error I was getting when trying to run the project.
A google search led me to this thread:
Most of the suggestions there didn't help much, but doing this:
ssh -X -l root localhost
instead of "su" allows it to work.
So! The question now is, how can I make this work without a workaround? I tried commenting out this line:
in /etc/kde/kdm/kdmrc but it didn't help.