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);
this->setWindowFlags(Qt::Widget | Qt::FramelessWindowHint);
this->setAttribute(Qt::WA_TranslucentBackground,true);
this->setWindowState(Qt::WindowFullScreen);
To copy to clipboard, switch view to plain text mode
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->show();
}
}
void FramelessWindow
::mouseMoveEvent(QMouseEvent *event
){ rubberBand
->setGeometry
(QRect(origin,event
->pos
()).
normalized());
}
void FramelessWindow
::mouseReleaseEvent(QMouseEvent *event
){ rubberBand->hide();
}
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();
}
To copy to clipboard, switch view to plain text mode
found this:
http://www.qtcentre.org/threads/5336...annel-problems
but it's no help , " same problem "
Bookmarks