-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix DArrowRectangle background color abnormality #512
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: kegechen The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@@ -27,6 +27,10 @@ static QWindow *ensureWindowHandle(QWidget *widget) | |||
handle = window->windowHandle(); | |||
window->setAttribute(Qt::WA_NativeWindow, false); | |||
|
|||
// FIX developer-center#5187 updateIsTranslucent | |||
if (window->testAttribute(Qt::WA_TranslucentBackground)) | |||
window->setAttribute(Qt::WA_OpaquePaintEvent); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这不会有副作用吗,有 Qt::WA_TranslucentBackground 时不应该是需要背景透明
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
主要是想设置透明通道
setAttribute(Qt::WA_OpaquePaintEvent) ==> updateIsOpaque() ==> setOpaque ==> updateIsTranslucent
不过调用的过程确实有点多, 可能会有副作用。起作用的是 window->setFormat(format);
void QWidgetPrivate::updateIsTranslucent()
{
Q_Q(QWidget);
if (QWindow *window = q->windowHandle()) {
QSurfaceFormat format = window->format();
const int oldAlpha = format.alphaBufferSize();
const int newAlpha = q->testAttribute(Qt::WA_TranslucentBackground)? 8 : 0;
if (oldAlpha != newAlpha) {
format.setAlphaBufferSize(newAlpha);
window->setFormat(format);
}
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我看看怎么在Qt修复吧。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Qt6 貌似修复了,不过还没找到改的地方在哪里 🥲
Doc Check bot |
暂时关闭。 |
FIX linuxdeepin/developer-center#5187
Bug: https://pms.uniontech.com/bug-view-211649.html