[Interest] Why QLabel block mouseReleaseEvent when holds rich text?

nate.yuan at gmail.com nate.yuan at gmail.com
Thu Sep 12 04:26:54 CEST 2013


At 2013-09-11 19:35:27,"william.crocker at analog.com" <william.crocker at analog.com> wrote: >On 09/11/2013 07:08 AM, nate.yuan at gmail.com wrote: >> Hi guys, >> >> I have a frameless dialog and implement the title bar by myself. I implement the >> mousePressEvent, mouseReleaseEvent and mouseMoveEvent of the dialog, so users >> can drag the dialog. Every thing works fine until I put a QLabel, which holds >> rich text, on the title bar. >> The QLabel blocks the mouseReleaseEvent, so the dialog's mouseReleaseEvent() >> will never be called. When I use plain text in the QLabel, every thing works fine. >> >> Is this a bug of QLabel? Or do I miss something? >> > >You could try: > >  setAttribute(Qt::WA_TransparentForMouseEvents,true);
That's more elegant than subclass the QLabel, it works fine now. Thanks William.

Nate

> >> Nate >> 09/11/2013 >> >> >> >> >> _______________________________________________ >> Interest mailing list >> Interest at qt-project.org >> http://lists.qt-project.org/mailman/listinfo/interest > >_______________________________________________ >Interest mailing list >Interest at qt-project.org >http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130912/6094c880/attachment.html>


More information about the Interest mailing list