Qrect on frame mouse click event



  • I did qrect through frame and now I want mouseclick event on that qrect.
    Qpainter p(this);
    Qpainter path;
    Path.addRoundRect(1,394,80,20),10,10);
    Qpen pen(Qt::black,10);
    p.setPen(pen);
    p.fillPath(path,Qt:: white);
    p.drawPath(path);

    To this coordinates mousepress event should happen. Any solution on this please:)


  • Moderators

    @Npsad Mouse click event on the widget you're painting on (this) and check mouse cursor coordinates in that event.



  • @jsulm I just printed co-ordinates and now at that particular coordinate only it should display say message box
    So event->pos() at that particular coordinate how to set.. any function we can use


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.