I am doing a Qt program where I have rectangles linked with wires (placed by the user with mouse events). Every wire checks if there is a rectangle at the beginning and the end of it. If it is the case, the wire is placed.
I recently wanted to change my rectangles into horizontal lines (better visual), so I wrote:
QRectF myRect(-15, 0, 30, 1);
Instead of a regular rect. The problem is that now it is too hard to trace my wires because the user must link 2 lines with the mouse, which is almost impossible.
I tried to change bounding rect/shape but none of them works:
QRectF Port::boundingRect()
{
return QRectF(-15, 0, 30, 10);
}
QPainterPath Port::shape()
{
QPainterPath path;
path.addRect(-15, 0, 30, 10);
return path;
}
I think the problem is that bounding rect & shape are only used for selecting. I also tried to use an image (desperate solution), but I can't find a way to add an image/pixmap to my QpainterPath.
I know I can use a line instead of a flat rectangle, but the problem is still the same.
Thanks for helping me :)