Thank you for this tip, but it also has no effect at all.
Thank you for this tip, but it also has no effect at all.
Sounds like you are being defeated either by the OS or a style setting. Maybe try deriving from QRubberBand, overriding the paintEvent() and messing with the style option there before passing it to the base class for the actual painting.
For Android its a littlebit weird.
But the Answer is simple.
Subclass what you want...
//constructor
setWindowFlags(Qt::FramelessWindowHint); <--- In the constructor
//paintEvent
//IF YOU WANT IT SEMI TRANSPARENT ...
//If you want it transparent only, you dont have to overide paintEvent. Then its enough to use Qt::FramelessWindowHint in a subclass. But a subclass is not needed
void Example_Dialog:: paintEvent(QPaintEvent *)
{
QColor backgroundColor = palette().background().color();
backgroundColor.setAlpha(216); // Use Alphachannel u want
QPainter painter(this);
painter.fillRect(rect(),backgroundColor);
}
Dont tested it with QRubberband, but I think it will work with all Object the usage of setWindowFlags is possible.
Just set Qpalette with the customized Color dont work
In Windows:
setWindowOpacity(0.8);
Last edited by jules1337; 23rd April 2016 at 22:52.
In some cases you need to set the original windowFlags and add Framelesswindowhint.
I tested this with QMenu. Didnt work. But Framelesswindowhint is an important part too.
For QMenu u have to set Framelesswindowhint and the old windowFlags. But have to delete the Popup windowflag on Android.
You have to do 3 steps to immitate theese flags.
On Android you have to set Framelesswindowhint and the old windowFlags But have to delete the Popup windowflag. Then you just have to edit the Stylesheet with an transparent or semitransparent background. No need for an paintevent.
On Windows you just have to add the framelesswindowint , setAttribute(Qt::WA_TranslucentBackground) and have to set the stylesheet too.
Bookmarks