PDA

View Full Version : Translucent frameless window problem on Kubuntu



superpacko
7th October 2011, 00:01
I have the main window transparent and frameless, inside i have a rounded border widget. This works perfectly fine on Windows, but when i run it on Kubuntu the mainwindow is painted with a blured grey. The translucency works only if i remove the Qt::FramelessWindowHint. (Qt 4.74 on Kubuntu 11.04)

source:



MainWindow::MainWindow(QWidget *parent) :
QWidget(parent, Qt::FramelessWindowHint)
{
ui.setupUi(this);

this->setAttribute(Qt::WA_TranslucentBackground,true);

}


Why could this be happening? I need the main window to be frameless and translucent in order to give my application a rounded look and feel.

Mr.Simple
7th October 2011, 09:10
this->setAttribute(Qt::FramelessWindowHint)ï¼›

superpacko
7th October 2011, 15:08
Hey, im not with a kubuntu box right now, but i'll try it later. Have you tried?
I can't see how this would solve the problem, the flag Qt::FramelessWindowHint in the QWidget constructor is working since i get a frameless window. The problem is that the widget gets painted wiht grey, instead of been transparent(i didnt apply any style or background color)

anyway i'll give it a try when im back home.
thanks!

wysota
7th October 2011, 21:31
A frameless window is probably held out of grasp of the window manager hence your window manager (kwin, I guess) cannot detect the window is translucent and the effects you have enabled for kwin treat your window as opaque, drawing the shadow under the whole area of the window. That's only a guess but I think a pretty good one.

superpacko
8th October 2011, 20:53
I see what u mean. The window also loses all the effects of dragging windows, applied on window manager config. I tried running a normal program on kubuntu, removing borders with the window options, and the same happened, dragging effect of windows disappeared.

Is there anyway of letting the window manager know about our frameless window, in order to use the translucency, without loosing all desktop effects?

wysota
9th October 2011, 10:38
Don't disable the frame. You can try masking it out (using setMask) however I have no idea whether kwin will be able to detect the mask.

superpacko
10th October 2011, 16:14
I dont really know how to use the masking or paint methods...
Is there any tutorial or guide for masking actions and use of QPixmaps? im interested in changing widget's shape and making transparent areas, but i cant find a tutorial or examples to that. That would be pretty usefull!

thanks for your help!

wysota
10th October 2011, 16:40
Open Qt Assistant (or Qt Creator help pane), go to "index" tab and type in "setMask".