Home > Back-end >  Listwidget event filter installed, keyboard events can be detected, but it cannot detect the mouse e
Listwidget event filter installed, keyboard events can be detected, but it cannot detect the mouse e

Time:09-27

?? The UI - & gt; ListWidget - & gt; InstallEventFilter (this);
Bool MyAppointmentInfoForm: : eventfilters (QObject * obj, QEvent * event)
If (obj==UI - & gt; ListWidget)
{
QDebug () & lt; <"Listwidget event";
If (event - & gt; The type ()==QEvent: : MouseButtonPress)
{
QMouseEvent * mouseevent=static_cast & lt; QMouseEvent * & gt; (event);
If (mouseevent - & gt; Buttons ()==Qt: : LeftButton)
{
QDebug () & lt; <"The click event listwidget";
M_seeAppointmentDetails - & gt; Close ();
}

}
} the else
{
Return MyAppointmentInfoForm: : eventfilters (obj, event);
}
}
The type of the event () if written QEvent: : KeyPress can be detected, but QEvent: : MouseButtonPress couldn't detect, consult!!!!! ?

CodePudding user response:

MousePress, should go

CodePudding user response:

CodePudding user response:

Mouseevent - & gt; Buttons ()==change button, or change the==to & amp;

CodePudding user response:

Are not, or no response

CodePudding user response:

Just at the time of check other problems, encountered such a words:
Internet to a variety of methods, 1. Add filter (eventfilters), 2. Rewrite the mouse click event, both methods to figure out whether mouse click position on child Windows, and on the editable controls such as (drop-down box, the text edit box, etc.), the parent window will directly transfer the editable controls, filters and rewrite unable to get a click of the mouse event,
http://www.bubuko.com/infodetail-2835267.html? __cf_chl_jschl_tk__=b706b8cbbac655ce7fdfcd3b90e51e83b00b44e2-1587197168-0 - AYG7Jzh0rN65TCEPbQusIxkugH2eCQvdAFyKchc_ND1TRle7BmmwHUTrC XQu1dD9n6f6XPM - dktqqeKoa6ZtmUIC_Fy8OLdxomrDs0U2U_oW58kx7MWoneTQuN7SdnC2cxibynwi7bof016Kr8hCzsUXoylcJi_YgYqiAJzbS - WAizuQhDsoCiw7D - jvO - u3Fjw9FrnMFwiF5bGW - SvcV - opArXrBDJpQvHV5DN5J1r89agrgueAb2 - g341WZGx3QRol7cXd96h5Fa7ZnmNTD1lKzwYd0ZrR9_ATZFTmqamFPDUJh9QSCToLe7leFBB6g
So I also don't tangle on this issue, also share with you,
  • Related