2

I'm using Qt 5.7 on Windows 7.

I can make my QWindow have opacity, but it can't be transparent.

// window1.qml
Window {
    width: 640
    height: 480
    color: "transparent"
} // no transparent, black background


// window2.qml
Window {
    width: 640
    height: 480
    color: "transparent"
    opacity: 0.5
} // black but 50% opacity background

But if I enable aero, then it would be transparent without any problem.

I've read a lot of articles about it. but I couldn't find correct answer.

https://stackoverflow.com/a/22554797/6356562 - set surface format

This answer doesn't work for me.

How can I solve it?

Community
  • 1
  • 1
kangsu
  • 226
  • 1
  • 6
  • 1
    There is no solution yet. Without Aero, transparancy is not possible (yet). This had been [filed as a bug since Qt 5.6](https://bugreports.qt.io/browse/QTBUG-52494) – DuKes0mE Feb 06 '17 at 09:52
  • I faced similar issue with QT5.8. I could not get it to work. But I have seen some UI elements developed using openGL which are transparent on win7 without aero (Not QT). So technically it might be possible to do it with some work around. – prashanthns Oct 17 '17 at 06:24

1 Answers1

1

I tried this code with Qt 5.8:

Window {
  width: 200
  height: 200
  visible: true

  color: "transparent"
  opacity: 0.9

  Button {
    anchors.centerIn: parent
    text: "Click Me!"
  }
}

And I get this result: Transparent QtQuickControls2 I recommend you use Qt 5.8.

İbrahim
  • 991
  • 1
  • 10
  • 32