Pyqt tabs like in Google Chrome

后端 未结 3 1205
既然无缘
既然无缘 2021-01-01 06:51

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

相关标签:
3条回答
  • 2021-01-01 07:18

    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?

    0 讨论(0)
  • 2021-01-01 07:22

    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.

    0 讨论(0)
  • 2021-01-01 07:22

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

    0 讨论(0)
提交回复
热议问题