Skip to content

Commit

Permalink
fix: DArrowRectangle background color abnormality
Browse files Browse the repository at this point in the history
  • Loading branch information
kegechen committed Oct 9, 2023
1 parent 3a2f266 commit fcab6c2
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/widgets/dplatformwindowhandle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,27 @@

#include <QWidget>
#include <QApplication>
#include <QSurfaceFormat>
#include <QWindow>

DWIDGET_BEGIN_NAMESPACE

static inline void ensureAlpha(QWidget *w)
{
QWindow *handle = w->windowHandle();
if (!handle)
return;

QSurfaceFormat format = handle->requestedFormat();
if ((w->windowFlags() & Qt::Window) &&
handle->surfaceType() != QSurface::OpenGLSurface
&& w->testAttribute(Qt::WA_TranslucentBackground)) {
format.setAlphaBufferSize(8);
}

handle->setFormat(format);
}

static QWindow *ensureWindowHandle(QWidget *widget)
{
QWidget *window = widget->window();
Expand All @@ -27,6 +45,9 @@ static QWindow *ensureWindowHandle(QWidget *widget)
handle = window->windowHandle();
window->setAttribute(Qt::WA_NativeWindow, false);

// FIX developer-center#5187 updateIsTranslucent
ensureAlpha(window);

// dxcb version >= 1.1.6
if (!DPlatformWindowHandle::pluginVersion().isEmpty()) {
/// TODO: Avoid call parentWidget()->enforceNativeChildren().
Expand Down

0 comments on commit fcab6c2

Please sign in to comment.