You don't set classes to visible. At some point you must have created an instance of that class and this instance must have had boundingRect() (and hence shape()) defined. If you didn't redefine shape() then it by default equals to the boundingRect() hence everywhere inside that boundingRect (so in the bounding area of the item) is considered "inside" the item.
Bookmarks