code: def _qteUpdateLabelWidths(self):
          
          layout = self.layout()
          # Remove all labels from the list and add them again in the
          # new order.
          for ii in range(layout.count()):
              label = layout.itemAt(ii)
              layout.removeItem(label)
  
          # Add all labels and ensure they have appropriate width.
          for item in self._qteModeList:
              label = item[2]
              width = label.fontMetrics().size(0, str(item[1])).width()
              label.setMaximumWidth(width)
              label.setMinimumWidth(width)
              layout.addWidget(label)
  
          # Remove the width constraint from the last label so that
          # it can expand to the right.
          _, _, label = self._qteModeList[-1]
          label.setMaximumWidth(1600000)
docs: Ensure all but the last ``QLabel`` are only as wide as necessary.
  
          The width of the last label is manually set to a large value to
          ensure that it stretches as much as possible. The height of all
          widgets is also set appropriately. The method also takes care
          or rearranging the widgets in the correct order, ie. in the
          order specified by ``self._qteModeList``.
  
          |Args|
  
          * **None**
  
          |Returns|
  
          * **None**
  
          |Raises|
  
          * **None**