Ionică Bizău
Ionică Bizău

Reputation: 113385

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?

Upvotes: 1

Views: 1936

Answers (1)

AliciaBytes
AliciaBytes

Reputation: 7429

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.

Upvotes: 4

Related Questions