[PyQt] Custom QWidget FramelessWindowHint consumption ?

Hans-Peter Jansen hpj at urpla.net
Mon Feb 20 12:20:08 GMT 2017


On Montag, 20. Februar 2017 09:18:10 Estrada Matthieu wrote:
> Hello,
> 
> I am developing an application in which I want to customize my windows
> (borders, titles and buttons).
> 
> For the moment the only way I have found is to apply
> "Qt.FramelessWindowsHint" flag, then add custom buttons to min, max,
> close my window and add my own border with css.
> 
> I want to know if this is the best practice to do that and the least
> resource-intensive ?
> 
> Can I customize this kin of things by another way ?

To my knowledge, this is the way to go. 

Unfortunately, the Qt 4/5 interfaces to the various window managers are 
lacking (in part due to the attempt to unify the differences of the many 
supported OS). Using other advertized window flags result more often than not 
in missing/dissatisfying behavior. 

Additionally, the many existing X window manager implementations do contribute 
to the imperfection, because they all interpret 

	https://specifications.freedesktop.org/wm-spec/wm-spec-1.3.html

differently...

Depending on your target OS(es), that you forgot to mention, you might need to 
combine your approach with low level OS and WM dependent code (e.g. for sticky 
windows), that could be realized with e.g. xcffib on X. But be warned, that is 
an "iceberg" can of worms and a testing nightmare...

Cheers,
Pete


More information about the PyQt mailing list