title: reorder widgets in layout
body: <p>I have a senario where I have QComboBoxes (the black rectangles) and QPushButtons (the red cubes). I need the two buttons to always stay on either side of the most right combo.</p>
  
  <p><img src="https://i.imgur.com/RgkTS.png" alt="Valid XHTML">.</p>
  
  <p>Code example:</p>
  
  <pre><code>self.button1 QPushButton()
  self.button2 = QPushButton()
  
  
  def addCombo():
      # remove buttons from next to previous right most combo
      layout.removeWidget( self.button1 )
      layout.removeWidget( self.button2 )
  
      # add button left of new right most combo
      layout.addWidget( self.button1 )
      # add new right most combo
      layout.addWidget( QComboBox() )
      # add button right of new right most combo
      layout.addWidget( self.button2 )
  
  
  def removeCombo():
      # remove buttons from next to previous right most combo
      layout.removeWidget( self.button1 )
      layout.removeWidget( self.button2 )
  
      # delete right most combo
      layout.takeAt( len(layout.children()) -1 )
  
      # add button left of new right most combo # button , index
      layout.insertWidget( self.button1 ,  len(layout.children()) - 2 )
      # add button right of new right most combo
      layout.addWidget( self.button2 )
  
  
  #So for the first layout:
  layout.addWidget( QComboBox() )
  layout.addWidget( self.button1 ) 
  layout.addWidget( QComboBox() )
  layout.addWidget( self.button2 )
  
  
  #second layout:
  addCombo()
  
  
  #third layout:
  addCombo()
  
  
  # fourth layout
  </code></pre>
  
  <p>Please let me know if you have any ideas, tips or solutions.</p>