Make the window look inactive but still active

Asked 2 years ago, Updated 2 years ago, 116 views

We are developing desktop apps on Linux and Qt.

When a window is active, the title bar is colored.When deactivated, the title bar turns gray.

active
active

inactive
Enter a description of the image here

This behavior is common as an app, but even when this window becomes inactive, I would like to draw it as if it were active without changing the color of the title bar.

It's not a wild request like the app wants to be activated when it's deactivated, it's just a matter of appearance that you want to draw the title bar as if it were an active window.

Is this possible?

p.s. By the way, Windows did the same thing by working with WM_NCACTIVATE.

linux c++ qt qt5 x11

2022-09-30 21:19

1 Answers

It seems that you cannot specify the color of the title bar from Qt in a cross-platform way. (Windows alone seems to have a way out as Sorami said.)

The solution is to remove the title bar and border of the window and draw something like a title bar by yourself, but in that case, you will also need to write down the movement and resize the window yourself.

Reference
http://www.qtcentre.org/threads/4778-Title-Bar-Color
http://www.qtcentre.org/threads/8596-Color-of-Titlebar-and-Menubar
https://stackoverflow.com/questions/28481109/how-to-change-color-of-qmainwindow-borders-and-title-bar


2022-09-30 21:19

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.