title: Make every tab the same width and also expandable
body: <p>I'm trying to achieve something like the tabs from a Browser. All tabs must have the same width and also be expandable so when there are a lot of them they need to resize and fit the window (exactly like Chrome or Firefox does).</p>
  
  <hr>
  
  <p><strong>The Problem:</strong></p>
  
  <p>If a tab have more text then the other tabs, the tab will be larger. Like so:</p>
  
  <p><a href="https://i.stack.imgur.com/iQcOz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iQcOz.png" alt="enter image description here"></a></p>
  
  <p>And if I spawn a lot of tabs, it will always be larger then the others.</p>
  
  <p><a href="https://i.stack.imgur.com/AvRvI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AvRvI.png" alt="enter image description here"></a></p>
  
  <hr>
  
  <p><strong>What I have tried:</strong></p>
  
  <p>I have tried to add a stylesheet to change the width, but if I change the width to a specific number, the tabs will be static and not resize based on the number of tabs to fit the window. Also I tried to tweak with min/max width, messing with the QSizePolicy, but no chance.</p>
  
  <p>I have looked at the documentation of QT5 for C++ and googled a lot, but no place talks about this or any option about this.</p>
  
  <p>Maybe I need to do some calculations in python and add to a stylesheet as a argument, but not sure how. Maybe there is a simple option that I'm missing.</p>
  
  <hr>
  
  <p><strong>My code:</strong> (This is the full code, so you can copy-paste and test it if you need)<br>
      </p>
  
  <pre><code>import sys
  
  from PyQt5.QtCore import Qt
  from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QTabWidget,\
      QVBoxLayout, QHBoxLayout, QSizePolicy
  
  
  class Container(QWidget):
      def __init__(self, text):
          super(Container, self).__init__()
  
          self.hbox = QHBoxLayout()
          self.hbox.setSpacing(0)
          self.hbox.setContentsMargins(0, 0, 0, 0)
          self.setLayout(self.hbox)
  
          self.button = QPushButton(text)
          self.hbox.addWidget(self.button)
  
  
  class CustomWidget (QWidget):
      def __init__(self, parent=None):
          super(CustomWidget, self).__init__(parent)
  
          self.button = QPushButton("Add tab")
          self.button.clicked.connect(self.buttonClicked)
  
          self.tabs = QTabWidget()
          self.tabs.setTabsClosable(True)
          self.tabs.setMovable(True)
          self.tabs.setDocumentMode(True)
          self.tabs.setElideMode(Qt.ElideRight)
          self.tabs.setUsesScrollButtons(True)
          self.tabs.tabCloseRequested.connect(self.closeTab)
  
          self.tabs.addTab(Container("Very big titleeeeeeeeee"),
                           "Very big titleeeeeeeeeeee")
          self.tabs.addTab(Container("smalltext"), "smalltext")
          self.tabs.addTab(Container("smalltext2"), "smalltext2")
  
          vbox = QVBoxLayout()
          vbox.addWidget(self.button)
          vbox.addWidget(self.tabs)
          self.setLayout(vbox)
  
          self.resize(600, 600)
  
      def closeTab(self, index):
          tab = self.tabs.widget(index)
          tab.deleteLater()
          self.tabs.removeTab(index)
  
      def buttonClicked(self):
          self.tabs.addTab(Container("smalltext2"), "smalltext2")
  
  
  app = QApplication([])
  
  app.setStyleSheet("""
      QTabBar::tab {
          background: lightgray;
          color: black;
          border: 0;
          /* min-width: 100px; */
          max-width: 200px;
          /* width: 150px; */
          height: 20px;
          padding: 5px;
      }
  
      QTabBar::tab:selected {
          background: gray;
          color: white;
      }
  """)
  
  widget = CustomWidget()
  widget.show()
  
  sys.exit(app.exec_())
  </code></pre>
  
  <hr>
  
  <p><strong>Other information:</strong>  </p>
  
  <p>Operating System: Windows 10<br>
  Python Version: 3.6.2<br>
  PyQt Version: 5.9.1  </p>