The result of "fidling" with X would have been a clear understanding of why the error message appears in the first place.
Well, I don't see how looking at X code can tell you what you are doing wrong in your code.
You could argue, that if you know which error is invoked in X, you can deduce from that what your app through Qt is passing to X.
But you will need more luck than anything else to get any result using that path, IMHO.
The error X is giving, is enough to know that you have a painting problem.
I don't think you can get any more specific than that based on X output or code.

The best policy of dealing with problems, is to avoid them in the first place.
Avoiding problems is done by using the tools you have the right way.

But, each is entitled to his won opinion