title: Add QWidget to QListWidget
body: <p>I am trying to make a QListWidget in which each item is a simple widget that contains text and a pushbutton. I use the following:</p>
  
  <pre><code>itemN = QtGui.QListWidgetItem() 
  #Create widget
  widget = QtGui.QWidget()
  widgetText =  QtGui.QLabel("I love PyQt!")
  widgetButton =  QtGui.QPushButton("Push Me")
  widgetLayout = QtGui.QHBoxLayout()
  widgetLayout.addWidget(widgetText)
  widgetLayout.addWidget(widgetButton)
  widgetLayout.addStretch()
  widget.setLayout(widgetLayout)
  #Add widget to QListWidget funList
  funList.addItem(itemN)
  funList.setItemWidget(itemN, widget)
  </code></pre>
  
  <p>The problem is, nothing shows up. I get a blank line that I can navigate using my keyboard, but it is blank. When the widget contains <em>just</em> a pushbutton, it works, so it isn't as if the pushbutton alone is messing things up. Are there limits on the complexity of widgets that <code>setItemWidget</code> can handle? Perhaps I need to go beyond the convenience classes, as suggested in some of the related posts below?</p>
  
  <p><strong>Related posts</strong></p>
  
  <p><a href="https://stackoverflow.com/questions/24417285/pyqt-adding-a-widget-to-a-qlistwidget">pyqt adding a widget to a QListWidget</a><br>
  Note the previous post has a similar title to mine, but seems to be a relatively poorly expressed question about a complex pastiche of code from QtDesigner (mixed with some custom stuff). It is not clear at all that this is actually the question the person should have been asking. While the title makes it seem like a duplicate, the question (I pray) is not.</p>
  
  <p>I would say something similar about <a href="https://stackoverflow.com/questions/23850696/populating-a-qlistwidget-with-custom-widgets">this</a> post.</p>
  
  <p><a href="https://stackoverflow.com/questions/18904155/qlistwidgetitem-with-radio-button">QListWidgetItem with Radio Button</a></p>
  
  <p><a href="https://stackoverflow.com/questions/948444/qlistview-qlistwidget-with-custom-items">QListView/QListWidget with custom items and custom item widgets</a></p>
  
  <p><a href="https://stackoverflow.com/questions/8063864/adding-custom-widget-to-qlistwidget-in-qt-click-issue-in-qt">Adding Custom Widget to QListWidget in QT click issue in QT?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/24417285/pyqt-adding-a-widget-to-a-qlistwidget">pyqt adding a widget to a QListWidget</a></p>
  
  <p><a href="http://www.qtcentre.org/threads/8660-Drawing-a-widget-in-QItemDelegate-s-paint-method" rel="noreferrer">http://www.qtcentre.org/threads/8660-Drawing-a-widget-in-QItemDelegate-s-paint-method</a></p>
  
  <p><a href="http://developer.nokia.com/community/discussion/showthread.php/211634-Adding-a-button-inside-QListWidgetItem" rel="noreferrer">http://developer.nokia.com/community/discussion/showthread.php/211634-Adding-a-button-inside-QListWidgetItem</a></p>