I found the solution to the problem.
I replaced this code:
return QVariant(resource);
With this code:
QVariant r;
r.setValue<QSharedPointer<GMResource> >(resource);
return r;
Seems to be working as expected. I guess the data() method was being executed, but the breakpoints weren't being triggered for some reason.