简体   繁体   中英

Qt::WindowStaysOnBottomHint and frameless flag makes don't keep my Qt window on bottom of all windows

I want to have an undecorated window that will stay in the background of all windows .

For this I apply two window flags to a this Qt window: Qt::FramelessWindowHint and Qt::WindowStaysOnBottomHint .

If I apply only first flag it will undecorate my window. If I apply only the second flag I will have a window that is not undecorated but stays in the background of all windows.

I cannot understand why if I apply both flags I have two situations:

  1. If the order is:

     view->setWindowFlags(Qt::WindowStaysOnBottomHint); view->setWindowFlags(Qt::FramelessWindowHint); 

    I have a window that is undecoraded but doesn't stay on background.

  2. If the order is:

     view->setWindowFlags(Qt::FramelessWindowHint); view->setWindowFlags(Qt::WindowStaysOnBottomHint); 

    I have a window that is NOT undecoraded but stays on background.

How can I create a window that stays in background and is undecorated?

Without knowing anything about Qt I guess what you might want is:

view->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnBottomHint);

Flags are often just implemented as integers with certain bits set and bitwise or is used to set multiple bits of a flag.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM