Avoid application activation and focus in when clicking buttons on it - Windows API or Qt

后端 未结 2 1653
遇见更好的自我
遇见更好的自我 2021-01-18 11:58

Situation: A border-less QDialog stays successfully on top of other applications.

The problem is when clicking on this always-on-top application window, the followin

2条回答
  •  天涯浪人
    2021-01-18 12:53

    I don't know about QDialog, I'm using just a QWidget for similar purpose (displaying a Windows 8 style notification).

    Try setting:

    dialog->setFocusPolicy(Qt::NoFocus);
    dialog->setAttribute(Qt::WA_ShowWithoutActivating); 
    

    maybe you'll have to set focus policy on all children.

提交回复
热议问题