Home > Back-end >  Great god teach of qt, use Qpainter painting lines, how to detect where the mouse click this wire??
Great god teach of qt, use Qpainter painting lines, how to detect where the mouse click this wire??

Time:11-21

Qt novice seek god advice. Thanks

CodePudding user response:

Record the coordinates of the line, judge whether the coordinates of the mouse moves in mouseevent falls within the scope of the coordinates of online and click the left mouse button,
However, in order to improve the user experience, you can't directly corresponding to the coordinates of the scope, is too narrow a mouse is very difficult to it, you need to broaden the line the coordinates of the range, such as the breadth of 2 pixel,

CodePudding user response:

Record the coordinates, or need not QPainter

CodePudding user response:

Don't use Qpainter with what ah?

CodePudding user response:

reference 3 floor wang still reply:
without Qpainter with what ah?

QGraphicsItem?

CodePudding user response:

To draw a line in succession QLable painEvent function, line can be used as QLable controls,

CodePudding user response:

Thank you I try

CodePudding user response:

I tried to click on the line, but click other places also triggered the event

CodePudding user response:

Can also be QLable directly as a straight line, set its color, width,

CodePudding user response:

If I draw the line is declining? Can make like this?
  • Related