How to completely remove title bar
-
As we know, setWindowFlags(Qt::CustomizeWindowHint); removes the title bar of a QT window while keeping the borders in place. However, for some reason I can't understand, it doesn't remove all of the title bar:
As you can see, there's a tiny bit of white at the top that is still left behind of the title bar even after I've removed it (between the blue lines that are the border and the grey menuBar). Anyone knows why this is and/or how to get rid of it? Either through coding or qss? I know I can get rid of it by removing the borders, but then I also remove the ability to resize the window, which is quite a hassle to start manually program back into the application.
Environment is Windows x64 and C++ btw.
-
Hi
That is the border.
Here it how it looks in win 7
And no , you cannot have no border and it can still resize. Windows cant do that.
(as far as i know)Update: ahh sorry. U mean the white area ?
I thinks part of the menu but the flat design of win 8+ makes it hard to see. -
@mrjj Yeah exactly the white area. I don't see any reason why that would be part of the windows border, even if it disappears when you remove the border. I've been looking options in the qss file to see if it's a margin or padding that's left over but no luck so far.
edit: Just tried it on some of the example apps as well and they all also do the same thing:
-
@Excludos
Ahh , i see now at home on win 10.
When captionless, the border top is wider than around.
So it really is the border. No qss can affect that.
Seems to be a win 10 thing. in win 7 and before, it really is same
width for the border.Only cure for this ( i think) is to find out why win 10 is like that. There might be
native option to remove it. -
@mrjj said in How to -completely- remove title bar:
@Excludos
Ahh , i see now at home on win 10.
When captionless, the border top is wider than around.
So it really is the border. No qss can affect that.
Seems to be a win 10 thing. in win 7 and before, it really is same
width for the border.Only cure for this ( i think) is to find out why win 10 is like that. There might be
native option to remove it.Hmm. Your effect is quite different from mine tho, as yours is just a very thick border on top while mine just seems to be a mm of padding or margin.
If it is a windows thing then that sucks. Sure I could maybe fix it on my computer, but this is an application meant to be used on any computer without having to fiddle with native windows settings just to make it look decent =/ I'd probably be better off removing the border completely and making my own draggable border from scratch.
-
Hmm strange on your image, it seems not be part of border?`
It stays white even when window has focus? -
@mrjj said in How to -completely- remove title bar:
Hmm strange on your image, it seems not be part of border?`
It stays white even when window has focus?Correct. It only disappears if you make it fullscreen or remove the entire border
-
Hi,
you can try to play with the WindowMetrics: https://www.eightforums.com/tutorials/8463-border-width-windows-change-windows-8-a.html. The text is Win8 but the registry keys still have the same names.
-Michael. -
Hi
I think the best work around is just to use mainwindow type with status bar so user can resize
the window by the corner and then use no borders. I assume that your use case its a bit special since
captionless windows are not that common on desktop. ( not talking 'modern' apps )
-
@mrjj said in How to -completely- remove title bar:
Hi
I think the best work around is just to use mainwindow type with status bar so user can resize
the window by the corner and then use no borders. I assume that your use case its a bit special since
captionless windows are not that common on desktop. ( not talking 'modern' apps )
I've looked at the status bar thing and found it clashes with the looks I'm trying to go for. It's not a super special application, but the design I'm trying to go for does not work with a title bar that I can't change the looks of.
I've just started working on creating my own window drag resize thing from scratch instead. A lot more work than I was hoping for (and bigger potential for bugs), but the end results should look good at least :)
Still think this is a weird oversight by Windows. I can't be the first person wanting to remove the title bar without removing the border.
-
@m.sue said in How to -completely- remove title bar:
Hi,
you can try to play with the WindowMetrics: https://www.eightforums.com/tutorials/8463-border-width-windows-change-windows-8-a.html. The text is Win8 but the registry keys still have the same names.
-Michael.I'm sure this would work, but then it would work on my computer alone and no one else's, unless I required everyone to start changing windows registry keys for my application alone. That's not a very good design principle.