概述
运行环境:framebuffer、armlinux系统、qt5.4
设置这两句
setAttribute(Qt::WA_TranslucentBackground);
setWindowFlags(Qt::FramelessWindowHint);
//通过这个接口可以发现
void MissionMark::PrintWindowFlags()
{
QString text;
Qt::WindowFlags flags = this->windowFlags();
Qt::WindowFlags type = ( flags & Qt::WindowType_Mask);
if (type == Qt::Window) {
text = "Qt::Window";
} else if (type == Qt::Dialog) {
text = "Qt::Dialog";
} else if (type == Qt::Widget) {
text = "Qt::Widget";
} else if (type == Qt::ForeignWindow) {
text = "Qt::ForeignWindow";
} else if (type == Qt::SubWindow) {
text = "Qt::SubWindow";
} else if (type == Qt::CoverWindow) {
text = "Qt::CoverWindow";
} else if (type == Qt::Desktop) {
text = "Qt::Desktop";
} else if (type == Qt::Sheet) {
text = "Qt::Sheet";
} else if (type == Qt::Drawer) {
text = "Qt::Drawer";
} else if (type == Qt::Popup) {
text = "Qt::Popup";
} else if (type == Qt::Tool) {
text = "Qt::Tool";
} else if (type == Qt::ToolTip) {
text = "Qt::ToolTip";
} else if (type == Qt::SplashScreen) {
text = "Qt::SplashScreen";
}
if (flags & Qt::MSWindowsFixedSizeDialogHint)
text += "n| Qt::MSWindowsFixedSizeDialogHint";
if (flags & Qt::X11BypassWindowManagerHint)
text += "n| Qt::X11BypassWindowManagerHint";
if (flags & Qt::FramelessWindowHint)
text += "n| Qt::FramelessWindowHint";
if (flags & Qt::NoDropShadowWindowHint)
text += "n| Qt::NoDropShadowWindowHint";
if (flags & Qt::WindowTitleHint)
text += "n| Qt::WindowTitleHint";
if (flags & Qt::WindowSystemMenuHint)
text += "n| Qt::WindowSystemMenuHint";
if (flags & Qt::WindowMinimizeButtonHint)
text += "n| Qt::WindowMinimizeButtonHint";
if (flags & Qt::WindowMaximizeButtonHint)
text += "n| Qt::WindowMaximizeButtonHint";
if (flags & Qt::WindowCloseButtonHint)
text += "n| Qt::WindowCloseButtonHint";
if (flags & Qt::WindowContextHelpButtonHint)
text += "n| Qt::WindowContextHelpButtonHint";
if (flags & Qt::WindowShadeButtonHint)
text += "n| Qt::WindowShadeButtonHint";
if (flags & Qt::WindowStaysOnTopHint)
text += "n| Qt::WindowStaysOnTopHint";
if (flags & Qt::CustomizeWindowHint)
text += "n| Qt::CustomizeWindowHint";
if (flags & Qt::MSWindowsOwnDC)
text += "n| Qt::MSWindowsOwnDC";
if (flags & Qt::WindowMinMaxButtonsHint)
text += "n| Qt::WindowMinMaxButtonsHint";
if (flags & Qt::MacWindowToolBarButtonHint)
text += "n| Qt::MacWindowToolBarButtonHint";
if (flags & Qt::BypassGraphicsProxyWidget)
text += "n| Qt::BypassGraphicsProxyWidget";
if (flags & Qt::WindowStaysOnBottomHint)
text += "n| Qt::WindowStaysOnBottomHint";
if (flags & Qt::WindowFullscreenButtonHint)
text += "n| Qt::WindowFullscreenButtonHint";
if (flags & Qt::WindowOkButtonHint)
text += "n| Qt::WindowOkButtonHint";
if (flags & Qt::WindowCancelButtonHint)
text += "n| Qt::WindowCancelButtonHint";
if (flags & Qt::WindowTransparentForInput)
text += "n| Qt::WindowTransparentForInput";
if (flags & Qt::WindowDoesNotAcceptFocus)
text += "n| Qt::WindowDoesNotAcceptFocus";
if (flags & Qt::WindowOverridesSystemGestures)
text += "n| Qt::WindowOverridesSystemGestures";
qDebug()<<text;
}
设置 setWindowFlags(Qt::FramelessWindowHint)之前QDialog的windowFLags;
“Qt::Dialog
| Qt::WindowTitleHint
| Qt::WindowSystemMenuHint
| Qt::WindowCloseButtonHint
| Qt::WindowContextHelpButtonHint”
设置后
“Qt::Widget
| Qt::FramelessWindowHint”
可见它是把他当成了QWidget来处理的,所以这个地方会造成QDialog的Qt::ApplicationModal阻塞失效,并且也没有置顶了。
延伸资料:关于Qt如何保持子窗口显示在最上面的两种方式
最后
以上就是虚拟板凳为你收集整理的Qt5.4 QDialog窗体圆角时圆角透明背景是黑色的解决方法的全部内容,希望文章能够帮你解决Qt5.4 QDialog窗体圆角时圆角透明背景是黑色的解决方法所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复