PDA

View Full Version : Not displaying transparent dialog



Being friendzoned sucks
11th May 2014, 00:00
I'm using Qt widget.

I needed a dialog that shows when I click on a button on my main window that dialog should be transparent meaning if I opened it I still can see the background like there's nothing there.

I tried this in the constructor of my dialog:


this->setWindowFlags(Qt::Widget | Qt::FramelessWindowHint);
this->setAttribute(Qt::WA_TranslucentBackground,true);
this->setWindowState(Qt::WindowFullScreen);

Note: I'm using mouse events where I can get the coordinates of the mouse and I tried it and it's working, the only thing I want now is as I said the transparent part. The program compiles just fine and the icon displays in the bar where the programs that are open are there , but I can't use the events which I can see if the I deleted the code above.
To make it more clear here's the mouse events:


void FramelessWindow::mousePressEvent(QMouseEvent *event){
if(event->button()==Qt::LeftButton){
origin= event->pos();
rubberBand->setGeometry(QRect(origin,QSize()));
rubberBand->show();
}
}

void FramelessWindow::mouseMoveEvent(QMouseEvent *event){
rubberBand->setGeometry(QRect(origin,event->pos()).normalized());
}


void FramelessWindow::mouseReleaseEvent(QMouseEvent *event){
rubberBand->hide();
}

found this:

http://www.qtcentre.org/threads/53362-Qt5-Translucent-alpha-channel-problems

but it's no help , " same problem "

wysota
12th May 2014, 10:47
Please provide a minimal compilable example reproducing the problem.