2

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

enter image description here

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?

enter image description here

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.

Chris Aung
  • 9,152
  • 33
  • 82
  • 127

1 Answers1

0

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.

Community
  • 1
  • 1
Marcus
  • 1,685
  • 1
  • 18
  • 33
  • I would as well like to add that you may subclass QMainWindow, and QMenubar to perhaps obtain the exact configuration and paint the extra details. Its a lot of work and quite tedious. The method in the above post is quite clean. – Marcus Jan 02 '15 at 19:45