How to create a custom-styled Qt window with non-native menu and title bar?
-
I recently came across a Qt application with a custom UI design that caught my attention. I'd like to understand how to achieve a similar look for my own QWidget application.
Specifically, I'm interested in learning:
- How to customize the menu bar to look different from the Windows native menu
- How to modify/style the window title bar
- The general approach to achieving this modern, custom look in Qt
Here is how it looks.
-
@YJMForgive said in How to create a custom-styled Qt window with non-native menu and title bar?:
- How to customize the menu bar to look different from the Windows native menu
- How to modify/style the window title bar
Both not possible using Qt only... you need a platform-specific approach for that
- The general approach to achieving this modern, custom look in Qt
That's easy... probably "just" a dark theme stylesheet.
You can define your own set depending on your taste or download existing ones for example here: -
I am not even sure if Windows itself allows to style the title bar. By default the title bar belongs to the OS and you can only set the title and the icon.
I guess the most common way (especially with Qt) is to create a Window without a title bar (by setting the proper window flags) and then providing your own title bar. This also means that you need to provide the 3 buttons on the top right yourself. You also have to implement the behavior of these 3 buttons and you have to implement dragging the window by dragging the title bar.