gpt4 book ai didi

c++ - 停靠时不应用 QDockWidget::background-color

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:16:07 26 4
gpt4 key购买 nike

我有一个QDockWidget:

enter image description here

我想通过设置标题栏的背景色来提醒用户某些事件。

我通过为我的 DockWidget 设置样式表实现了这一点:

void DockWidget::setCriticalAlert()
{
setStyleSheet("QDockWidget { background-color:red; }");
}

结果是这样的:

enter image description here

问题是当 QDockWidget 停靠时 background-color 没有应用:

enter image description here

QDockWidget 停靠时,如何应用背景色?

最佳答案

这是 Qt 中的一个错误。

Issue 10537

引用链接问题:

The problem is that in QDockWidget::paintEvent, there is a isFloating() condition before drawing PE_FrameDockWidget. We cannot jsut remove this condition as it would break the other style (that does not whish to draw frame when the dockwidget is docked) We cannot either use PE_Widget to draw the frame as then it goes over the dockwidget's title The solution is maybe to introduce a new PE_FrameDockWidgetDocked primitive element. Or some SH_DockWidget_DrawDockedFrame stylehint to draw the frame in every cases.

关于c++ - 停靠时不应用 QDockWidget::background-color,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33378854/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com