Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

WA_TranslucentBackground can't capture mouse event



  • Hello everyone,

    I have a problem. Could somebody give me some advise?

    I create a dialog. I want it to be transparent. So I set the attribute WA_TranslucentBackground. It works as expected.

    But it couldn't capture mouse event in the region that is transparent.

    Does somebody know the solution? Could you tell me, please?

    Thanks.

    My enviroment:
    Windows 7
    0_1546399128153_77083b70-12dd-4213-beef-283588ef5ee0-image.png
    0_1546399076952_858c0776-102d-49d8-b6af-290cdc9e8071-image.png


  • Qt Champions 2017

    Not possible directly. Just a thought. Can you try setting the background color on your own with minimum opacity value ?



  • @dheerendra
    Thanks you.

    I want to say it works on Ubuntu 16.04.
    0_1546405440084_55cca045-0d39-434d-966e-ce687521553a-image.png
    0_1546405451037_b5db27a9-a385-4049-96dd-bf7f4cc9ca94-image.png

    I don't know your meaning by setting background color actually.
    I have tried this code. But it's black.
    QPalette pal = palette();
    pal.setColor(QPalette::Background, QColor(0x00,0xff,0x00,0x00));
    setPalette(pal);



  • On Windows, I got the same problem. The top level window with WA_TranslucentBackground cannot receive mouse pressing and releasing events when setMouseTracking to true.


Log in to reply