class_docstr: Extends QProgressDialog:
  
    * Adds context management so the dialog may be used in `with` statements
    * Allows nesting multiple progress dialogs
  
  Example::
  
      with ProgressDialog("Processing..", minVal, maxVal) as dlg:
          # do stuff
          dlg.setValue(i)   ## could also use dlg += 1
          if dlg.wasCanceled():
              raise Exception("Processing canceled by user")
code: def _addSubDialog(self, dlg):
      # insert widgets from another dialog into this one.
  
      # set a new layout and arrange children into it (if needed).
      self._prepareNesting()
  
      bar, btn = dlg._extractWidgets()
  
      # where should we insert this widget? Find the first slot with a
      # "removed" widget (that was left as a placeholder)
      inserted = False
      for i, bar2 in enumerate(self._subBars):
          if bar2.hidden:
              self._subBars.pop(i)
              bar2.hide()
              bar2.setParent(None)
              self._subBars.insert(i, bar)
              inserted = True
              break
      if not inserted:
          self._subBars.append(bar)
  
      # reset the layout
      while self.nestedLayout.count() > 0:
          self.nestedLayout.takeAt(0)
      for b in self._subBars:
          self.nestedLayout.addWidget(b)
  
imports: from time import perf_counter
  from ..Qt import QtCore, QtGui, QtWidgets
label_desc: Use image node_id 5 for calling the ProgressDialog obj's underlying member method code with example usage: obj._addSubDialog(dlg) without return types