I would reimplement shape() rather than boundingRect(). shape() is used to detect mouse clicks. The default implementation just calls boundingRect(), though. You could reimplement shape() as something like this:
const int adjustment = 5;
return path.addRect(boundingRect().adjusted(-adjustment, -adjustment, adjustment, adjustment);
const int adjustment = 5;
QPainterPath path;
return path.addRect(boundingRect().adjusted(-adjustment, -adjustment, adjustment, adjustment);
To copy to clipboard, switch view to plain text mode
Not tested, but I think it should work!
Bookmarks