You have to set attributes in the constructor of your widget
setAttribute(Qt::WA_TranslucentBackground,true);
setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint );
setWindowOpacity(0.5);
bool t=testAttribute ( Qt::WA_TranslucentBackground);
qDebug()<<t;
setAttribute(Qt::WA_TranslucentBackground,true);
setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint );
setWindowOpacity(0.5);
bool t=testAttribute ( Qt::WA_TranslucentBackground);
qDebug()<<t;
To copy to clipboard, switch view to plain text mode
The Qt::WA_TranslucentBackground is mandatory, the other flags I dont remember if they are, check the Qt documentation. Also, in linux, you have to enable transparency in your X-window system. In my machine, without compiz enabled, it doenst work, but with compiz works fine.
Bookmarks