使用QMenu实现菜单,使用
DWMNCRENDERINGPOLICY val = DWMNCRP_ENABLED;
::DwmSetWindowAttribute(hwnd, DWMWA_NCRENDERING_POLICY, &val, sizeof(DWMNCRENDERINGPOLICY));
// This will turn OFF the shadow
// MARGINS m = {0};
// This will turn ON the shadow
MARGINS m = {-1};
HRESULT hr = ::DwmExtendFrameIntoClientArea(hwnd, &m);
if( SUCCEEDED(hr) )
{
//do more things
}
为窗口看添加阴影,菜单有二级菜单,第一次显示二级菜单menu1,隐形显示正常,鼠标移动到其他QAction处,再显示二级菜单menu1,阴影消失
https://blog.csdn.net/weixin_39385413/article/details/107234938