Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

kegechen
Copy link
Contributor

@kegechen kegechen commented Aug 17, 2023

@deepin-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kegechen kegechen changed the title Fix 5187 fix DArrowRectangle background color abnormality Aug 17, 2023
@@ -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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这不会有副作用吗,有 Qt::WA_TranslucentBackground 时不应该是需要背景透明

Copy link
Contributor Author

@kegechen kegechen Aug 18, 2023

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);
        }
    }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我看看怎么在Qt修复吧。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Qt6 貌似修复了,不过还没找到改的地方在哪里 🥲

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Aug 18, 2023

Doc Check bot
🟢 Document Coverage Check Passed!

@kegechen
Copy link
Contributor Author

暂时关闭。

@kegechen kegechen closed this Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

【1061】【5.5.1.0】【显示】插件区的功能面板背景色调异常
4 participants