views:

167

answers:

3

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/

+2  A: 

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.

jkerian
+1  A: 

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?

Prof.Ebral
this is a good starting point. But how do i make a button right next to a TabsWidget. Like in opera: http://www.shrani.si/f/1u/e9/2GyFHhFv/tabs-in-menu.jpg
hugo24
I'll be honest. That is not the easiest task to accomplish. I have not tried that before, so I can only give you an idea of how that is done. Keep in mind that the QTabWidget inherit QWidget, so if you can ever find out what QLayout is used .. you can add widgets too the layout. You can probably drop down the widgets in a QGridLayout, and then extend the contents of the tab, or use CSS to reduce margins and paddings. This is all just speculation. I would experiment with different options and see what you can do. First on the list would be the grid layout.
Prof.Ebral
+1  A: 

Hi, 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) :)

Ivan