Qt frameless window with translucent background without error "UpdateLayeredWindowIndirect failed"

2.4k Views Asked by At

Since some time I get an error like UpdateLayeredWindowIndirect failed for ptDst=... for my frameless window with rounded corners: I set my main window frameless and draw an inner widget with rounded corners.

There is a discussion at Qt here and the code for the warning has been added here. They say:

So, yes, this was silently failing all the time. It is a restriction on Windows that translucency (WS_EX_LAYERED) only works for frameless toplevel windows.

However, I only set translucency on my main top level window:

if (m_isMainApplicationWindow && CGuiUtility::isTopLevelWindow(m_widget)) {
  m_widget->setAttribute(Qt::WA_NativeWindow);
  m_widget->setAttribute(Qt::WA_NoSystemBackground, frameless);
  m_widget->setAttribute(Qt::WA_TranslucentBackground, frameless); // causing QTBUG-52206
}

So how do I do it right and avoid the error?


Impression how it looks like: Frameless window rounded corner

0

There are 0 best solutions below