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/

hugo24
  • 1,089
  • 13
  • 21
  • What particular features from Chrome do you want to implement with Qt? I thought you were talking about look&feel, but your link was talking about process safety. At least in the default install, Chrome doesn't really have a menu bar. – jkerian Sep 02 '10 at 20:15
  • I only want the simple look. Tabs on top and a settings button on the side. :) – hugo24 Sep 03 '10 at 21:01
  • 2
    can you upload at least upload a picture of the look you want? let me know the exact look so i can send you a sample code for it. – Moayyad Yaghi Sep 22 '10 at 12:21
  • I would love to have it like opera: http://www.shrani.si/f/1u/e9/2GyFHhFv/tabs-in-menu.jpg 1. Menu on the left. 2. Tabs on top. 3. Minimize, Maximize, Close on the right – hugo24 Sep 23 '10 at 07:54
  • its for my little project: http://code.google.com/p/simple-database-explorer/ :) – hugo24 Sep 23 '10 at 07:58

3 Answers3

3

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?

  • 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 Sep 28 '10 at 15:29
  • 1
    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. –  Sep 28 '10 at 18:33
2

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
  • 16,497
  • 3
  • 46
  • 59
2

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
  • 640
  • 5
  • 9
  • Well, I don't think that is the correct solution. Creating a `FramelessWindowHint` will make the application goes to fullscreen when user maximize it. – swdev Jul 02 '14 at 07:42