如題,想在X11上面實作半透明效果,但是設定透明度都不行,背景變成黑色。
網上搜索發現也有人類似情況,但是無人回復,那位大神請指點下,謝謝。
uj5u.com熱心網友回復:
說一下你設定不行的方法,看看是不是哪里有問題。uj5u.com熱心網友回復:
ui->setupUi(this);
setAutoFillBackground(false);
setAttribute(Qt::WA_TranslucentBackground, true);
setWindowOpacity(0.5);
就這樣,在Ubuntu上面跑可以半透明,但是放在x11+qt5的arm板子上面就不行,背景黑的。
uj5u.com熱心網友回復:
windowOpacity : doubleThis property holds the level of opacity for the window.
The valid range of opacity is from 1.0 (completely opaque) to 0.0 (completely transparent).
By default the value of this property is 1.0.
This feature is available on Embedded Linux, Mac OS X, Windows, and X11 platforms that support the Composite extension.
This feature is not available on Windows CE.
Note that under X11 you need to have a composite manager running, and the X11 specific _NET_WM_WINDOW_OPACITY atom needs to be supported by the window manager you are using.
Warning: Changing this property from opaque to transparent might issue a paint event that needs to be processed before the window is displayed correctly. This affects mainly the use of QPixmap::grabWindow(). Also note that semi-transparent windows update and resize significantly slower than opaque windows.
x11的區別在這里:
Note that under X11 you need to have a composite manager running, and the X11 specific _NET_WM_WINDOW_OPACITY atom needs to be supported by the window manager you are using.
uj5u.com熱心網友回復:
非常感謝您的回復。
那我現在怎么確認x11的兩個問題呢?
1、怎么讓composite manager 跑起來以及怎么確認已經跑起來呢?
2、怎么確認_NET_WM_WINDOW_OPACITY atom我是不是支持呢?
多謝。
uj5u.com熱心網友回復:
你可以參考一下“CentOS下Qt視窗透明效果失效,成黑色背景的問題”http://http://blog.csdn.net/taiyang1987912/article/details/37037657
應該是需要X服務的支持才行
uj5u.com熱心網友回復:
感謝。
具體是什么服務呢,怎么啟動?
uj5u.com熱心網友回復:
X11: This feature relies on the use of an X server that supports ARGB visuals and a compositing window manager.X11(linux):此特性依賴于能提供支持ARGB視覺效果和復合式視窗管理的X服務的功能開啟。
uj5u.com熱心網友回復:
參考http://blog.csdn.net/tian_110/article/details/42402021轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/152853.html
標籤:Qt
下一篇:大資料相關知識
