title: QLayout: Attempting to add QLayout “” to QWidget “”, which already has a layout
body: <p>I have an issue with my PyQt setup. Whenever I load my script, I got this message popping.</p>
  
  <p><code>QLayout: Attempting to add QLayout "" to Ingest "Ingest", which already has a layout</code></p>
  
  <p>That's my first time trying to implement a Promoted Widget and I'm not very experimented yet with PyQt. Essentially, I'm loading my 'MainWindow', which gets its promoted widget 'Ingest'.
  I've done my interfaces using QtDesigner and I convert my .ui using pyuic4 into .py.</p>
  
  <p>The main problem looks to be somewhere between my promoted tab "Ingest" and the "Ingest" widget itself. 
  Your help will be very appreciated!</p>
  
  <p>Here's my whole thing (stripped of all the unrelated commands). Please don't mind if it's a little bit messy. </p>
  
  <p>First, my opening script:</p>
  
  <pre><code>import sys
  
  from PyQt4.QtGui import *
  from PyQt4.QtCore import *
  
  from python.mainwindow import MainWindow
  
  def main():
      app = QApplication(sys.argv)
      app.processEvents()
  
      mw = MainWindow()
      mw.show()
  
      app.exec_()
  
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <p>This calls my MainWindow script.</p>
  
  <p>MainWindow class:</p>
  
  <pre><code>from PyQt4.QtGui import *
  from PyQt4.QtCore import *
  from .ui.mainwindow import Ui_MainWindow
  from styleSheets import styleSheets
  import some_other_imports
  
  class MainWindow(QMainWindow,Ui_MainWindow):
      def __init__(self,parent = None):
          super(MainWindow,self).__init__(parent)
          self.setupUi(self)
  
          self.setWindowTitle("Project Manager")
          #self.setWindowIcon(QIcon("some/path/icon.png"))
  
          #self.some_other_commands('foo')
  
          #self.this_dir = os.path.dirname(__file__)
  
  
      def some_other_commands(self,some_arg):
          return  some_arg
  </code></pre>
  
  <pre><code>from PyQt4 import QtCore, QtGui
  
  try:
      _fromUtf8 = QtCore.QString.fromUtf8
  except AttributeError:
      def _fromUtf8(s):
          return s
  
  try:
      _encoding = QtGui.QApplication.UnicodeUTF8
      def _translate(context, text, disambig):
          return QtGui.QApplication.translate(context, text, disambig, _encoding)
  except AttributeError:
      def _translate(context, text, disambig):
          return QtGui.QApplication.translate(context, text, disambig)
  
  class Ui_MainWindow(object):
      def setupUi(self, MainWindow):
          MainWindow.setObjectName(_fromUtf8("MainWindow"))
          MainWindow.setEnabled(True)
          MainWindow.resize(948, 540)
          sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
          sizePolicy.setHorizontalStretch(0)
          sizePolicy.setVerticalStretch(0)
          sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth())
          MainWindow.setSizePolicy(sizePolicy)
          MainWindow.setMinimumSize(QtCore.QSize(948, 540))
          MainWindow.setMaximumSize(QtCore.QSize(948, 16777215))
          MainWindow.setDockOptions(QtGui.QMainWindow.AllowTabbedDocks|QtGui.QMainWindow.AnimatedDocks)
          self.centralwidget = QtGui.QWidget(MainWindow)
          self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
          self.gridLayout = QtGui.QGridLayout(self.centralwidget)
          self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
          self.tabWidget = QtGui.QTabWidget(self.centralwidget)
          self.tabWidget.setObjectName(_fromUtf8("tabWidget"))
  
          # PROJECT TAB
          self.project_tab = QtGui.QWidget()
          self.project_tab.setObjectName(_fromUtf8("project_tab"))
          self.gridLayout_5 = QtGui.QGridLayout(self.project_tab)
          self.gridLayout_5.setObjectName(_fromUtf8("gridLayout_5"))
          spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
          self.gridLayout_5.addItem(spacerItem, 2, 3, 1, 1)
          self.projects_listWidget = QtGui.QListWidget(self.project_tab)
          self.gridLayout_5.addWidget(self.projects_listWidget, 0, 0, 1, 2)
          self.tabWidget.addTab(self.project_tab, _fromUtf8(""))
  
          # SEQ/SHOT TAB
          self.seqshots_tab = QtGui.QWidget()
          self.seqshots_tab.setObjectName(_fromUtf8("seqshots_tab"))
          self.horizontalLayout = QtGui.QHBoxLayout(self.seqshots_tab)
          self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
          self.gridLayout_2 = QtGui.QGridLayout()
          self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
          self.treeWidget = QtGui.QTreeWidget(self.seqshots_tab)
          self.treeWidget.setAnimated(True)
          self.treeWidget.setObjectName(_fromUtf8("treeWidget"))
          self.gridLayout_2.addWidget(self.treeWidget, 1, 0, 1, 4)
          self.tabWidget.addTab(self.seqshots_tab, _fromUtf8(""))
  
          # INGEST TAB
          # *** PROBLEMATIC TAB ***
          self.ingest_tab = Ingest(self.tabWidget)
          self.ingest_tab.setObjectName(_fromUtf8("ingest_tab"))
          self.tabWidget.addTab(self.ingest_tab, _fromUtf8(""))
  
          # SETTINGS TAB
          self.settings_tab = QtGui.QWidget()
          self.settings_tab.setObjectName(_fromUtf8("settings_tab"))
          self.tabWidget.addTab(self.settings_tab, _fromUtf8(""))
          self.gridLayout.addWidget(self.tabWidget, 0, 1, 1, 1)
  
          MainWindow.setCentralWidget(self.centralwidget)
  
          self.retranslateUi(MainWindow)
          self.tabWidget.setCurrentIndex(2)
          QtCore.QMetaObject.connectSlotsByName(MainWindow)
  
      def retranslateUi(self, MainWindow):
          MainWindow.setWindowTitle(_translate("MainWindow", "Project Manager", None))
          self.tabWidget.setTabText(self.tabWidget.indexOf(self.project_tab), _translate("MainWindow", "Project", None))
          self.treeWidget.headerItem().setText(0, _translate("MainWindow", "Items", None))
          self.tabWidget.setTabText(self.tabWidget.indexOf(self.seqshots_tab), _translate("MainWindow", "Seq / Shots", None))
          self.tabWidget.setTabText(self.tabWidget.indexOf(self.ingest_tab), _translate("MainWindow", "Ingest", None))
          self.tabWidget.setTabText(self.tabWidget.indexOf(self.settings_tab), _translate("MainWindow", "Settings", None))
  
  from ..ingest import Ingest
  
  if __name__ == "__main__":
      import sys
      app = QtGui.QApplication(sys.argv)
      MainWindow = QtGui.QMainWindow()
      ui = Ui_MainWindow()
      ui.setupUi(MainWindow)
      MainWindow.show()
      sys.exit(app.exec_())
  
  </code></pre>
  
  <p>This Ui_MainWindow interface calls the promoted tab 'Ingest'.</p>
  
  <p>And now for the main course, my 'Ingest' widget:</p>
  
  <pre><code>import os,sys
  
  from PyQt4.QtGui import *
  from PyQt4.QtCore import *
  from .ui.ingest import Ui_Ingest
  
  class Ingest(QMainWindow,Ui_Ingest):
      def __init__(self,parent=None):
          super(Ingest,self).__init__(parent)
          self.setupUi(self)
          self.setWindowTitle("Ingest Tools")
  
          #self.button.currentIndexChanged.connect(self.some_command)
  
      def some_command(self):
          return "foo"
  </code></pre>
  
  <pre><code>from PyQt4 import QtCore, QtGui
  
  try:
      _fromUtf8 = QtCore.QString.fromUtf8
  except AttributeError:
      def _fromUtf8(s):
          return s
  
  try:
      _encoding = QtGui.QApplication.UnicodeUTF8
      def _translate(context, text, disambig):
          return QtGui.QApplication.translate(context, text, disambig, _encoding)
  except AttributeError:
      def _translate(context, text, disambig):
          return QtGui.QApplication.translate(context, text, disambig)
  
  class Ui_Ingest(object):
      def setupUi(self, Ingest):
          Ingest.setObjectName(_fromUtf8("Ingest"))
          Ingest.resize(686, 374)
          self.horizontalLayout = QtGui.QHBoxLayout(Ingest)
          self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
          self.splitter = QtGui.QSplitter(Ingest)
          self.splitter.setOrientation(QtCore.Qt.Horizontal)
          self.splitter.setObjectName(_fromUtf8("splitter"))
          self.widget = QtGui.QWidget(self.splitter)
          self.widget.setObjectName(_fromUtf8("widget"))
          self.gridLayout_2 = QtGui.QGridLayout(self.widget)
          self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
          self.ingest_project_group = QtGui.QGroupBox(self.widget)
          self.ingest_project_group.setTitle(_fromUtf8("Projects"))
          self.ingest_project_group.setObjectName(_fromUtf8("ingest_project_group"))
          self.gridLayout_7 = QtGui.QGridLayout(self.ingest_project_group)
          self.gridLayout_7.setObjectName(_fromUtf8("gridLayout_7"))
          self.ingest_project_comboBox = QtGui.QComboBox(self.ingest_project_group)
          self.ingest_project_comboBox.setObjectName(_fromUtf8("ingest_project_comboBox"))
          self.gridLayout_7.addWidget(self.ingest_project_comboBox, 0, 0, 1, 1)
          self.gridLayout_2.addWidget(self.ingest_project_group, 0, 0, 1, 1)
          self.ingest_data_group = QtGui.QGroupBox(self.widget)
          self.ingest_data_group.setMinimumSize(QtCore.QSize(209, 0))
          self.ingest_data_group.setMaximumSize(QtCore.QSize(209, 16777215))
          self.ingest_data_group.setTitle(_fromUtf8("Data"))
          self.ingest_data_group.setObjectName(_fromUtf8("ingest_data_group"))
          self.gridLayout_4 = QtGui.QGridLayout(self.ingest_data_group)
          self.gridLayout_4.setObjectName(_fromUtf8("gridLayout_4"))
          self.ingest_path = QtGui.QLineEdit(self.ingest_data_group)
          self.ingest_path.setMaximumSize(QtCore.QSize(16777215, 25))
          self.ingest_path.setText(_fromUtf8(""))
          self.ingest_path.setObjectName(_fromUtf8("ingest_path"))
          self.gridLayout_4.addWidget(self.ingest_path, 0, 0, 1, 1)
          self.ingest_path_button = QtGui.QPushButton(self.ingest_data_group)
          self.ingest_path_button.setMinimumSize(QtCore.QSize(25, 0))
          self.ingest_path_button.setMaximumSize(QtCore.QSize(25, 16777215))
          self.ingest_path_button.setText(_fromUtf8("..."))
          self.ingest_path_button.setObjectName(_fromUtf8("ingest_path_button"))
          self.gridLayout_4.addWidget(self.ingest_path_button, 0, 1, 1, 1)
          self.ingest_resolutionFolder_checkBox = QtGui.QCheckBox(self.ingest_data_group)
          self.ingest_resolutionFolder_checkBox.setToolTip(_fromUtf8("&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Check it if there is a resolution folder in each shots.&lt;/p&gt;&lt;p&gt;Example: [...]/19TWO_VFX_2001-01-01/19TWO_042_010/&lt;span style=\" font-weight:600; text-decoration: underline;\"&gt;2048x1152&lt;/span&gt;/frame.1001.dpx&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;"))
          self.ingest_resolutionFolder_checkBox.setText(_fromUtf8("Resolution Folder"))
          self.ingest_resolutionFolder_checkBox.setObjectName(_fromUtf8("ingest_resolutionFolder_checkBox"))
          self.gridLayout_4.addWidget(self.ingest_resolutionFolder_checkBox, 1, 0, 1, 1)
          self.ingest_getData_button = QtGui.QCommandLinkButton(self.ingest_data_group)
          self.ingest_getData_button.setMaximumSize(QtCore.QSize(150, 16777215))
          self.ingest_getData_button.setText(_fromUtf8("Refresh Datas"))
          self.ingest_getData_button.setObjectName(_fromUtf8("ingest_getData_button"))
          self.gridLayout_4.addWidget(self.ingest_getData_button, 2, 0, 1, 1)
          spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
          self.gridLayout_4.addItem(spacerItem, 7, 0, 1, 1)
          self.ingest_update_in_FS_button = QtGui.QCommandLinkButton(self.ingest_data_group)
          self.ingest_update_in_FS_button.setMaximumSize(QtCore.QSize(150, 16777215))
          self.ingest_update_in_FS_button.setText(_fromUtf8("Update \'in FS\'"))
          self.ingest_update_in_FS_button.setObjectName(_fromUtf8("ingest_update_in_FS_button"))
          self.gridLayout_4.addWidget(self.ingest_update_in_FS_button, 8, 0, 1, 1)
          self.ingest_nameMatchCode = QtGui.QLineEdit(self.ingest_data_group)
          self.ingest_nameMatchCode.setToolTip(_fromUtf8("&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&amp;quot;&lt;/p&gt;&lt;p&gt;Use flags to return a naming convention when naming the files or folders in a project. Always separate the flags with underscors ( _ ).&lt;br/&gt;example: &amp;lt;proj&amp;gt;_&amp;lt;0&amp;gt;_&amp;lt;seq&amp;gt;_&amp;lt;shot&amp;gt;&lt;/p&gt;&lt;p&gt;FLAGS&lt;br/&gt;&amp;lt;0&amp;gt; : Null info. Put this if there\'s a place with nothing to get.&lt;br/&gt;&amp;lt;proj&amp;gt; : Indicates the abreviation or name of the project. &lt;br/&gt;&amp;lt;seq&amp;gt; : Gets the name of the sequence. Insert this multiple times if the sequence has multiple sections.&lt;br/&gt;&amp;lt;shot&amp;gt; : Gets the name of the shot. Insert this multiple times if the shot has multiple sections.&lt;/p&gt;&lt;p&gt;&amp;quot;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;"))
          self.ingest_nameMatchCode.setText(_fromUtf8(""))
          self.ingest_nameMatchCode.setObjectName(_fromUtf8("ingest_nameMatchCode"))
          self.gridLayout_4.addWidget(self.ingest_nameMatchCode, 4, 0, 1, 2)
          self.ingest_nameMatchCode_label = QtGui.QLabel(self.ingest_data_group)
          self.ingest_nameMatchCode_label.setText(_fromUtf8("Name Match Code:"))
          self.ingest_nameMatchCode_label.setObjectName(_fromUtf8("ingest_nameMatchCode_label"))
          self.gridLayout_4.addWidget(self.ingest_nameMatchCode_label, 3, 0, 1, 2)
          self.gridLayout_2.addWidget(self.ingest_data_group, 1, 0, 1, 1)
          self.ingest_shot_table = QtGui.QTableWidget(self.splitter)
          self.ingest_shot_table.setMinimumSize(QtCore.QSize(250, 0))
          self.ingest_shot_table.setObjectName(_fromUtf8("ingest_shot_table"))
          self.ingest_shot_table.setColumnCount(0)
          self.ingest_shot_table.setRowCount(0)
          self.widget1 = QtGui.QWidget(self.splitter)
          self.widget1.setObjectName(_fromUtf8("widget1"))
          self.verticalLayout = QtGui.QVBoxLayout(self.widget1)
          self.verticalLayout.setMargin(0)
          self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
          self.pushButton = QtGui.QPushButton(self.widget1)
          self.pushButton.setObjectName(_fromUtf8("pushButton"))
          self.verticalLayout.addWidget(self.pushButton)
          spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
          self.verticalLayout.addItem(spacerItem1)
          self.horizontalLayout.addWidget(self.splitter)
  
          self.retranslateUi(Ingest)
          QtCore.QMetaObject.connectSlotsByName(Ingest)
  
      def retranslateUi(self, Ingest):
          Ingest.setWindowTitle(_translate("Ingest", "Form", None))
          self.pushButton.setText(_translate("Ingest", "PushButton", None))
  
  
  if __name__ == "__main__":
      import sys
      app = QtGui.QApplication(sys.argv)
      Ingest = QtGui.QWidget()
      ui = Ui_Ingest()
      ui.setupUi(Ingest)
      Ingest.show()
      sys.exit(app.exec_())
  </code></pre>