Hello! I want to implement a simple function to toggle normal window/on top state. For this, I write this code:
Qt::WindowFlags f = 0;
Qt::WindowFlags flags = windowFlags ();
if (flags & Qt::WindowStaysOnTopHint)
f = Qt::Window;
else
{
f = Qt::Window;
f |= Qt::WindowStaysOnTopHint;
}
setWindowFlags (f);
Qt::WindowFlags f = 0;
Qt::WindowFlags flags = windowFlags ();
if (flags & Qt::WindowStaysOnTopHint)
f = Qt::Window;
else
{
f = Qt::Window;
f |= Qt::WindowStaysOnTopHint;
}
setWindowFlags (f);
To copy to clipboard, switch view to plain text mode
But when I run it, the window just disappears.
Bookmarks