Solved what is way to get transparent background with popup Window type flag ?
-
In my case when i use below code
Qt::WindowFlags flags;
flags = Qt::Popup | Qt::WindowStaysOnTopHint;
ObjShutdownCount->setWindowFlags(flags);
ObjShutdownCount->show();my transparent ui screen transform to no transparent screen.
why existing property get changed ? what is way to get it back with this Window type enum ?
Any reference is there then please let me know then i can explore more about it.
-
Current solution :
i have used setMask() which make my out side region transparent with windowFlags
Qt::WindowFlags flags = ObjShutdownCount->windowFlags() | Qt::Popup | Qt::WindowStaysOnTopHint;
ObjShutdownCount->setWindowFlags(flags);
ObjShutdownCount->setAttribute(Qt::WA_NoSystemBackground, true);
ObjShutdownCount->setAttribute(Qt::WA_TranslucentBackground, true);
QRegion maskedRegion(75, 308, 332,152, QRegion::Rectangle);
ObjShutdownCount->setMask(maskedRegion);
ObjShutdownCount->show(); -
@Qt-embedded-developer You're losing already set flags with your code. You should get current flags and add flags you want to set:
Qt::WindowFlags flags = ObjShutdownCount->windowFlags() | Qt::Popup | Qt::WindowStaysOnTopHint; ObjShutdownCount->setWindowFlags(flags); ObjShutdownCount->show();
-
@jsulm by writing same code i am not getting transparent background popup
-
@Qt-embedded-developer Of course not - you are not making it transparent.
See https://doc.qt.io/qt-5/qt.html#WidgetAttribute-enum and https://stackoverflow.com/questions/18316710/frameless-and-transparent-window-qt5 -
@jsulm By commenting below part my popup comes transparent but i want same transparent with this flag
/* Qt::WindowFlags flags = ObjShutdownCount->windowFlags() | Qt::Popup | Qt::WindowStaysOnTopHint;
ObjShutdownCount->setWindowFlags(flags); */
ObjShutdownCount->show(); -
@Qt-embedded-developer So, did you try to set Qt::WA_TranslucentBackground?
-
@jsulm yes when i set this my background comes completely black
-
@Qt-embedded-developer Try also
setAttribute(Qt::WA_NoSystemBackground, true);
as shown in the link I provided.
-
@jsulm yes by writing as per your suggestion this comes black. i have done lots of different try yesterday and today but i not get it transparent popup .
-
Current solution :
i have used setMask() which make my out side region transparent with windowFlags
Qt::WindowFlags flags = ObjShutdownCount->windowFlags() | Qt::Popup | Qt::WindowStaysOnTopHint;
ObjShutdownCount->setWindowFlags(flags);
ObjShutdownCount->setAttribute(Qt::WA_NoSystemBackground, true);
ObjShutdownCount->setAttribute(Qt::WA_TranslucentBackground, true);
QRegion maskedRegion(75, 308, 332,152, QRegion::Rectangle);
ObjShutdownCount->setMask(maskedRegion);
ObjShutdownCount->show(); -
@jsulm THANKS FOR YOUR EFFORT FOR SOLVE IT