I am popping up a transparent webkit widget that expands across the whole screen (regardless of the size of the main app window) grabs the mouse focus and of course paints stuff on the screen where need be when the user clicks a button.
The problem is that when the transparent window pops up the windows title bar changes styles. It is the style that a window gets when it is not active. So, my question is how do I stop the main application window's title bar from changing colors when the widget window pops up?
This is how the widget is created:
setWindowModality(Qt::ApplicationModal);
// make the background opaque
qpalette.
setBrush(QPalette::Base, Qt
::transparent);
page()->setPalette(qpalette);
setAttribute(Qt::WA_OpaquePaintEvent, false);
setAttribute(Qt::WA_TranslucentBackground, true);
setWindowFlags(Qt::FramelessWindowHint | Qt::SplashScreen);
page()->mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
setWindowModality(Qt::ApplicationModal);
// make the background opaque
QPalette qpalette = palette();
qpalette.setBrush(QPalette::Base, Qt::transparent);
page()->setPalette(qpalette);
setAttribute(Qt::WA_OpaquePaintEvent, false);
setAttribute(Qt::WA_TranslucentBackground, true);
setWindowFlags(Qt::FramelessWindowHint | Qt::SplashScreen);
page()->mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
To copy to clipboard, switch view to plain text mode
Maybe there is a better way to do this? I could not get it to work unless the widget was a window. What the widget accomplishes is a webkit replacement for QMenu.
Bookmarks