title: pyqt5 QTreeView horizontal scrollbar doesn't show up again
body: <p>I've this QtDesigner generated Widget : <code>mainuiXXXX.py</code></p>
  <pre><code>from PyQt5 import QtCore, QtGui, QtWidgets
  
  
  class Ui_MyApp(object):
      def setupUi(self, MyApp):
          MyApp.setObjectName(&quot;MyApp&quot;)
          MyApp.resize(603, 413)
          self.centralwidget = QtWidgets.QWidget(MyApp)
          self.centralwidget.setObjectName(&quot;centralwidget&quot;)
          self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
          self.gridLayout.setObjectName(&quot;gridLayout&quot;)
          self.treeView = QtWidgets.QTreeView(self.centralwidget)
          self.treeView.setObjectName(&quot;treeView&quot;)
          self.treeView.setHorizontalScrollMode(QtWidgets.QAbstractItemView.ScrollPerItem)  
          self.gridLayout.addWidget(self.treeView, 0, 0, 1, 1)
          MyApp.setCentralWidget(self.centralwidget)
          self.menubar = QtWidgets.QMenuBar(MyApp)
          self.menubar.setGeometry(QtCore.QRect(0, 0, 603, 29))
          self.menubar.setObjectName(&quot;menubar&quot;)
          MyApp.setMenuBar(self.menubar)
          self.statusbar = QtWidgets.QStatusBar(MyApp)
          self.statusbar.setObjectName(&quot;statusbar&quot;)
          MyApp.setStatusBar(self.statusbar)
  
          self.retranslateUi(MyApp)
          QtCore.QMetaObject.connectSlotsByName(MyApp)
  
      def retranslateUi(self, MyApp):
          _translate = QtCore.QCoreApplication.translate
          MyApp.setWindowTitle(_translate(&quot;MyApp&quot;, &quot;MyApp&quot;))
  </code></pre>
  <p>and this MRE code :<code>test.py</code></p>
  <pre><code>import sys
  from PyQt5.QtWidgets import QApplication, QMainWindow, QHeaderView
  
  from PyQt5 import QtGui
  
  
  from mainuiXXXX import Ui_MyApp
  
  
  class MyApp(QMainWindow, Ui_MyApp):
  
      def __init__(self, parent=None):
          super(MyApp, self).__init__(parent)
  
          self.setupUi(self)
  
          self.model = None
  
          self.treeView.setHeaderHidden(True)
  
  
          self.treeView.header().setStretchLastSection(False)
          self.treeView.header().setSectionResizeMode(QHeaderView.ResizeToContents)
  
          self.create_tree()
  
          print(self.treeView.header().stretchLastSection())
  
      def create_tree(self):
  
          self.model = QtGui.QStandardItemModel()
  
          self.rootNode = self.model.invisibleRootItem()
  
          self.top = QtGui.QStandardItem('TOP')
  
          self.rootNode.appendRow(self.top)
  
          self.treeView.setModel(self.model)
  
          for i in range(100):
  
              self.mod = QtGui.QStandardItem(str('a'*i))
  
              # print(i)
              self.top.appendRow(self.mod)
  
              for i in range(3):
                  self.mod2 = QtGui.QStandardItem(str(self.mod.text() + 'aaaabbb'*i))
  
                  self.mod.appendRow(self.mod2)
                  
                  for i in range(3):
                      self.mod3 = QtGui.QStandardItem(str(self.mod.text() + 'aaaaccc'*i))
  
                      self.mod2.appendRow(self.mod3)
  
          self.treeView.expandAll()
  
  
  if __name__ == '__main__':
      app = QApplication(sys.argv)
      myapp = MyApp()
      myapp.show()
  
      try:
          sys.exit(app.exec_())
      except SystemExit:
          print('Closing Window...')
  
  </code></pre>
  <p>it includes the</p>
  <pre><code>self.treeView.header().setStretchLastSection(False)
  self.treeView.header().setSectionResizeMode(QHeaderView.ResizeToContents)
  
  </code></pre>
  <p>from here: <a href="https://stackoverflow.com/questions/71812499/pyqt5-qtreeview-horizontal-scrollbar-doesnt-show-up">pyqt5 QTreeView horizontal scrollbar doesn&#39;t show up</a> and <a href="https://stackoverflow.com/questions/70891913/how-to-make-pyqt5-qscrollarea-horizontal-scrollbar-show-up-dynamically">How to make PyQt5 QScrollArea horizontal scrollbar show up dynamically?</a></p>
  <p>but no horizontal scrollBar again, its drivin me crazy, I get this:</p>
  <p><a href="https://i.stack.imgur.com/waGkC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/waGkC.png" alt="enter image description here" /></a></p>