hugo24
hugo24

Reputation: 1108

Pyqt tabs like in Google Chrome

I would like to have my pyqt aplication have tabs in the menu bar like Google Chrome :)

Any suggestions or a simple example on how to do it?

I did find these relevant link:
- http://ivan.fomentgroup.org/blog/2009/03/29/instant-chrome/

Upvotes: 4

Views: 3667

Answers (3)

Ivan
Ivan

Reputation: 650

you need to do the following:

  • remove window border (FramelessWindowHint)
  • Implement your own window moving and resizing code
  • Insert tabbar on the top, and add buttons for close etc. to it (or create a frame that will contain the tabbar and buttons)

And that's all that was done in Webbie (the link you provided) :)

Upvotes: 2

Prof.Ebral
Prof.Ebral

Reputation:

You have to use the Qt.FramelessWindowHint for that, and then create your own Max, Min, Close buttons as Widgets and add them there. I have a good working toolkit for these types of softwares: http://traipse.assembla.com/spaces/ghostqt

In your case you should reclass the resizeEvent so you can change the flags. If the window is maximized you will not need to worry about moving it around, but if it is not maximized you can remove the Qt.FramelessWindowHint flag and get your title bar back; just like Chrome does.

Is that what you are looking for?

Upvotes: 3

jkerian
jkerian

Reputation: 17046

If I understand correctly, just create a QWindow that contains a QTabBar widget(and not a QMenuBar, or simply use a QTabWidget as your main program widget.

Upvotes: 2

Related Questions