I am finding a way to customize my window title bar for my PyQt4
application. As far as I understand, It is not possible to use Style-sheet
for this purpose. Instead I have to hide the title bar with
.setWindowFlags(QtCore.Qt.FramelessWindowHint)
and implement my own title bar. This is where I am puzzled as I have seen someone did use a QHboxlayout
with QLabel
(for window title name) and QButton
(for exit,max,min actions) to make one like this
And he used Style-Sheets
to decorate each individual widgets. That's probably fine for a simple title bar. But what if I want more complicated title bar like this?
I don't think just by altering Style-Sheets
properties will give me this kind of looks.
So,my question is, is it possible to create such a complicated title bar in PyQt4
? If so, as a beginner, what should I be looking at? I will dig and learn the concept by myself, I just needs some directions.
Perhaps I am too late in replying, but anyway, I'll just let you know a few thing I have pickup myself. For one, it is quite easy to create such a "complicated" title bar, and UI using PyQt4. I would recommend you to read this post
Stacking QPushButtons on the other side of a QMenuBar
The UI for the max/min/close buttons may be achieved using style sheets - you'll have to tinker with it a fair amount. If you have trouble adapting the code from Qt4 to PyQt4 you can mail me, I'll do my best to help you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.