Praneet Mehta
Praneet Mehta

Reputation: 121

PyQt QTabWidget Multiple Corner WIdgets

I want to remove the actual Close, minimize and maximize buttons of a window and create my own custom buttons, just like in chrome. I therefore want to add corner widgets to my tabwidget. Is there a way so that I can add three buttons as corner widgets of a QTabWidget? Is it somehow possible to achieve using the QHBoxLayout ? The setCornerWidget function just takes one widget as its input.

Upvotes: 1

Views: 947

Answers (1)

jonspaceharper
jonspaceharper

Reputation: 4367

  1. Add a generic QWidget as the corner widget.
  2. Give it a QHBoxLayout.
  3. Add your buttons to the layout.

I use this frequently, often by subclassing QTabWidget and creating accessor functions that return the individual buttons. Adding signals like buttonClicked(int) with the index and buttonClicked(QAbstractButton) with the button itself are helpful, too.

Upvotes: 5

Related Questions