文章目录
问题描述
两个控件层叠,上面的那个半透明。
ui->pushButton->setAttribute(Qt::WA_TranslucentBackground, true);
ui->pushButton->setStyleSheet("background-color: rgba(0, 255, 255, 128);");
这样就能看到底下的控件了
一般情况下是正常的的。
但是有种情况,
如果底下的控件使用了
HWND w = (HWND)t_videoWindowInfo.winHandle.handle.window;
HWND new_parent = (HWND)m_pCameraPreviewWidget->getInterWidget()->winId();
SetParent(w,new_parent);
就是 SetParent,这里之后控件的权限就交给系统,Qt就管不着了。
结果就是,半透明失效了。直接遮挡了。
这里我放弃了。